高速隐蔽隧道工具

admin 2026-01-21 01:12:57 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 本文介绍了一款名为smtp-tunnel-proxy的高速隐蔽隧道工具,它通过将TCP流量伪装成SMTP电子邮件通信,结合TLS加密及模仿Postfix握手机制,旨在绕过深度包检测防火墙。该工具支持多用户与HMAC-SHA256身份验证,提供SOCKS5代理接口,具备IP白名单及简易安装功能,适用于网络流量隐蔽传输与防火墙规避场景。 综合评分: 85 文章分类: 安全工具,渗透测试,红队,内网渗透


cover_image

高速隐蔽隧道工具

原创

0xSecDebug 0xSecDebug

0xSecDebug

2026年1月20日 08:00 陕西

smtp-tunnel-proxy高速隐蔽隧道

一种高速隐蔽隧道,将TCP流量伪装成SMTP电子邮件通信,以绕过深度包检测(DPI)防火墙。

    请勿利用文章内的相关技术从事非法渗透测试,由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,作者不为此承担任何责任。工具和内容均来自网络,仅做学习和记录使用,安全性自测,如有侵权请联系删除


🎯 功能特性

| 功能 | 描述 | | — | — | | 🔒 TLS 加密 | STARTTLS 后所有流量使用 TLS 1.2+ 加密 | | 🎭 DPI 规避 | 初始握手模仿真实 SMTP 服务器(Postfix) | | ⚡ 高速传输 | 握手后使用二进制流式协议 – 最小开销 | | 👥 多用户支持 | 每用户独立密钥、IP 白名单和日志设置 | | 🔑 身份验证 | 每用户使用 HMAC-SHA256 预共享密钥 | | 🌐 SOCKS5 代理 | 标准代理接口 – 适用于任何应用程序 | | 📡 多路复用 | 单个隧道支持多个连接 | | 🛡️ IP 白名单 | 按用户通过 IP 地址/CIDR 进行访问控制 | | 📦 简易安装 | 一键安装服务器并配置 systemd 服务 | | 🎁 客户端包 | 为每个用户自动生成 ZIP 文件 | | 🔄 自动重连 | 客户端在连接断开时自动重连 |


⚡ 快速开始

📋 前置条件

  • 服务器:安装了 Python 3.8+ 的 Linux VPS,开放端口 587
  • 客户端:安装了 Python 3.8+ 的 Windows/macOS/Linux
  • 域名:TLS 证书验证所需(免费选项:DuckDNS、No-IP、FreeDNS)

🚀 服务器设置(VPS)

步骤 1️⃣:获取域名

获取一个指向您的 VPS 的免费域名:

  • 🦆 DuckDNS – 推荐,简单且免费
  • 🌐 No-IP – 提供免费套餐
  • 🆓 FreeDNS – 多种域名选项

示例:myserver.duckdns.org → 203.0.113.50(您的 VPS IP 地址)

步骤 2️⃣:运行安装程序

# 下载并执行安装脚本,使用 sudo 权限运行
curl -sSL https://raw.githubusercontent.com/purpose168/smtp-tunnel-proxy/main/install.sh | sudo bash

安装程序将:

  1. 📥 下载并安装所有必需组件
  2. ❓ 询问您的域名
  3. 🔐 自动生成 TLS 证书
  4. 👤 提示创建第一个用户
  5. 🔥 配置防火墙
  6. 🚀 启动服务

就这样! 您的服务器已准备就绪。

➕ 稍后添加更多用户

smtp-tunnel-adduser bob      # 添加用户并生成客户端 ZIP 包
smtp-tunnel-listusers        # 列出所有用户
smtp-tunnel-deluser bob      # 删除用户

🔄 更新服务器

smtp-tunnel-update           # 更新代码,保留配置/证书/用户

💻 客户端设置

选项 A:简单方式(推荐)

  1. 从服务器管理员处获取您的 username.zip 文件
  2. 解压 ZIP 文件
  3. 运行启动器:

| 平台 | 运行方式 | | — | — | | 🪟 Windows | 双击 start.bat | | 🐧 Linux | 运行 ./start.sh | | 🍎 macOS | 运行 ./start.sh |

启动器将自动安装依赖项并启动客户端。

