好不容易挖到的注入点,结果总是因为请求速度过快被ban掉ip,我觉得可以给sqlmap加个代理池!暑假前的想法,今天花了一个下午,终于实现了。原来是准备直接改源码的。但是被一个群里的大佬一语点醒,sqlmap有–proxy参数的。我可以代理本地,然后通过中间服务器来代理ip!也就是类似SS的方式。
打包exe下载链接:
http://pan.baidu.com/s/1c2J9JiS 密码:9x6g
py脚本形式下载链接:
http://pan.baidu.com/s/1eRHT9nG 密码:311e
到时候扔到cmd里面运行就可以了
使用方法:
使用Python运行脚本,然后sqlmap中命令加入参数
--proxy=http://127.0.0.1:9999
脚本同目录下,
ips.txt中以ip:port的格式放入已验证的多个ip。即可使用sqlmap的代理池拓展脚本。
实现代码如下:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
from socket import error
import threading
import random
import time
localtime = time.asctime( time.localtime(time.time()) )
class ProxyServerTest():
def __init__(self,proxyip):
#本地socket服务
self.ser=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
self.proxyip = proxyip
def run(self):
try:
#本地服务IP和端口
self.ser.bind(('127.0.0.1', 9999))
#最大连接数
self.ser.listen(5)
except error as e:
print("[-]The local service : "+str(e))
return "[-]The local service : "+str(e)
while True:
try :
#接收客户端数据
client,addr=self.ser.accept()
print ('[*]accept %s connect'%(addr,))
data=client.recv(1024)
if not data:
break
print ('[*'+localtime+']: Accept data...')
except error as e:
print("[-]Local receiving client : "+str(e))
return "[-]Local receiving client : "+str(e)
while True:
#目标代理服务器,将客户端接收数据转发给代理服务器
mbsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
iplen = len(self.proxyip)
proxyip = self.proxyip[random.randint(0,iplen-1)]
print("[!]Now proxy ip:"+str(proxyip))
prip = proxyip[0]
prpo= proxyip[1]
try:
mbsocket.settimeout(3)
mbsocket.connect((prip, prpo))
except:
print("[-]RE_Connect...")
continue
break
# except :
# print("[-]Connect failed,change proxy ip now...")
# pass
try:
mbsocket.send(data)
except error as e:
print("[-]Sent to the proxy server : "+str(e))
return "[-]Sent to the proxy server : "+str(e)
while True:
try:
#从代理服务器接收数据,然后转发回客户端
data_1 = mbsocket.recv(1024)
if not data_1:
break
print ('[*'+localtime+']: Send data...')
client.send(data_1)
except socket.timeout as e:
print(proxyip)
print("[-]Back to the client : "+str(e))
continue
#关闭连接
client.close()
mbsocket.close()
def Loadips():
print("[*]Loading proxy ips..")
ip_list = []
ip = ['ip','port']
with open("ips.txt") as ips:
lines = ips.readlines()
for line in lines:
ip[0],ip[1] = line.strip().split(":")
ip[1] = eval(ip[1])
nip = tuple(ip)
ip_list.append(nip)
return ip_list
def main():
print('''*Atuhor : V@1n3R.
*Blog :http://www.Lz1y.cn
*date: 2017.7.17
*http://www.Lz1y.cn/wordpress/?p=643
__ __ _ _____ ____
\ \ / /_ _/ |_ __ |___ /| _ \
\ \ / / _` | | '_ \ |_ \| |_) |
\ V / (_| | | | | |___) | _ < _
\_/ \__,_|_|_| |_|____/|_| \_(_)
''')
ip_list = Loadips()
# ip_list = [('118.89.148.92',8088)]
# ip_list = tuple(ip_list)
try:
pst = ProxyServerTest(ip_list)
#多线程
t = threading.Thread(target=pst.run, name='LoopThread')
print ('[*]Waiting for connection...')
#关闭多线程
t.start()
t.join()
except Exception as e:
print("[-]main : "+str(e))
return "[-]main : "+str(e)
if __name__ == '__main__':
main()
实测效果图
先开启python脚本,等待连接
回车输入之后就会去调用这个代理池的ip
使用proxifier全局代理,不过也要先去抓取一些socket免费代理ip 这边给上一张效果图,流量走了代理,这样一直使用代理池可以让sqlmap不怕被ban掉IP
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有