声明:该公众号大部分文章来自作者日常学习笔记,也有部分文章是经过作者授权和其他公众号白名单转载,未经授权,严禁转载,如需转载,联系开白。请勿利用文章内的相关技术从事非法测试,如因此产生的一切不良后果与文章作者和本公众号无关。
0x00.前言
我们在平时渗透的时候难免会遇到IP封禁,这个时候就需要代理IP了,本文介绍一个免费代理池搭建方法,方便师傅们平时爆破啊,目录扫描啊啥的,搭建方式非常简单,按照下面的命令10分钟就搭建好了。
0x01.配置redis
-
首先下载安装redis
wget https://codeload.github.com/redis/redis/tar.gz/refs/tags/7.0.11 #root目录下载redis压缩包
tar -zxvf 7.0.11
cd redis-7.0.11
make
make install
cd /usr/local/bin
mkdir config
cp /root/redis-7.0.11/redis.conf config
2.修改redis配置文件
打开/usr/local/bin/config/redis.conf文件,修改如下参数
daemonize yes # 守护进程开启
protected-mode no # 关闭保护模式
# bind 127.0.0.1 ::1 # 注释掉只允许本地访问
port 6379 # redis开放端口
然后打开redis
redis-server /usr/local/bin/config/redis.conf
redis-cli
启动成功如下
0x02.下载配置proxy_pool工具
1.下载到本地
git clone https://github.com/jhao104/proxy_pool.git
cd proxy_pool
2.安装依赖
pip3 install -r requirements.txt
3.修改setting.py文件,我直接使用的6379默认端口,如果redis端口不是这个请自行更改,且我未设置密码,如果设置了,请参考github的配置进行配置
4.启动项目
python proxyPool.py schedule
5.使用下面的脚本python3直接运行即可,如果你是默认127.0.0.1,端口为6379,密码为空那就不用改
#!/usr/bin/python3
# -*- coding:utf8 -*-
import redis
import json
from xml.etree import ElementTree
import fileinput
def RedisProxyGet():
ConnectString = []
pool = redis.ConnectionPool(host='127.0.0.1', port='6379', db=0, decode_responses=True)
use_proxy = redis.Redis(connection_pool=pool)
key = use_proxy.hkeys('use_proxy')
for temp in key:
try:
ConnectString.append(json.loads(use_proxy.hget('use_proxy',temp)))
except json.JSONDecodeError:
pass
return ConnectString
def xmlOutputs(data):
i = 102
ProxyIDList = []
ProxifierProfile = ElementTree.Element("ProxifierProfile")
ProxifierProfile.set("version", str(i))
ProxifierProfile.set("platform", "Windows")
ProxifierProfile.set("product_id", "0")
ProxifierProfile.set("product_minver", "400")
Options = ElementTree.SubElement(ProxifierProfile, "Options")
Resolve = ElementTree.SubElement(Options, "Resolve")
AutoModeDetection = ElementTree.SubElement(Resolve, "AutoModeDetection")
AutoModeDetection.set("enabled", "true")
ViaProxy = ElementTree.SubElement(Resolve, "ViaProxy")
ViaProxy.set("enabled", "false")
ExclusionList = ElementTree.SubElement(Resolve, "ExclusionList")
ExclusionList.set("OnlyFromListMode", "false")
ExclusionList.text = "%ComputerName%; localhost; *.local"
DnsUdpMode = ElementTree.SubElement(Resolve, "DnsUdpMode")
DnsUdpMode.text = "0"
Encryption = ElementTree.SubElement(Options, "Encryption")
Encryption.set("mode", 'basic')
Encryption = ElementTree.SubElement(Options, "ConnectionLoopDetection")
Encryption.set("enabled", 'true')
Encryption.set("resolve", 'true')
Encryption = ElementTree.SubElement(Options, "ProcessOtherUsers")
Encryption.set("enabled", 'false')
Encryption = ElementTree.SubElement(Options, "ProcessServices")
Encryption.set("enabled", 'false')
Encryption = ElementTree.SubElement(Options, "HandleDirectConnections")
Encryption.set("enabled", 'false')
Encryption = ElementTree.SubElement(Options, "HttpProxiesSupport")
Encryption.set("enabled", 'false')
ProxyList = ElementTree.SubElement(ProxifierProfile, "ProxyList")
i = 99
for temp in data:
if temp['https']:
i += 1
Proxy = ElementTree.SubElement(ProxyList, "Proxy")
Proxy.set("id", str(i))
Proxy.set("type", "HTTPS")
ProxyIDList.append(i)
else:
continue
Options = ElementTree.SubElement(Proxy, "Options")
Options.text = "48"
Port = ElementTree.SubElement(Proxy, "Port")
Port.text = temp['proxy'].split(":", 1)[1]
Address = ElementTree.SubElement(Proxy, "Address")
Address.text = temp['proxy'].split(":", 1)[0]
ChainList = ElementTree.SubElement(ProxifierProfile, "ChainList")
Chain = ElementTree.SubElement(ChainList, "Chain")
Chain.set("id", str(i))
Chain.set("type", "simple")
RedundancyRecheckTime = ElementTree.SubElement(Chain, "RedundancyRecheckTime")
RedundancyRecheckTime.text = "60"
RedundancyRecheck = ElementTree.SubElement(Chain, "RedundancyRecheck")
RedundancyRecheck.text = "true"
RedundancyTryDirect = ElementTree.SubElement(Chain, "RedundancyTryDirect")
RedundancyTryDirect.text = "false"
RedundancyTimeout = ElementTree.SubElement(Chain, "RedundancyTimeout")
RedundancyTimeout.text = "5"
for temp_id in ProxyIDList:
Proxy = ElementTree.SubElement(Chain, "Proxy")
Proxy.set("enabled", "true")
Proxy.text=str(temp_id)
Name = ElementTree.SubElement(Chain, "Name")
Name.text="AgentPool"
RuleList = ElementTree.SubElement(ProxifierProfile, "RuleList")
Rule = ElementTree.SubElement(RuleList, "Rule")
Rule.set("enabled", "true")
Action = ElementTree.SubElement(Rule,"Action")
Targets = ElementTree.SubElement(Rule,"Targets")
Name = ElementTree.SubElement(Rule,"Name")
Action.set("type", "Direct")
Targets.text="127.0.0.1; 192.168.1.*"
Name.text="Proxy"
Rule = ElementTree.SubElement(RuleList, "Rule")
Rule.set("enabled", "true")
Action = ElementTree.SubElement(Rule, "Action")
Name = ElementTree.SubElement(Rule, "Name")
Action.set("type", "Direct")
Name.text = "Default"
tree = ElementTree.ElementTree(ProxifierProfile)
tree.write("ProxifierConf.ppx", encoding="UTF-8")
with open("ProxifierConf.ppx", "r+") as file:
content = file.read()
file.seek(0, 0)
file.write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>n' + content)
if __name__ == '__main__':
proxy_data = RedisProxyGet()
xmlOutputs(proxy_data)
print("ProxifierConf.ppx配置文件创建完成....")
6.运行如下,会生成一个ProxifierConf.ppx配置文件,建议每次使用前重新生成该文件,因为用久了之前爬下来的代理IP不一定好使了。
0x03.使用proxifier
1.直接讲生成的ProxifierConf.ppx放在桌面,双击使用就行
2.配置proxifier,如下图配置就行
3.查看下本地IP已近发生改变,可以去放心大胆爆破啦。
原文始发于微信公众号(夜安团队SEC):渗透技巧分享-免费代理池搭建
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论