✅ 您应该看到:

SMTP Tunnel Proxy Client
User: alice

[INFO] Starting SMTP Tunnel...
[INFO] SOCKS5 proxy will be available at 127.0.0.1:1080

Connecting to myserver.duckdns.org:587
Connected - binary mode active
SOCKS5 proxy on 127.0.0.1:1080

选项 B:手动方式

cd alice
pip install -r requirements.txt
python client.py

选项 C:自定义配置

# 下载文件
scp [email protected]:/etc/smtp-tunnel/ca.crt .

# 创建 config.yaml:
cat&nbsp;> config.yaml <<&nbsp;EOF
client:
&nbsp; server_host: "myserver.duckdns.org"
&nbsp; server_port: 587
&nbsp; socks_port: 1080
&nbsp; username: "alice"
&nbsp; secret: "your-secret-from-admin"
&nbsp; ca_cert: "ca.crt"
EOF

# 运行客户端
python client.py -c config.yaml

📖 使用方法

🌐 配置您的应用程序

将 SOCKS5 代理设置为:127.0.0.1:1080

🦊 Firefox

  1. 设置 → 网络设置 → 设置
  2. 手动代理配置
  3. SOCKS 主机:127.0.0.1,端口:1080
  4. 选择 SOCKS v5
  5. ✅ 勾选”使用 SOCKS v5 时代理 DNS”

🌐 Chrome

  1. 安装”Proxy SwitchyOmega”扩展程序
  2. 创建配置文件,设置 SOCKS5:127.0.0.1:1080

🪟 Windows(系统级)

设置 → 网络和 Internet → 代理 → 手动设置 → socks=127.0.0.1:1080

🍎 macOS(系统级)

系统偏好设置 → 网络 → 高级 → 代理 → SOCKS 代理 → 127.0.0.1:1080

🐧 Linux(系统级)

export&nbsp;ALL_PROXY=socks5://127.0.0.1:1080

💻 命令行

# curl
curl -x socks5h://127.0.0.1:1080 https://ifconfig.me

# git
git config --global http.proxy socks5://127.0.0.1:1080

# 环境变量
export&nbsp;ALL_PROXY=socks5://127.0.0.1:1080

✅ 测试连接

# 应该显示您的 VPS IP 地址
curl -x socks5://127.0.0.1:1080 https://ifconfig.me

⚙️ 配置参考

