diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..57fa5f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.11 + +WORKDIR /app + +COPY . . + +RUN pip install --upgrade pip + +RUN pip install --no-cache-dir -r requirements.txt + +EXPOSE 1080 + +CMD ["python", "ProxyCat.py", "-c", "/app/config/config.ini"] + diff --git a/README-EN.md b/README-EN.md index 8a1b977..a825344 100644 --- a/README-EN.md +++ b/README-EN.md @@ -17,6 +17,7 @@ - [Configuration File](#configuration-file) - [Demo Effect](#demo-effect) - [Using API for Automatic Proxy Retrieval](#using-api-for-automatic-proxy-retrieval) +- [Docker Deployment](#docker-deployment) - [Performance](#performance) - [Disclaimer](#disclaimer) - [Change Log](#change-log) @@ -164,6 +165,26 @@ The tool supports direct API calls to obtain proxy addresses. When you configure In this case, you need to modify the content of **getip.py** to your own API, with format `IP:PORT`. Default protocol is `socks5`, manually change to `http` if needed. +### Docker Deployment + +Please install Docker and Docker-compose in advance. You can search for installation methods online. + +``` +# Clone the project source code locally +git clone https://github.com/honmashironeko/ProxyCat.git + +# Modify the content in the config.ini file in the config folder + +# Enter the ProxyCat folder, build the image and start the container +docker-compose up -d --build + +# Stop and start the service (you need to restart the service after modifying the configuration each time) +docker-compose down | docker-compose up -d + +# View log information +docker logs proxycat-app-1 +``` + ## Performance Through actual testing, when proxy server performance is sufficient, ProxyCat can handle **1000** concurrent connections without packet loss, covering most scanning and penetration testing needs. @@ -181,6 +202,11 @@ Through actual testing, when proxy server performance is sufficient, ProxyCat ca ## Change Log +### 2025/01/03 + +- Centralize the management of configuration parameters into configuration files to improve maintenance convenience. +- Fix some known bugs and improve stability and concurrency capabilities. + ### 2025/01/02 - Restructured software architecture for better usability diff --git a/README.md b/README.md index fb00a6f..e0a10a2 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - [配置文件](#配置文件) - [演示效果](#演示效果) - [使用接口自动获取代理地址](#使用接口自动获取代理地址) +- [Docker方式部署](#Docker方式部署) - [性能表现](#性能表现) - [免责申明](#免责申明) - [更新日志](#更新日志) @@ -35,7 +36,7 @@ ## 功能特点 -- **双协议支持**:支持 SOCKS5 和 HTTP 协议监听,适配更多工具 +- **双协议支持**:支持 SOCKS5 和 HTTP 协议监听地址,适配更多工具。 - **多重代理协议**:支持 HTTP/HTTPS/SOCKS5 代理服务器,满足不同应用场景需求。 - **多种切换模式**:按照顺序循环使用代理列表中的每一个代理,确保均衡使用;随机选择可用代理,分摊流量负载,提升性能。允许用户自定义代理选择逻辑,灵活满足特定需求。 - **函数获取代理**:支持通过 GetIP 函数动态获取即时可用的代理,保证代理的实时性和有效性。 @@ -119,6 +120,9 @@ password = 123456 # 是否使用 getip 模块获取代理地址 True or False(默认为:False) use_getip = False +# 获取新代理地址的URL +getip_url = http://example.com/getip + # 代理地址列表文件(默认为:ip.txt) proxy_file = ip.txt @@ -126,7 +130,6 @@ proxy_file = ip.txt check_proxies = True # 语言设置 (cn/en) -# Language setting (cn/en) language = cn # IP白名单文件路径(留空则不启用白名单) @@ -166,7 +169,27 @@ socks5://127.0.0.1:1080 工具支持直接调用代理地址获取的API接口。当您配置 `use_getip = True` 时,工具将不再从本地 `ip.txt` 中读取代理地址,而是通过执行 **getip.py** 脚本来获取新的代理地址(请确保您的IP已加白名单,并且格式为IP:端口,每次只能使用一个代理地址)。 -此时,您需要将 **getip.py** 的内容修改为您自己的接口,格式为 `IP:PORT`。默认为 `socks5` 协议,如需使用 `http`,请手动更改。 +此时,您需要保证 **getip.py** 获取到的地址信息格式为 `IP:PORT`。默认为 `socks5` 协议,如需使用 `http`,请手动更改。 + +## Docker方式部署 + +请提前安装好Docker和Docker-compose,具体安装方法可自行百度查询。 + +``` +# 拉取项目源码到本地 +git clone https://github.com/honmashironeko/ProxyCat.git + +# 修改config文件夹中的config.ini中的内容 + +# 进入ProxyCat文件夹中并构建镜像和启动容器 +docker-compose up -d --build + +# 停止服务和启动服务(每次修改完配置后需要重启服务) +docker-compose down | docker-compose up -d + +# 查看日志信息 +docker logs proxycat-app-1 +``` ## 性能表现 @@ -185,6 +208,11 @@ socks5://127.0.0.1:1080 ## 更新日志 +### 2025/01/03 + +- 集中配置参数到配置文件中管理,提升维护便利。 +- 修复部分已知BUG,并提升稳定性和并发能力。 + ### 2025/01/02 - 重构软件结构,更加整洁易用。 diff --git a/config/config.ini b/config/config.ini index 0885e53..ee729dd 100644 --- a/config/config.ini +++ b/config/config.ini @@ -23,6 +23,10 @@ password = 123456 # Whether to use getip module to obtain proxy addresses True or False (default:False) use_getip = False +# 获取新代理地址的URL +# URL to get new proxy address +getip_url = http://example.com/getip + # 代理地址列表文件(默认为:ip.txt) # Proxy address list file (default:ip.txt) proxy_file = ip.txt diff --git a/config/getip.py b/config/getip.py index acf0955..334a561 100644 --- a/config/getip.py +++ b/config/getip.py @@ -5,7 +5,9 @@ def newip(): config = load_config() language = config.get('language', 'cn') print(get_message('getting_new_proxy', language)) - url = f"" + url = config.get('getip_url', '') + if not url: + raise ValueError(get_message('proxy_file_not_found', language, 'getip_url')) response = requests.get(url) response.raise_for_status() newip = "socks5://" + response.text.split("\r\n")[0] diff --git a/config/whitelist.txt b/config/whitelist.txt index e56ea71..e69de29 100644 --- a/config/whitelist.txt +++ b/config/whitelist.txt @@ -1 +0,0 @@ -127.0.0.1 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..588c958 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + app: + build: . + volumes: + - "./config:/app/config" + network_mode: host + command: ["python", "ProxyCat.py", "-c", "/app/config/config.ini"]