🖥️ 服务器选项(config.yaml

| 选项 | 描述 | 默认值 | | — | — | — | | host | 监听接口 | 0.0.0.0 | | port | 监听端口 | 587 | | hostname | SMTP 主机名(必须与证书匹配) | mail.example.com | | cert_file | TLS 证书路径 | /etc/smtp-tunnel/data/server.crt | | key_file | TLS 私钥路径 | /etc/smtp-tunnel/data/server.key | | users_file | 用户配置文件路径 | /etc/smtp-tunnel/config/users.yaml | | log_users | 全局日志设置 | true |

👥 用户选项(users.yaml

每个用户可以拥有独立的设置:

users:
&nbsp;&nbsp;alice:
&nbsp; &nbsp;&nbsp;secret:&nbsp;"auto-generated-secret"
&nbsp; &nbsp;&nbsp;# whitelist: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 可选:限制为特定 IP
&nbsp; &nbsp;&nbsp;# &nbsp; - "192.168.1.100"
&nbsp; &nbsp;&nbsp;# &nbsp; - "10.0.0.0/8" &nbsp; &nbsp; &nbsp; &nbsp;# 支持 CIDR 表示法
&nbsp; &nbsp;&nbsp;# logging: true &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 可选:禁用此用户的日志记录

&nbsp;&nbsp;bob:
&nbsp; &nbsp;&nbsp;secret:&nbsp;"another-secret"
&nbsp; &nbsp;&nbsp;whitelist:
&nbsp; &nbsp; &nbsp;&nbsp;-&nbsp;"203.0.113.50"# Bob 只能从此 IP 连接
&nbsp; &nbsp;&nbsp;logging:&nbsp;false# 不记录 Bob 的活动

| 选项 | 描述 | 默认值 | | — | — | — | | secret | 用户的身份验证密钥 | 必需 | | whitelist | 此用户的允许 IP(支持 CIDR) | 所有 IP | | logging | 为此用户启用活动日志记录 | true |

💻 客户端选项

| 选项 | 描述 | 默认值 | | — | — | — | | server_host | 服务器域名 | 必需 | | server_port | 服务器端口 | 587 | | socks_port | 本地 SOCKS5 端口 | 1080 | | socks_host | 本地 SOCKS5 接口 | 127.0.0.1 | | username | 您的用户名 | 必需 | | secret | 您的身份验证密钥 | 必需 | | ca_cert | 用于验证的 CA 证书 | 推荐 |


📋 服务管理

# 检查状态
sudo&nbsp;systemctl status smtp-tunnel

# 配置更改后重启
sudo&nbsp;systemctl restart smtp-tunnel

# 查看日志
sudo&nbsp;journalctl -u smtp-tunnel -n 100

# 卸载
sudo&nbsp;/opt/smtp-tunnel/uninstall.sh

🔧 命令行选项

🖥️ 服务器

python server.py [-c CONFIG] [-d]

&nbsp; -c, --config &nbsp; &nbsp;配置文件(默认:config.yaml)
&nbsp; -d, --debug &nbsp; &nbsp; 启用调试日志

💻 客户端

python client.py [-c CONFIG] [--server HOST] [--server-port PORT]
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[-p SOCKS_PORT] [-u USERNAME] [-s SECRET] [--ca-cert FILE] [-d]

&nbsp; -c, --config &nbsp; &nbsp; &nbsp;配置文件(默认:config.yaml)
&nbsp; --server &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;覆盖服务器域名
&nbsp; --server-port &nbsp; &nbsp; 覆盖服务器端口
&nbsp; -p, --socks-port &nbsp;覆盖本地 SOCKS 端口
&nbsp; -u, --username &nbsp; &nbsp;您的用户名
&nbsp; -s, --secret &nbsp; &nbsp; &nbsp;覆盖密钥
&nbsp; --ca-cert &nbsp; &nbsp; &nbsp; &nbsp; CA 证书路径
&nbsp; -d, --debug &nbsp; &nbsp; &nbsp; 启用调试日志

👥 用户管理

smtp-tunnel-adduser <username> [-u USERS_FILE] [-c CONFIG] [--no-zip]
&nbsp; &nbsp; 添加新用户并生成客户端包
&nbsp; &nbsp; -u, --users-file &nbsp;指定用户文件(默认:/etc/smtp-tunnel/config/users.yaml)
&nbsp; &nbsp; -c, --config &nbsp; &nbsp; &nbsp; 指定配置文件(默认:/etc/smtp-tunnel/config/config.yaml)
&nbsp; &nbsp; --no-zip &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 不生成客户端 ZIP 包

smtp-tunnel-deluser <username> [-u USERS_FILE] [-f]
&nbsp; &nbsp; 删除用户(使用 -f 跳过确认)
&nbsp; &nbsp; -u, --users-file &nbsp;指定用户文件(默认:/etc/smtp-tunnel/config/users.yaml)

smtp-tunnel-listusers [-u USERS_FILE] [-v]
&nbsp; &nbsp; 列出所有用户(使用 -v 显示详细信息)
&nbsp; &nbsp; -u, --users-file &nbsp;指定用户文件(默认:/etc/smtp-tunnel/config/users.yaml)

smtp-tunnel-update
&nbsp; &nbsp; 更新服务器到最新版本(保留配置/证书/用户)

📖 项目地址

https://github.com/purpose168/smtp-tunnel-proxy

💻 威胁情报推送群

  如果师傅们想要第一时间获取到最新的威胁情报,可以添加下面我创建的钉钉漏洞威胁情报群,便于师傅们可以及时获取最新的IOC

点分享

点收藏

点在看

点点赞


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:0xSecDebug 0xSecDebug 0xSecDebug《高速隐蔽隧道工具》

大寒|岁寒至深安暖相伴 网络安全文章

大寒|岁寒至深安暖相伴

文章总结: 本文是中国电信安全发布的大寒节气问候,旨在岁寒之时传递温暖与关怀。由于主体内容为图片,无实质性技术信息或安全动态,属于节日关怀类软文。 综合评分:
评论:0   参与:  0