
go-http-proxy-to-socks v1.15.6
وكيل MITM لواجهة الأوامر يقوم بتحويل SOCKS4/SOCKS5 إلى وكيل HTTP/HTTPS/HTTP2/HTTP3 مع إعادة توجيه TCP/UDP شفافة، وتزوير ARP/NDP/DNS، واعتراض حركة المرور، والتقاط الحزم. مكتوب بلغة Go نقية، بدون libpcap.
GoHPTS - وكيل شفاف HTTP(S) و TCP/UDP إلى وكيل SOCKS4/SOCKS5 (سلسلة) مكتوب بلغة Go

جدول المحتويات
- مقدمة
- الميزات
- التثبيت
- الاستخدام
- الوكيل الشفاف
- التقاط حركة المرور
- دعم HTTP2 و HTTP3
- دعم IPv4 و IPv6
- انتحال ARP
- انتحال NDP
- انتحال DNS
- التقاط الحزم
- مساحات أسماء الشبكة
- الخادم المختلط
- روابط
- المساهمة
- الترخيص
مقدمة
أداة GoHPTS CLI هي جسر بين عملاء HTTP وخادم وكيل SOCKS5 أو عدة خوادم (سلسلة). تستمع محليًا كوكيل HTTP، وتقبل طلبات HTTP القياسية
أو HTTPS (عبر CONNECT) وتُمرّر الاتصال عبر وكيل SOCKS5. مستوحاة من http-proxy-to-socks و Proxychains
حالة استخدام محتملة: تحتاج إلى الاتصال بواجهة API خارجية عبر Postman، لكن هذه الواجهة متاحة فقط من خادم بعيد معيّن. ستساعدك الأوامر التالية في تنفيذ هذه المهمة:
إنشاء خادم وكيل SOCKS5 عبر ssh:```shell
ssh -D 1080 -Nf
إنشاء اتصال HTTP إلى SOCKS5 باستخدام `gohpts````shell
gohpts -s :1080 -l :8080
حدد خادم http في إعدادات الوكيل في Postman
الميزات
-
وظيفة سلسلة الوكلاء
يدعم سلاسلstrictوdynamicوrandomوround_robinمن وكلاء SOCKS4/SOCKS5 -
الوكيل الشفاف
يدعم وضعيredirect(SO_ORIGINAL_DST) وtproxy(IP_TRANSPARENT) -
دعم IPv4 و IPv6
يعمل في أوضاعIPv4-onlyأوIPv6-onlyأوdual stack -
وكيل شفاف لـ TCP و UDP
يتعاملtproxyوtlocal(IP_TRANSPARENT) مع حركة TCP و UDP -
التقاط حركة المرور
يستطيع الوكيل تحليل ترويسات HTTP ومصافحة TLS ورسائل DNS والمزيد -
انتحال ARP
وكّل شبكات فرعية كاملة باستخدام أسلوب انتحال ARP -
انتحال NDP
وكّل اتصالات IPv6 باستخدام إعلانات الموجّه/الجار وحقن RDNSS. -
انتحال DNS
أعد توجيه العملاء إلى نطاقات عشوائية باستخدام التلاعب بسجلات DNS -
التقاط الحزم
التقط حركة المرور في ملفات txt/pcap/pcapng وحلّلها باستخدام Wireshark -
حماية من تسرب DNS
يحدث تحليل DNS على جانب خادم SOCKS5. -
دعم طريقة CONNECT
يدعم أنفاق HTTP CONNECT، مما يتيح HTTPS وبروتوكولات TCP الأخرى. -
دعم HTTP2/HTTP3
يدعم نقل HTTP/2 و HTTP/3 الحديث، مما يتيح اتصالات متعددة الإرسال فعالة عبر TLS 1.3 -
دعم فضاءات أسماء الشبكة
يدعم فضاءات أسماء شبكة Linux المخصصة لمقابس الاستماع والاتصالات الصادرة -
دعم ترويسات Trailer
يتعامل مع ترويسات HTTP trailer -
ترميز النقل المجزأ
يتعامل مع الاستجابات المجزأة والمتدفقة -
دعم مصادقة SOCKS5
يدعم مصادقة اسم المستخدم/كلمة المرور لوكلاء SOCKS5. -
دعم مصادقة HTTP
يدعم مصادقة اسم المستخدم/كلمة المرور لخادم وكيل HTTP. -
خفيف وسريع
مصمم بأقل قدر من الحمل ومعالجة فعالة للطلبات. -
متعدد المنصات
متوافق مع جميع أنظمة التشغيل الرئيسية.
التثبيت
- Arch Linux/CachyOS/EndeavourOS ```shell
yay -S gohpts
أو باستخدام paru: ```shell
paru -S gohpts
- قم بتنزيل الملف التنفيذي الخاص بمنصتك من صفحة [Releases](https://github.com/shadowy-pycoder/go-http-proxy-to-socks/releases): ```shell
GOHPTS_RELEASE=v1.15.6; wget -v https://github.com/shadowy-pycoder/go-http-proxy-to-socks/releases/download/$GOHPTS_RELEASE/gohpts-$GOHPTS_RELEASE-linux-amd64.tar.gz -O gohpts && tar xvzf gohpts && mv -f gohpts-$GOHPTS_RELEASE-linux-amd64 gohpts && ./gohpts -h
- التثبيت باستخدام الأمر
go install(يتطلب Go 1.26 أو أحدث): ```shell CGO_ENABLED=0 go install -ldflags "-s -w" -trimpath github.com/shadowy-pycoder/go-http-proxy-to-socks/cmd/gohpts@latest
سيؤدي هذا إلى تثبيت الملف التنفيذي gohpts في دليل $GOPATH/bin الخاص بك.
- البناء من المصدر: ```shell
git clone https://github.com/shadowy-pycoder/go-http-proxy-to-socks.git
cd go-http-proxy-to-socks
make build
./bin/gohpts
- التشغيل في docker: ```shell
docker run -it --privileged --network host -v "$PWD/gohpts.yaml:/config.yaml" shadowypycoder/gohpts:latest -f config.yaml
الاستخدام
[رجوع]```shell gohpts -h
/ | | | | | __ _ / ____|
| | __ ___ | || | |) | | | | (__
| | |_ |/ _ | __ | / | | _
| |__| | () | | | | | | | ) |
_|_/|| ||| || |___/
GoHPTS: HTTP(S) Proxy to SOCKS4/SOCKS5 proxy by shadowy-pycoder GitHub: https://github.com/shadowy-pycoder/go-http-proxy-to-socks Codeberg: https://codeberg.org/shadowy-pycoder/go-http-proxy-to-socks
Usage: gohpts [OPTIONS] OPTIONS: General: -h Show this help message and exit -v Show version and build information -D Run as a daemon (provide -logfile to see logs) -I Display list of network interfaces and exit -f Path to proxy configuration file in YAML format
Proxy: -l Address of HTTP proxy server (Default: "127.0.0.1:8080" for IPv4, "[::1]:8080" for IPv6) -s Address of SOCKS proxy server (Default: "127.0.0.1:1080" for IPv4 "[::1]:1080" for IPv6) -c Path to certificate PEM encoded file -k Path to private key PEM encoded file -U User for HTTP proxy (basic auth). This flag invokes prompt for password (not echoed to terminal) -u User for SOCKS proxy authentication. This flag invokes prompt for password (not echoed to terminal) -i Bind proxy to specific network interface (either by interface name or index) -4 Force IPv4 stack for TCP and UDP (Default: dual stack) -6 Force IPv6 stack for TCP and UDP (Default: dual stack) -socks4 Use SOCKS4/SOCKS4a protocol for upstream proxy and mixed server (default: SOCKS5/SOCKS5h) -nohttp Disable HTTP proxy server -nosocks Disable SOCKS upstream proxy -dns Use custom DNS server (Example: "8.8.8.8" or "2001:4860:4860::8888") -mixed Accept SOCKS connections on HTTP proxy server address
Logs: -d Show logs in DEBUG mode -j Show logs in JSON format -logfile Log file path (Default: stdout) -nocolor Disable colored output for logs (no effect if -j flag specified) -pprof Address of pprof server with profiling data
Sniffing: -sniff Enable traffic sniffing for HTTP and TLS -snifflog Sniffed traffic log file path (Default: the same as -logfile) -body Collect request and response body for HTTP traffic (credentials, tokens, etc)
TProxy: -T Address of transparent proxy server -Tu Address of transparent UDP proxy server -M Transparent proxy mode: (redirect, tproxy, tlocal) -w Number of instances of transparent proxy server (Default: number of CPU cores) -wu Number of instances of transparent UDP proxy server (Default: number of CPU cores) -auto Automatically setup iptables and kernel parameters for transparent proxy (requires elevated privileges) -mark Set mark for each packet sent through transparent proxy (Default: redirect 0, tproxy 100, tlocal 100) -A Comma separated list of allowed ip addresses for proxying (Example: "8.8.8.8,2001:4860:4860::8888,192.168.1.0/24") -P Comma separated list of ports to ignore when proxying traffic (Example: "22,80,443,9092") -dump Dump iptables rules and other system settings generated by -auto flag
Spoofing: -arpspoof Enable ARP spoof proxy for selected targets (Example: "targets 10.0.0.1,10.0.0.5-10,192.168.1.*,192.168.10.0/24;fullduplex false;debug true;interval 10s") -ndpspoof Enable NDP spoof proxy for selected targets (Example: "ra true;na true;targets fe80::3a1c:7bff:fe22:91a4;fullduplex false;debug true;interval 10s")
Packet Capture: -pcap Enable packet capture (Example: "promisc true;expr ip proto tcp;snaplen 65535;timeout 10s;packet_count 100;packet_buffer 8192;exts txt,pcap,pcapng")
Namespaces: -in-netns Name or path of network namespace for inbound listeners (Default: default namespace) -out-netns Name or path of network namespace for outbound connections (Default: default namespace)
### التهيئة عبر أعلام سطر الأوامر
[[رجوع]](#table-of-contents)```shell
gohpts -s 1080 -l 8080 -d -j
الإخراج:```shell {"level":"info","time":"2025-05-28T06:15:18+00:00","message":"SOCKS5 Proxy: :1080"} {"level":"info","time":"2025-05-28T06:15:18+00:00","message":"HTTP Proxy: :8080"} {"level":"debug","time":"2025-05-28T06:15:22+00:00","message":"HTTP/1.1 - CONNECT - www.google.com:443"}
حدد اسم المستخدم وكلمة المرور لخادم وكيل SOCKS5:```shell
gohpts -s 1080 -l 8080 -d -j -u user
SOCKS5 Password: #you will be prompted for password input here
حدد اسم المستخدم وكلمة المرور لخادم وكيل HTTP:```shell gohpts -s 1080 -l 8080 -d -j -U user HTTP Password: #you will be prompted for password input here
عند وجود كل من `-u` و `-U`، سيُطلب منك الإدخال مرتين
تشغيل وكيل http عبر اتصال TLS```shell
gohpts -s 1080 -l 8080 -c "path/to/certificate" -k "path/to/private/key"
شغّل proxy كخدمة خلفية (logfile مطلوب لمخرجات التسجيل، وإلا لن ترى شيئًا)```shell gohpts -D -logfile /tmp/gohpts.log
## الاستخدام
python3 -m pip install -r requirements.txt python3 -m pip install .
### المساعدة
$ python3 -m pip install . $ python3 -m pip install -r requirements.txt $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install . $ python3 -m pip install```shell
output
gohpts pid:
## التثبيت
### المتطلبات الأساسية
- Python 3.8+
- pip
- Git
### التثبيت من المصدر
```bash
git clone https://github.com/example/tool.git
cd tool
pip install -r requirements.txt
التثبيت عبر pip
pip install tool
الاستخدام
الاستخدام الأساسي
python tool.py --target example.com
الخيارات المتقدمة
| الخيار | الوصف |
|---|---|
-t, --target | الهدف المراد فحصه |
-o, --output | ملف الإخراج |
-v, --verbose | تفعيل الوضع المطوّل |
-h, --help | عرض رسالة المساعدة |
أمثلة
فحص هدف واحد:
python tool.py -t example.com -v
حفظ النتائج في ملف:
python tool.py -t example.com -o results.txt
الإعداد
قم بإنشاء ملف إعدادات config.yaml:
target: example.com
timeout: 30
threads: 10
استكشاف الأخطاء وإصلاحها
المشكلات الشائعة
خطأ في الاستيراد:
تأكد من تثبيت جميع التبعيات:
pip install -r requirements.txt
انتهاء المهلة:
قم بزيادة قيمة المهلة في ملف الإعدادات.
المساهمة
نرحب بالمساهمات! يرجى اتباع الخطوات التالية:
- قم بعمل fork للمستودع
- أنشئ فرعاً للميزة (
git checkout -b feature/amazing-feature) - قم بعمل commit للتغييرات (
git commit -m 'Add amazing feature') - قم بالدفع إلى الفرع (
git push origin feature/amazing-feature) - افتح طلب سحب (Pull Request)
الترخيص
هذا المشروع مرخص بموجب رخصة MIT - راجع ملف LICENSE للحصول على التفاصيل.```shell
kill the process
kill #or kill $(pidof gohpts)
`-u` و `-U` لا يعملان في وضع daemon (وبالتالي المصادقة)، لكن يمكنك توفير ملف إعدادات (انظر أدناه)
### الإعداد عبر ملف YAML
[[رجوع]](#table-of-contents)
ملفات الإعدادات مفيدة عندما تريد إعداد الوكيل مسبقًا دون التعامل مع CLI كثيرًا أو تريد فقط ملفات تعريف متعددة لاحتياجات مختلفة.
تشغيل وكيل http في وضع سلسلة وكيل SOCKS5 (حدد إعدادات الخادم عبر ملف إعدادات YAML)```shell
gohpts -f "~/gohtps.yaml" -d -j
مثال التكوين:```yaml
bind proxy to specific network interface (either by interface name or index)
interface: "eth0" # if specified, overrides http server IP address disable_http: false # disable http proxy (default: false) disable_socks: false # disable upstream socks proxy (default: false)
if ipv4 and ipv6 are both false or both true, dual stack is assumed
ipv4: false # this must be enabled for arpspoof (default: false) ipv6: false # this must be enabled for ndpspoof (default: false) socks4: false # use SOCKS4/SOCKS4a protocol (tcp only protocol, no udp tproxy or http3 possible) (default: false) dns: 8.8.8.8 # custom DNS server (used in direct dialer, namespaces, spoofing)
http_server: address: 127.0.0.1:8080
username and password for adding basic authentication (comment out to disable auth)
username: username password: password
list of socks5 proxy
if proxy_chain is disabled, uses first server in a list as upstream
proxy_list:
- address: 127.0.0.1:1080
- address: 127.0.0.1:1081
- address: :1082 # empty host means localhost
proxy_chain: enabled: false
Explanations for chains taken from /etc/proxychains4.conf
strict - Each connection will be done via chained proxies
all proxies chained in the order as they appear in the list
all proxies must be online to play in chain
dynamic - Each connection will be done via chained proxies
all proxies chained in the order as they appear in the list
at least one proxy must be online to play in chain
(dead proxies are skipped)
random - Each connection will be done via random proxy
(or proxy chain, see chain_len) from the list.
this option is good to test your IDS :)
round_robin - Each connection will be done via chained proxies
of chain_len length
all proxies chained in the order as they appear in the list
at least one proxy must be online to play in chain
(dead proxies are skipped).
the start of the current proxy chain is the proxy after the last
proxy in the previously invoked proxy chain.
if the end of the proxy chain is reached while looking for proxies
start at the beginning again.
These semantics are not guaranteed in a multithreaded environment.
type: strict # dynamic, strict, random, round_robin length: 2 # maximum number of proxy in a chain (works only for random chain and round_robin chain)
logging: debug: true json: false
defaults to standard output
#logfile: /tmp/gohpts.log
use colored output in logs (no effect if json enabled)
nocolor: false
profiling data
pprof: 127.0.0.1:8081
يمكنك تجاوز أي إعدادات تقريبًا محددة في ملف التكوين من خلال توفير أعلام CLI المقابلة:```shell
gohpts -l :6969 -f "~/gohtps.yaml" -nocolor
يأخذ Proxy جميع الإعدادات المحددة في ~/gohpts.yaml لكنه يشغّل خادم http على 127.0.0.1:6969 بدلاً من 127.0.0.1:8080 كما يعطّل الإخراج الملوّن في السجلات.
بعض الإعدادات (مثل proxy_chain ومرشّحات dns) يمكن ضبطها فقط عبر الملف.
النسخة الكاملة من الإعدادات يمكن العثور عليها هنا: example_gohpts.yaml
لمعرفة المزيد عن proxy chains قم بزيارة Proxychains Github
Transparent proxy
يُعرف أيضاً باسم
intercepting proxyأوinline proxyأوforced proxy، حيث يعترض transparent proxy اتصالات طبقة التطبيقات العادية دون الحاجة إلى أي إعداد خاص للعميل. لا يحتاج العملاء إلى إدراك وجود الـ proxy. عادةً ما يقع transparent proxy بين العميل والإنترنت، حيث يؤدي الـ proxy بعض وظائف البوابة أو الموجّه-- من Wiki
هذه الوظيفة متاحة فقط على أنظمة Linux و Android (arm64) وتتطلب إعداداً إضافياً (iptables، ip route، إلخ)
تحدد علامة -T address عنوان خادم transparent proxy
هناك ثلاثة أوضاع redirect و tproxy و tlocal (مثل tproxy لكنه يعترض أيضاً حركة المرور المحلية) يمكن تحديدها باستخدام علامة -M
redirect (عبر NAT و SO_ORIGINAL_DST)
في هذا الوضع يحدث التمرير عبر proxy باستخدام جدول nat في iptables وهدف REDIRECT. يتغيّر مضيف الحزمة الواردة إلى عنوان redirect transparent proxy قيد التشغيل، لكنه يحتوي أيضاً على الوجهة الأصلية التي يمكن استرجاعها باستخدام getsockopt(SO_ORIGINAL_DST)
لتشغيل GoHPTS في هذا الوضع تستخدم علامة -T مع -M redirect
مثال
[Back]```shell
run the proxy
gohpts -s 1080 -T 1090 -M redirect -d
## التثبيت
### المتطلبات الأساسية
- Python 3.8 أو أحدث
- pip (مدير حزم Python)
- Git (اختياري، للاستنساخ)
### التثبيت السريع
```bash
# استنساخ المستودع
git clone https://github.com/yourusername/kitploit-tool.git
cd kitploit-tool
# إنشاء بيئة افتراضية
python3 -m venv venv
source venv/bin/activate # على Windows: venv\Scripts\activate
# تثبيت التبعيات
pip install -r requirements.txt
# تثبيت الأداة
pip install -e .
التثبيت عبر pip
pip install kitploit-tool
التثبيت عبر Docker
# بناء صورة Docker
docker build -t kitploit-tool .
# تشغيل الحاوية
docker run -it --rm kitploit-tool --help
التحقق من التثبيت
# التحقق من الإصدار
kitploit-tool --version
# عرض المساعدة
kitploit-tool --help
الاستخدام
الاستخدام الأساسي
# تشغيل الفحص الأساسي
kitploit-tool scan --target example.com
# تشغيل الفحص مع خيارات متقدمة
kitploit-tool scan --target example.com --deep --output results.json
الخيارات المتاحة
| الخيار | الوصف | القيمة الافتراضية |
|---|---|---|
--target | الهدف المراد فحصه | مطلوب |
--deep | تفعيل الفحص العميق | false |
--output | ملف الإخراج | stdout |
--format | صيغة الإخراج | json |
--threads | عدد الخيوط | 10 |
--timeout | مهلة الاتصال (بالثواني) | 30 |
--verbose | وضع الإخراج المفصل | false |
أمثلة الاستخدام
فحص موقع ويب
kitploit-tool scan --target https://example.com --deep
فحص نطاق كامل
kitploit-tool scan --target example.com --subdomains --output results.json
استخدام ملف التكوين
kitploit-tool scan --config config.yaml
ملف التكوين
# config.yaml
target: example.com
deep_scan: true
threads: 20
timeout: 60
output:
format: json
file: results.json
modules:
- port_scanner
- vulnerability_checker
- web_crawler
``````shell
# run socks5 server on 127.0.0.1:1080
ssh remote -D 1080 -Nf
قم بإعداد نظام التشغيل الخاص بك:```shell
commands below require elevated privileges (you can run it with sudo -i)
#enable ip forwarding sysctl -w net.ipv4.ip_forward=1
create GOHPTS nat chain
iptables -t nat -N GOHPTS
set no redirection rules for local, http proxy, ssh and redirect proxy itself
iptables -t nat -A GOHPTS -d 127.0.0.0/8 -j RETURN iptables -t nat -A GOHPTS -p tcp --dport 8080 -j RETURN iptables -t nat -A GOHPTS -p tcp --dport 1090 -j RETURN iptables -t nat -A GOHPTS -p tcp --dport 22 -j RETURN
redirect traffic to transparent proxy
iptables -t nat -A GOHPTS -p tcp -j REDIRECT --to-ports 1090
setup prerouting by adding our proxy
iptables -t nat -A PREROUTING -p tcp -j GOHPTS
intercept local traffic for testing
iptables -t nat -A OUTPUT -p tcp -j GOHPTS
اختبار الاتصال:```shell
#traffic should be redirected via 127.0.0.1:1090
curl http://example.com
التثبيت
المتطلبات الأساسية
- Python 3.8+
- pip (مدير حزم Python)
- Git (اختياري، للاستنساخ)
التثبيت من المصدر
# استنساخ المستودع
git clone https://github.com/example/tool.git
cd tool
# إنشاء بيئة افتراضية
python3 -m venv venv
source venv/bin/activate # على Windows: venv\Scripts\activate
# تثبيت التبعيات
pip install -r requirements.txt
# تثبيت الأداة
pip install -e .
التثبيت عبر pip
pip install tool-name
Docker
docker pull example/tool:latest
docker run -it --rm example/tool --help
الاستخدام
الاستخدام الأساسي
# عرض المساعدة
tool --help
# تشغيل فحص أساسي
tool scan --target example.com
# تشغيل فحص مع خيارات مخصصة
tool scan --target example.com --output results.json --verbose
أمثلة متقدمة
# فحص عدة أهداف
tool scan --targets targets.txt --threads 10
# استخدام ملف التكوين
tool scan --config config.yaml
# تصدير النتائج بتنسيقات مختلفة
tool scan --target example.com --format json --output results.json
tool scan --target example.com --format csv --output results.csv
التكوين
يمكن تكوين الأداة باستخدام ملف config.yaml:
target:
timeout: 30
retries: 3
output:
format: json
verbose: false
scan:
threads: 5
modules:
- port_scan
- service_detection
- vulnerability_check
الخيارات
| الخيار | الوصف |
|---|---|
--target | الهدف المراد فحصه (نطاق أو عنوان IP) |
--targets | ملف يحتوي على قائمة الأهداف |
--output | ملف الإخراج |
--format | تنسيق الإخراج (json, csv, xml) |
--threads | عدد الخيوط |
--timeout | مهلة الاتصال بالثواني |
--verbose | تمكين الإخراج المفصل |
--config | ملف التكوين |
المساهمة
نرحب بالمساهمات! يرجى اتباع الخطوات التالية:
- قم بعمل fork للمستودع
- أنشئ فرعًا للميزة (
git checkout -b feature/amazing-feature) - قم بعمل commit للتغييرات (
git commit -m 'Add amazing feature') - ادفع إلى الفرع (
git push origin feature/amazing-feature) - افتح طلب سحب (Pull Request)
الترخيص
هذا المشروع مرخص بموجب رخصة MIT - راجع ملف LICENSE للحصول على التفاصيل.
إخلاء المسؤولية
هذه الأداة مخصصة لأغراض الاختبار الأمني المصرح به فقط. يجب عليك الحصول على إذن كتابي صريح قبل اختبار أي نظام لا تملكه. قد يكون الاستخدام غير المصرح به غير قانوني.```shell #traffic should be redirected via 127.0.0.1:8080 curl --proxy http://127.0.0.1:8080 http://example.com
التراجع عن كل شيء:```shell
sysctl -w net.ipv4.ip_forward=0
iptables -t nat -D PREROUTING -p tcp -j GOHPTS
iptables -t nat -D OUTPUT -p tcp -j GOHPTS
iptables -t nat -F GOHPTS
iptables -t nat -X GOHPTS
التكوين التلقائي لوضع redirect
لتكوين نظامك تلقائيًا، شغّل الأمر التالي:```shell sudo env PATH=$PATH gohpts -d -T 8888 -M redirect -auto
يرجى ملاحظة أن الإعداد التلقائي يتطلب `sudo` وهو عام جدًا، وقد لا يكون مناسبًا لاحتياجاتك.
يمكنك اختياريًا تحديد `-mark <value>` لمنع حلقات الوكيل المحتملة```shell
sudo env PATH=$PATH gohpts -d -T 8888 -M redirect -auto -mark 100
tproxy (عبر MANGLE و IP_TRANSPARENT)
في هذا الوضع يحدث التمرير عبر جدول mangle في iptables وهدف TPROXY. يرى الوسيط الشفاف عنوان الوجهة كما هو، ولا يقوم النواة بإعادة كتابته. ولكي يعمل هذا، يرتبط الوسيط بخيار المقبس IP_TRANSPARENT، ويعترض iptables حركة المرور باستخدام هدف TPROXY، وتخبر قواعد التوجيه الحزم المعلَّمة بالذهاب إلى الوسيط المحلي دون تغيير وجهتها الأصلية.
يتطلب هذا الوضع صلاحيات مرتفعة لتشغيل GoHPTS. يمكنك القيام بذلك عن طريق تشغيل الأمر التالي:```shell
sudo setcap 'cap_net_admin+ep' ~/go/bin/gohpts
لتشغيل `GoHPTS` في هذا الوضع تستخدم علامة `-T` مع `-M tproxy`
### مثال
[[رجوع]](#table-of-contents)```shell
# run the proxy
gohpts -s 1080 -T 0.0.0.0:1090 -M tproxy -d
التثبيت
المتطلبات الأساسية
- Python 3.8 أو أحدث
- pip (مدير حزم Python)
- Git (اختياري، للاستنساخ)
التثبيت السريع
# استنساخ المستودع
git clone https://github.com/yourusername/yourtool.git
cd yourtool
# إنشاء بيئة افتراضية
python3 -m venv venv
source venv/bin/activate # على Windows: venv\Scripts\activate
# تثبيت التبعيات
pip install -r requirements.txt
# تثبيت الأداة
pip install -e .
التثبيت عبر pip
pip install yourtool
التثبيت عبر Docker
# بناء صورة Docker
docker build -t yourtool:latest .
# تشغيل الحاوية
docker run -it --rm yourtool:latest --help
التحقق من التثبيت
# التحقق من التثبيت
yourtool --version
# تشغيل الاختبارات
pytest tests/
الاستخدام
الاستخدام الأساسي
# عرض المساعدة
yourtool --help
# تشغيل الفحص الأساسي
yourtool scan --target example.com
# تشغيل الفحص مع خيارات متقدمة
yourtool scan --target example.com --output results.json --verbose
أمثلة الاستخدام
مثال 1: فحص منفذ واحد
yourtool scan --target 192.168.1.1 --port 80
مثال 2: فحص نطاق كامل
yourtool scan --target example.com --ports 1-1000 --threads 50
مثال 3: حفظ النتائج
yourtool scan --target example.com --output results.json --format json
خيارات سطر الأوامر
| الخيار | الوصف | القيمة الافتراضية |
|---|---|---|
--target | الهدف المراد فحصه | مطلوب |
--port | المنفذ أو نطاق المنافذ | 1-65535 |
--threads | عدد الخيوط | 10 |
--timeout | مهلة الاتصال بالثواني | 5 |
--output | ملف الإخراج | stdout |
--format | تنسيق الإخراج (json, csv, xml) | json |
--verbose | وضع الإخراج المفصل | false |
الإعداد
ملف الإعداد
يمكن تكوين الأداة باستخدام ملف config.yaml:
# config.yaml
target:
default_ports: "1-1000"
timeout: 5
threads: 10
output:
format: json
directory: ./results
logging:
level: INFO
file: yourtool.log
متغيرات البيئة
# تعيين متغيرات البيئة
export YOURTOOL_TARGET=example.com
export YOURTOOL_THREADS=20
export YOURTOOL_TIMEOUT=10
# تشغيل الأداة
yourtool scan
الميزات
- فحص سريع: فحص متعدد الخيوط لأداء عالٍ
- دعم بروتوكولات متعددة: HTTP، HTTPS، TCP، UDP
- تنسيقات إخراج متعددة: JSON، CSV، XML، HTML
- قابلية التوسع: بنية إضافات للوحدات المخصصة
- واجهة سهلة الاستخدام: واجهة سطر أوامر بديهية
- التوافق: يعمل على Linux و macOS و Windows
المساهمة
نرحب بالمساهمات! يرجى اتباع الخطوات التالية:
- قم بعمل fork للمستودع
- أنشئ فرعًا للميزة (
git checkout -b feature/AmazingFeature) - قم بعمل commit للتغييرات (
git commit -m 'Add some AmazingFeature') - ادفع إلى الفرع (
git push origin feature/AmazingFeature) - افتح طلب سحب (Pull Request)
إرشادات المساهمة
- اتبع معيار PEP 8 لأسلوب كود Python
- أضف اختبارات للميزات الجديدة
- قم بتحديث الوثائق حسب الحاجة
- تأكد من اجتياز جميع الاختبارات قبل الإرسال
الترخيص
هذا المشروع مرخص بموجب ترخيص MIT - راجع ملف LICENSE للحصول على التفاصيل.
شكر وتقدير
- شكر خاص لجميع المساهمين
- مستوحى من أدوات مماثلة في المجتمع
- شكر لمشروع Project Name
الدعم
- الوثائق: https://yourtool.readthedocs.io
- المشكلات: https://github.com/yourusername/yourtool/issues
- المناقشات: https://github.com/yourusername/yourtool/discussions
إخلاء المسؤولية
هذه الأداة مخصصة لأغراض الاختبار الأمني المصرح به فقط. يجب عليك الحصول على إذن كتابي صريح قبل استخدام هذه الأداة على أي نظام لا تملكه أو لا تملك إذنًا صريحًا لاختباره. قد يكون الاستخدام غير المصرح به غير قانوني. يخلي المؤلفون مسؤوليتهم عن أي سوء استخدام أو أضرار ناتجة عن هذه الأداة.```shell
run socks5 server on 127.0.0.1:1080
ssh remote -D 1080 -Nf
قم بإعداد نظام التشغيل الخاص بك:```shell
ip netns add ns-client
ip link add dev veth0 type veth peer name veth1 netns ns-client
ip addr add 10.0.0.1/24 dev veth0
ip link set dev veth0 up
ip netns exec ns-client ip addr add 10.0.0.2/24 dev veth1
ip netns exec ns-client ip link set dev lo up
ip netns exec ns-client ip link set dev veth1 up
ip netns exec ns-client ip route add default via 10.0.0.1
sysctl -w net.ipv4.ip_forward=1
iptables -t mangle -A PREROUTING -i veth0 -p tcp -j TPROXY --on-port 1090 --tproxy-mark 0x1/0x1
ip rule add fwmark 1 lookup 100
ip route add local 0.0.0.0/0 dev lo table 100
اختبار الاتصال:```shell ip netns exec ns-client curl http://1.1.1.1
التراجع عن كل شيء:```shell
sysctl -w net.ipv4.ip_forward=0
iptables -t mangle -F
ip rule del fwmark 1 lookup 100
ip route flush table 100
ip netns del ns-client
التكوين التلقائي لوضع tproxy
لتكوين نظامك تلقائيًا، شغّل الأمر التالي (على سبيل المثال، على جهاز افتراضي منفصل):```shell ssh remote -D 1080 -Nf sudo env PATH=$PATH gohpts -d -T 8888 -M tproxy -auto -mark 100
شغّل ما يلي على المضيف الخاص بك:```shell
ip route show default > /tmp/default-route.txt
ip route add 0.0.0.0/1 via 192.168.0.1 # change with ip of your VM
ip route add 128.0.0.0/1 via 192.168.0.1
اختبار الاتصال:```shell curl http://example.com #check logs on your VM
التراجع عن كل شيء:```shell
ip route del 0.0.0.0/1 via 192.168.0.1 2>/dev/null || true
ip route del 128.0.0.0/1 via 192.168.0.1 2>/dev/null || true
if [[ -f /tmp/default-route.txt ]]; then
eval $(awk '{print "ip route add "$0}' /tmp/default-route.txt)
rm -f /tmp/default-route.txt
else
echo "Something went wrong"
fi
دعم UDP
يدعم GoHPTS بروتوكول UDP ويمكن تمكينه في وضعي tproxy وtlocal. لكي يعمل هذا الإعداد، تحتاج إلى الاتصال بخادم socks5 قادر على خدمة اتصالات UDP (UDP ASSOCIATE). على سبيل المثال، يمكنك استخدام https://github.com/wzshiming/socks5 لنشر خادم socks5 يدعم UDP على جهاز بعيد أو محلي. بمجرد أن يصبح لديك الخادم للاتصال به، شغّل الأمر التالي:```shell
sudo env PATH=$PATH gohpts -s remote -Tu :8989 -M tproxy -auto -mark 100 -d
سيقوم هذا الأمر بتهيئة نظام التشغيل الخاص بك وإعداد الخادم على العنوان `0.0.0.0:8989`.
لاختباره محليًا، يمكنك دمج وكيل UDP الشفاف مع علامة `-arpspoof`. على سبيل المثال:
1. قم بإعداد جهاز افتراضي على نظامك باستخدام أي توزيعة Linux تدعم `tproxy` (مثل Kali Linux، على سبيل المثال).
2. قم بتمكين شبكة `bridged` حتى يتمكن الجهاز الافتراضي من الوصول إلى جهازك المضيف.
3. انقل ملف `gohpts` الثنائي إلى الجهاز الافتراضي (عبر `ssh`، على سبيل المثال) أو قم ببنائه هناك في حال اختلاف نظام التشغيل/المعمارية.
4. على جهازك الافتراضي، قم بتشغيل الأمر التالي:```shell
# Do not forget to replace <socks5 server> and <your host> with actual addresses
sudo ./gohpts -s <socks5 server> -T 8888 -Tu :8989 -M tproxy -sniff -body -auto -mark 100 -d -arpspoof "targets <your host>;fullduplex true;debug false"
- تحقق من الاتصال على جهازك المضيف، يجب أن يمرّ الترافيك عبر جهاز Kali.
دعم Android
يمكن تمكين البروكسي الشفاف على أجهزة Android (arm64) مع صلاحيات root. يمكنك تثبيت Termux وتشغيل GoHPTS كأداة CLI هناك:```shell
you need to root your device first
pkg install tsu iproute2
Android support added in v1.10.2
GOHPTS_RELEASE=v1.10.2; wget -v https://github.com/shadowy-pycoder/go-http-proxy-to-socks/releases/download/$GOHPTS_RELEASE/gohpts-$GOHPTS_RELEASE-android-arm64.tar.gz -O gohpts && tar xvzf gohpts && mv -f gohpts-$GOHPTS_RELEASE-android-arm64 gohpts && ./gohpts -h
use your phone as router for LAN devices redirecting their traffic to remote socks5 server
sudo ./gohpts -s remote -T 8888 -Tu :8989 -M tproxy -sniff -body -auto -mark 100 -d -arpspoof "fullduplex true;debug false"
### إعداد YAML
[[رجوع]](#table-of-contents)```yaml
transparent_proxy:
tcp:
enabled: true
address: 0.0.0.0:8888
# number of instances of transparent proxy server (Default: number of CPU cores)
workers: 1
udp:
enabled: true
address: 0.0.0.0:8889
# number of instances of transparent UDP proxy server (Default: number of CPU cores)
workers: 1
mode: "tproxy" # available modes are "redirect", "tproxy" and "tlocal" (udp requires tproxy or tlocal mode)
# automatically setup iptables and kernel parameters for transparent proxy (requires elevated privileges)
auto: true
# dump iptables rules and other system settings generated by auto setting
dump_rules: false
# list of ports to ignore when proxying traffic (Example: [22,80,443,9092])
ignored_ports: []
# set mark for each packet sent through transparent proxy (Default: redirect 0, tproxy 100, tlocal 100)
mark: 100
التقاط حركة المرور
يتيح وكيل GoHPTS للمستخدم التقاط ومراقبة حركة المرور التي تمر عبر الخدمة. تُعرف هذه العملية باسم traffic sniffing أو packet sniffing أو ببساطة sniffing. على وجه التحديد، يحاول الوكيل تحديد ما إذا كانت حركة المرور نصية عادية (HTTP) أو TLS، وبعد اكتمال التحديد، يقوم بتحليل البيانات الوصفية للطلب/الاستجابة وكتابتها إلى الملف أو وحدة التحكم. في حالة وكيل GoHTPS، تبدو البيانات الوصفية المُحلَّلة كما يلي (TLS Handshake):
صيغة JSON
[رجوع]```json [ { "connection": { "tproxy_mode": "redirect", "src_local": "127.0.0.1:8888", "src_remote": "192.168.0.107:51142", "dst_local": "127.0.0.1:56256", "dst_remote": "127.0.0.1:1080", "original_dst": "216.58.209.206:443" } }, { "tls_request": { "sni": "www.youtube.com", "type": "Client hello (1)", "version": "TLS 1.2 (0x0303)", "session_id": "2670a6779b4346e5e84d46890ad2aaf7a53b08adcfe0c9f6868c2d9882242e39", "cipher_suites": [ "TLS_AES_128_GCM_SHA256 (0x1301)", "TLS_CHACHA20_POLY1305_SHA256 (0x1303)", "TLS_AES_256_GCM_SHA384 (0x1302)", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)", "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9)", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8)", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)", "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)", "TLS_RSA_WITH_AES_128_GCM_SHA256 (0x9c)", "TLS_RSA_WITH_AES_256_GCM_SHA384 (0x9d)", "TLS_RSA_WITH_AES_128_CBC_SHA (0x2f)", "TLS_RSA_WITH_AES_256_CBC_SHA (0x35)" ], "extensions": [ "server_name (0)", "extended_master_secret (23)", "renegotiation_info (65281)", "supported_groups (10)", "ec_point_formats (11)", "session_ticket (35)", "application_layer_protocol_negotiation (16)", "status_request (5)", "delegated_credential (34)", "signed_certificate_timestamp (18)", "key_share (51)", "supported_versions (43)", "signature_algorithms (13)", "psk_key_exchange_modes (45)", "record_size_limit (28)", "compress_certificate (27)", "encrypted_client_hello (65037)" ], "alpn": ["h2", "http/1.1"] } }, { "tls_response": { "type": "Server hello (2)", "version": "TLS 1.2 (0x0303)", "session_id": "2670a6779b4346e5e84d46890ad2aaf7a53b08adcfe0c9f6868c2d9882242e39", "cipher_suite": "TLS_AES_128_GCM_SHA256 (0x1301)", "extensions": ["key_share (51)", "supported_versions (43)"], "supported_version": "TLS 1.3 (0x0304)" } } ]
وطلب HTTP باستخدام curl:```json
[
{
"connection": {
"tproxy_mode": "redirect",
"src_local": "127.0.0.1:8888",
"src_remote": "192.168.0.107:45736",
"dst_local": "127.0.0.1:37640",
"dst_remote": "127.0.0.1:1080",
"original_dst": "96.7.128.198:80"
}
},
{
"http_request": {
"host": "example.com",
"uri": "/",
"method": "GET",
"proto": "HTTP/1.1",
"header": {
"Accept": ["*/*"],
"My": ["Header"],
"User-Agent": ["curl/7.81.0"]
}
}
},
{
"http_response": {
"proto": "HTTP/1.1",
"status": "200 OK",
"content-length": 1256,
"header": {
"Cache-Control": ["max-age=2880"],
"Connection": ["keep-alive"],
"Content-Length": ["1256"],
"Content-Type": ["text/html"],
"Date": ["Tue, 17 Jun 2025 14:43:24 GMT"],
"Etag": ["\"84238dfc8092e5d9c0dac8ef93371a07:1736799080.121134\""],
"Last-Modified": ["Mon, 13 Jan 2025 20:11:20 GMT"]
}
}
}
]
الاستخدام بسيط كتحديد علامة -sniff إلى جانب العلامات العادية```shell
gohpts -d -T 8888 -M redirect -sniff -j
يمكنك أيضًا تحديد ملف لكتابة حركة المرور المُلتقطة فيه:```shell
gohpts -sniff -snifflog ~/sniff.log -j
تنسيق ملوّن
يمكنك رؤية مثال على المخرجات الملوّنة في الصورة أعلاه. في هذا الوضع، يحاول GoHPTS إبراز المعلومات المهمة مثل TLS Handshake وبيانات HTTP الوصفية، وأي شيء يشبه بيانات تسجيل الدخول/كلمات المرور أو أنواع مختلفة من المصادقة ورموز الأسرار. المخرجات محدودة مقارنةً بـ JSON لكنها أسهل بكثير في القراءة للبشر.
لتشغيل GoHPTS في هذا الوضع تستخدم الأعلام التالية:```shell
gohpts -sniff -body
يمكنك دمج التنصت مع الوضع الشفاف:```shell
./gohpts -T 8888 -M redirect -sniff -body
لتعطيل الألوان أضف -nocolor:```shell
gohpts -sniff -body -nocolor
## دعم HTTP2 و HTTP3
[[رجوع]](#table-of-contents)
يتعامل وكيل `GoHPTS` مع طلبات HTTP/1.1 و HTTP/2 و HTTP/3 باستخدام نفس عنوان الخادم وشهادة TLS. يتيح ذلك للعملاء اختيار أفضل بروتوكول متاح تلقائيًا دون تغيير الإعدادات. يمكن الحصول على شهادة TLS بعدة طرق: مزودو الخدمات السحابية (Google، AWS، Cloudflare)، أو شهادة مجانية من Let's Encrypt، أو يمكنك إنشاء شهادة موقعة ذاتيًا باستخدام `openssl` (Linux/macOS) أو `New-SelfSignedCertificate` (Windows).
### مثال على الإعداد باستخدام شهادة موقعة ذاتيًا
[[رجوع]](#table-of-contents)
- أنشئ ملفات `key.pem` و `cert.pem`: ```shell
openssl req -x509 -newkey rsa:2048 \
-keyout key.pem \
-out cert.pem \
-sha256 \
-days 365 \
-nodes \
-subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=127.0.0.1" \
-addext "subjectAltName=IP:127.0.0.1"
- جهّز خادم socks5 مع دعم UDP ASSOCIATE ```shell
git clone https://github.com/wzshiming/socks5.git && cd socks5
go build -o socks5_server ./cmd/socks5/main.go
./socks5_server -a 0.0.0.0:1080
- افتح طرفية أخرى وثبّت وكيل
GoHPTS: ```shell go install github.com/shadowy-pycoder/go-http-proxy-to-socks/cmd/gohpts@latest
يمكنك استخدام طرق أخرى موصوفة في قسم التثبيت.
-
أخيرًا:
- أنشئ إعدادًا أدنى للبروكسي الخاص بك ```yaml
gohpts_config.yaml
http_server: address: 127.0.0.1:8080 cert_file: ./cert.pem key_file: ./key.pem
proxy_list:
- address: 127.0.0.1:1080
logging: debug: true
sniffing: enabled: true body: true
شغّل الوكيل: ```shell gohpts -f ./gohpts_config.yaml
2. أو إذا كنت تفضل وسائط سطر الأوامر: ```shell
gohpts -l :8080 -s 1080 -c ./cert.pem -k ./key.pem -d -sniff -body
يجب أن ترى شيئًا كهذا: ```shell [15:20:32] INF SOCKS5 Proxy: 127.0.0.1:1080 [15:20:32] INF HTTPS Proxy: 127.0.0.1:8080 [15:20:32] INF HTTP3 Proxy (QUIC): 127.0.0.1:8080
### اختبار الاتصال
[[رجوع]](#table-of-contents)
- بالنسبة لخادم وكيل HTTP/2 يمكنك استخدام `curl`: ```shell
curl -Nvk --http2 --proxy-insecure --proxy-http2 --proxy https://localhost:8080 "https://stream.wikimedia.org/v2/stream/recentchange"
اضغط Ctrl+C لإيقاف تشغيل البث.
-
بالنسبة لـ HTTP/3 الأمر مختلف لأن (في وقت كتابة هذا)
curlلا يدعم وكيل HTTP3، لذا سأستخدم العميل المخصص الذي أنشأته لأغراض الاختبار.قم بتنزيل وتثبيت مثال Simple HTTP3 to SOCKS5 proxy: ```shell git clone https://github.com/shadowy-pycoder/http3-socks-proxy.git && cd http3-socks-proxy make
قم بتشغيل الأمر التالي: ```shell ./bin/client -a 127.0.0.1:8080 www.google.com
يجب أن ترى بعض الكلام غير المفهوم يشبه صفحة HTML.
انتقل إلى علامة تبويب الطرفية مع وكيل `GoHPTS` وتحقق من السجلات، يجب أن ترى جميع طلباتك هناك.
### اختبار الاتصال في المتصفح
[[رجوع]](#table-of-contents)
- أنشئ شهادة موقعة ذاتيًا مناسبة للمتصفح: ```shell
git clone https://github.com/shadowy-pycoder/go-http-proxy-to-socks.git
cd go-http-proxy-to-socks
cp ./resources/makecert.sh makecert.sh && chmod +x makecert.sh
./makecert.sh
يمكن العثور على مزيد من المعلومات هنا: Creating a browser trusted, self signed, SSL certificate
- أضف
rootCA.crtالذي تم إنشاؤه حديثًا إلى مخزن ثقة النظام:- Debian/Ubuntu: ```shell sudo cp rootCA.crt /usr/local/share/ca-certificates/rootCA.crt sudo update-ca-certificates
- Arch Linux/CachyOS/EndeavourOS: ```shell sudo trust anchor rootCA.crt
- شغّل الوكيل باستخدام `server.crt` و `server.key`: ```shell
gohpts -l :8080 -s 1080 -c ./server.crt -k ./server.key -d -sniff -body
- شغّل المتصفح وانتقل إلى أي موقع ويب: ```shell
chromium --proxy-server="https://127.0.0.1:8080"
دعم IPv4 و IPv6
من حيث التعامل مع طبقة الشبكة، يمكن لـ GoHPTS العمل في ثلاثة أوضاع: dual stack و IPv4-only و IPv6-only. يمكن للمستخدم التحكم في الوضع عن طريق تحديد علامتي -4 و -6. عند تعيين إحدى العلامتين، يبدأ الوكيل في الوضع المقابل، وعند وجود كلتا العلامتين أو حذفهما معًا، يُفترض وضع dual stack. يُرجى ملاحظة أنه في أوضاع "only"، يُسمح فقط بعناوين IP من إصدار محدد، وتُحل جميع النطاقات إلى إصدار IP محدد (إن أمكن)، وتتطلب جميع عناوين الاستماع استخدام نفس الإصدار، وما إلى ذلك.
لتمكين وضع IPv4-only ما عليك سوى إضافة علامة -4:```shell
sudo ./gohpts -sniff -body -d -4
لاختبار الوكيل في وضع IPv4 يمكنك استخدام أي جهاز Linux افتراضي:
1. على جهازك الافتراضي:```shell
# add your host machine as gateway for VM
export GATEWAY="<host IPv4 address>"
ip route add 0.0.0.0/1 via "$GATEWAY"
ip route add 128.0.0.0/1 via "$GATEWAY"
- على المضيف الخاص بك:```shell
run proxy on your host
sudo ./gohpts -T 8888 -Tu 8889 -M tproxy -sniff -body -auto -d -4
3. قم بزيارة أي موقع ويب على جهازك الافتراضي وشاهد حركة المرور في سجلات الوسيط
لتفعيل وضع `IPv6-only` ما عليك سوى إضافة العلامة `-6`، على سبيل المثال عند الاستخدام مع وسيط شفاف:```shell
sudo ./gohpts -T 8888 -M redirect -sniff -body -auto -mark 100 -d -6
لكي يعمل هذا، يجب أن يدعم مزود خدمة الإنترنت (ISP) ووكيل socks5 البعيد بروتوكول IPv6 بشكل نشط، يمكنك زيارة https://test-ipv6.com/ لمعرفة ما إذا كان بإمكانك الوصول إلى عناوين IPv6. لاختبار الوكيل في وضع IPv6 يمكنك استخدام أي جهاز Linux افتراضي:
- على جهازك الافتراضي:```shell
add your host machine as gateway IPv6 for VM
export GATEWAY6="" ip -6 route add ::/1 via "$GATEWAY6" dev eth0 ip -6 route add 8000::/1 via "$GATEWAY6" dev eth0
2. على المضيف الخاص بك:```shell
# run proxy on your host
sudo ./gohpts -T 8888 -Tu 8889 -M tproxy -sniff -body -auto -d -6
- قم بزيارة أي موقع ويب على جهازك الافتراضي وشاهد حركة المرور في سجلات الوكيل
انتحال ARP
يحتوي GoHPTS على أداة انتحال ARP مدمجة يمكن استخدامها لجعل جميع أجهزة LAN التي تتحدث TCP تستخدم خادم الوكيل للاتصال بالإنترنت.
يتم تحقيق ذلك عن طريق إضافة علامة -arpspoof مع بضعة معاملات، مفصولة بفاصلة منقوطة.
مثال:```shell ssh remote -D 1080 -Nf sudo env PATH=$PATH gohpts -d -T 8888 -M tproxy -sniff -body -auto -mark 100 -arpspoof "targets 192.168.10.0/24;fullduplex true;debug true"
سيقوم الوكيل بفحص الأجهزة في الشبكة الفرعية `192.168.10.0/24` وإرسال حزم ARP إليها للتنكر كبوابة، وإذا كانت `fullduplex` صحيحة،
سيرسل الوكيل حزم ARP إلى البوابة أيضًا ليجعلها تعتقد أن وكيلنا يمتلك كل عنوان IP في الشبكة الفرعية.
بعد إيقاف الوكيل باستخدام `Ctrl+C`، سيقوم تلقائيًا بإلغاء انتحال جميع الأهداف.
يمكن أيضًا استخدام `GoHPTS` مع أدوات مثل [Bettercap](https://github.com/bettercap/bettercap) لتمرير حركة المرور المنتحلة عبر ARP.
تشغيل الوكيل:```shell
ssh remote -D 1080 -Nf
sudo env PATH=$PATH gohpts -d -T 8888 -M tproxy -sniff -body -auto -mark 100
شغّل bettercap بهذا الأمر (انظر التوثيق):```shell
sudo bettercap -eval "net.probe on;net.recon on;set arp.spoof.fullduplex true;arp.spoof on"
تحقق من سجلات الوكيل بحثًا عن حركة المرور من أجهزة أخرى من شبكتك المحلية
لمزيد من المعلومات حول خيارات arpspoof راجع `gohpts -h` و [https://github.com/shadowy-pycoder/arpspoof](https://github.com/shadowy-pycoder/arpspoof)
## انتحال NDP
[[رجوع]](#table-of-contents)
يحتوي `GoHPTS` على وظيفة مدمجة لتنفيذ انتحال NDP في شبكات IPv6 باستخدام حزم إعلان الموجه (RA) وإعلان الجار (NA). كما يتضمن خيار RDNSS في حزم RA لوضع المضيف كخادم أسماء IPv6 للعملاء المتأثرين. عند دمجه مع وضع الوكيل الشفاف (TCP/UDP)، يسمح انتحال NDP لـ `gohpts` بوكالة حركة المرور للعملاء في الشبكات المحلية. كما هو الحال مع [انتحال ARP](#arp-spoofing)، يمكنك تعيين خيارات انتحال ndp باستخدام علامة `-ndpspoof` الواحدة:
مثال:```shell
sudo env PATH=$PATH gohpts -d -T 8888 -M tproxy -sniff -body -auto -mark 100 -ndpspoof "ra true;na true;targets fe80::3a1c:7bff:fe22:91a4;fullduplex false;debug true"
لمزيد من المعلومات حول خيارات ndpspoof راجع gohpts -h و https://github.com/shadowy-pycoder/ndpspoof
يرجى ملاحظة أن بعض الخيارات مثل rdnss و gateway و interface يتم تعيينها تلقائيًا بواسطة gohpts نفسه ليعمل بشكل صحيح كخادم وكيل.
نظرًا لأن gohpts يمرر جميع الاتصالات عبر خادم SOCKS5 العلوي، فأنت بحاجة إلى خادم يعمل بدعم IPv4/IPv6 و TCP/UDP. من الواضح أن الجهاز البعيد (مثل VPS) يجب أن يكون لديه اتصال IPv6 يعمل أيضًا. وغني عن القول، أن الجهاز الذي يعمل عليه gohpts يجب أن يكون جزءًا من شبكة تدعم IPv6.
مثال على الإعداد لكي يعمل انتحال NDP بشكل صحيح:
- الاتصال بـ VPS```shell ssh [email protected]
2. تثبيت التبعيات```shell
GO_VERSION=$(curl 'https://go.dev/VERSION?m=text' | head -n1)
cd ~/Downloads/ && wget https://go.dev/dl/$GO_VERSION.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf $GO_VERSION.linux-amd64.tar.gz
- إعداد خادم SOCKS5 (تأكد من أن قواعد جدار الحماية لا تحظر المنافذ المستخدمة)```shell git clone https://github.com/wzshiming/socks5.git && cd socks5 go build -o ./bin/socks5_server ./cmd/socks5/*.go ./bin/socks5_server -a :3000
4. عد إلى جهازك المضيف وقم بتثبيت `gohpts` (انظر [التثبيت](#installation))
5. شغّل `gohtps`:```shell
gohpts -s 203.0.113.10:3000 -T 8888 -Tu 8889 -M tproxy -sniff -body -auto -mark 100 -arpspoof "fullduplex true;debug true" -ndpspoof "ra true;debug true" -4 -6 -d
-
احصل على جهاز آخر (هاتف، جهاز لوحي، إلخ) وقم بتوصيله بنفس الشبكة. حاول الوصول إلى الإنترنت وتحقق مما إذا كانت بعض حركة المرور تظهر على جهازك المضيف. تحقق من عنوان IP العام باستخدام بعض الأدوات عبر الإنترنت (يجب أن يتطابق مع عنوان VPS الخاص بك
203.0.113.10في هذه الحالة أو عنوان IPv6 العام) -
أوقف الوكيل بالضغط على Ctrl+C
-
استمتع!
انتحال DNS
لفرض مرشحات DNS وانتحال الأهداف عن طريق تغيير سجلات DNS، يجب أن يصبح المضيف الذي يشغل GoHPTS البوابة الافتراضية لأجهزة LAN. لكي يعمل هذا، ما عليك سوى تشغيل الوكيل الشفاف مع تمكين udp وتشغيل انتحال ARP/NDP لجعل الأهداف تستخدم خادم DNS الخاص بك.
تبدو ردود DNS التي ينشئها GoHPTS كحزم عادية قادمة من الراوتر أو خوادم DNS الموثوقة (Google، Cloudflare)، مما يؤدي إلى قيام العملاء بتحديث ذاكرتهم المؤقتة بما تخبرهم به. ضع في اعتبارك، مع ذلك، أنه يعمل فقط مع حركة DNS "القياسية" غير المشفرة (DOT/DOH غير مفلترة أو منتحلة).
يمكن تكوين مرشحات DNS والنطاقات للانتحال في قسم dns_filter من ملف تكوين yaml. تقبل جميع القوائم عناوين URL ومسارات الملفات وإدخالات مشابهة لتلك الموجودة عادةً في ملف hosts، انظر https://en.wikipedia.org/wiki/Hosts_(file)>).
مثال:```yaml
dns filters require udp transparent proxy and arpspoof/ndpspoof
filters accept hosts like entries (use either links, file paths or just plain comma separated lists
dns_filter: enabled: true whitelist: ["/tmp/whitelisted_domains.txt", "example.com", "*.google.com"] # ip is optional, domains can start with *. to match all subdomains blacklist: ["https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"] blacklist_all: false # block all non whitelisted domains spooflist: ["127.0.0.1 example.com"] # ip address is required here
حالات الاستخدام:
- مانع الإعلانات والمتتبعات لجميع أجهزة الشبكة المحلية
- الرقابة الأبوية عبر حظر فئات محددة من المواقع
- حظر نطاقات التصيّد والبرمجيات الخبيثة المعروفة
- إعادة توجيه حركة المرور لأغراض التحليل
- جمع بيانات الاعتماد عبر إعادة التوجيه
- اختطاف حركة المرور والتلاعب بها (حقن الإعلانات والسكربتات والتتبع)
- المراقبة وتحديد الملفات الشخصية
الإعداد الأدنى لهذه التهيئة:```yaml
# gohpts_dns_spoof.yaml
proxy_list:
- address: 127.0.0.1:1080 # point to socks5 server supporting TCP/UDP
sniffing:
enabled: true
body: true
transparent_proxy:
tcp:
enabled: true
address: 0.0.0.0:8888
udp:
enabled: true
address: 0.0.0.0:8889
mode: "tproxy"
auto: true
arpspoof:
enabled: true
settings: "fullduplex 1;debug 1;interval 1s"
dns_filter:
enabled: true
whitelist: []
blacklist: [
"https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts",
] # list of domains to filter
blacklist_all: true
# all requests for example.com will be redirected to 0.0.0.0 address
spooflist: ["0.0.0.0 example.com"]
تشغيل:```shell sudo ./gohpts -f ./gohpts_dns_spoof.yaml
يمكن العثور على مزيد من المعلومات هنا: [https://en.wikipedia.org/wiki/DNS_spoofing](https://en.wikipedia.org/wiki/DNS_spoofing)
## التقاط الحزم
[[رجوع]](#table-of-contents)
يمكن التقاط حركة المرور بتنسيقات pcap أو pcapng أو txt المخصصة وتحليلها لاحقًا باستخدام أدوات مثل Wireshark وtcpdump وغيرها الكثير.
أولاً، تأكد من أن الملف التنفيذي `GoHPTS` يمتلك صلاحيات مرتفعة لتتمكن من التقاط الحزم الخام، لديك خياران:
- شغّل `sudo setcap cap_net_raw+ep ~/go/bin/gohpts` مرة واحدة لمنح الوكيل صلاحية الوصول إلى حركة المرور الخام
- شغّل الوكيل باستخدام `sudo` عندما تحتاج إلى تحديد علامة `-pcap` في CLI أو `pcap.enabled` في إعدادات الملف.
قم بتهيئة الوكيل باستخدام CLI:```shell
gohpts -pcap "promisc true;timeout 10s;exts txt,pcap,pcapng"
ملف التكوين:```yaml pcap: enabled: true settings: "promisc true;expr ip proto tcp;snaplen 65535;timeout 10s;packet_count 100;packet_buffer 8192;exts txt,pcap,pcapng"
هذه الأوامر تنتج ثلاثة ملفات لالتقاط الحزم بالتنسيقات المقابلة التي يمكن تحليلها لاحقًا بواسطة أدوات متنوعة.
لمزيد من المعلومات حول خيارات pcap راجع `gohpts -h` و [https://github.com/shadowy-pycoder/mshark](https://github.com/shadowy-pycoder/mshark)
## Network Namespaces
[[Back]](#table-of-contents)
بشكل افتراضي، يعمل وكيل `GoHPTS` داخل مساحة شبكة واحدة، ولكن يمكن تجاوز ذلك. يمكن عزل مآخذ الاستماع (مثل خادم http أو خادم الوكيل الشفاف) والمآخذ الصادرة (وكيل socks أو الاتصال المباشر) التي ينشئها `GoHPTS` باستخدام [network_namespaces (7)](https://man7.org/linux/man-pages/man7/network_namespaces.7.html) في Linux/Android. عند بدء عملية الوكيل، يمكن للمستخدمين تحديد علامات `-in-netns` (للمستمعين) و `-out-netns` (للاتصالات) مع اسم أو مسار مساحة الشبكة للتحكم في البيئة المعزولة التي سيتم إنشاء المآخذ فيها. إذا كنت تريد إنشاء مستمعين أو اتصالات في مساحة الشبكة الحالية (الافتراضية)، فما عليك سوى حذف العلامة. لتحديد مساحة شبكة المضيف بشكل صريح، يمكنك استخدام المسار `/proc/1/ns/net` - وهذا يسمح للوكيل بتحديد خوادم الأسماء للنظام بشكل صحيح.
يدعم `GoHPTS` اصطلاح [ip-netns (8)](https://man7.org/linux/man-pages/man8/ip-netns.8.html) لتوفير تكوين الشبكة عبر الملفات الموجودة في الدليل `/etc/netns/NAME/`. لذا، لتحديد خوادم أسماء مخصصة لمساحة الشبكة `ns1`، قم بما يلي:```shell
sudo mkdir -p /etc/netns/ns1
sudo tee /etc/netns/ns1/resolv.conf << EOF
nameserver 8.8.8.8
nameserver 2001:4860:4860:0:0:0:0:8888
EOF
إذا لم يتم العثور على أي إعدادات، سيتم استخدام خوادم DNS الخاصة بـ Google لتحليل أسماء النطاقات.
إذا كان نظامك يحتوي على systemd-resolved.service (8) مُفعَّلاً، فقد ترغب في تعطيله مؤقتاً عند إجراء الاستعلامات عبر مساحات أسماء الشبكة المخصصة:```shell sudo ip netns exec ns1 unshare --mount bash -c ' mount --bind /dev/null /run/systemd/resolve/io.systemd.Resolve curl -Nvk https://example.com'
أو اجعله دائمًا لنسخة shell محددة:```shell
sudo ip netns exec ns1 unshare --mount bash -c '
mount --bind /dev/null /run/systemd/resolve/io.systemd.Resolve
exec bash --login'
إعداد بيئة التجربة
- تشغيل خادم socks5 مع دعم UDP ASSOCIATE ```shell
git clone https://github.com/wzshiming/socks5.git && cd socks5
go build -o socks5_server ./cmd/socks5/main.go
./socks5_server -a 0.0.0.0:1080
- قم بتنزيل وتثبيت مثال وكيل HTTP3 إلى SOCKS5 البسيط: ```shell
git clone https://github.com/shadowy-pycoder/http3-socks-proxy.git
cd http3-socks-proxy
make
- استنسخ المستودع وقم بالترجمة ```shell
git clone https://github.com/shadowy-pycoder/go-http-proxy-to-socks.git
cd go-http-proxy-to-socks
make
- أنشئ ملفات
key.pemوcert.pem: ```shell openssl req -x509 -newkey rsa:2048
-keyout key.pem
-out cert.pem
-sha256
-days 365
-nodes
-subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=127.0.0.1"
-addext "subjectAltName=IP:127.0.0.1" - أنشئ مساحة اسم شبكة
ns1وقم بتكوين شبكة veth ```shell sudo ip netns add ns1 sudo ip link add dev veth0 type veth peer name veth1 netns ns1 sudo ip addr add 10.0.0.1/24 dev veth0 sudo ip -6 addr add fd12:3456:789a::1/64 dev veth0 sudo ip link set dev veth0 up sudo ip netns exec ns1 ip addr add 10.0.0.2/24 dev veth1 sudo ip netns exec ns1 ip -6 addr add fd12:3456:789a::2/64 dev veth1 sudo ip netns exec ns1 ip link set dev lo up sudo ip netns exec ns1 ip link set dev veth1 up - حدد عنوان IP الخاص بـ
wlan0لتتمكن من الاتصال بـ socks5 المحلي ```shell WLAN_IP=$(ip -4 -c=never route get 8.8.8.8 | awk '{print $7}' | tr -d '\n')
أمثلة الاستخدام
-
وكيل HTTP - مستمعو الوكيل في
ns1(لا يوجد مسار افتراضي، لا يوجد وصول إلى الإنترنت)، مآخذ الصادر على المضيفتشغيل الوكيل: ```shell sudo ./bin/gohpts -s 0.0.0.0:1080 -l :8083 -4 -6 -d -sniff -body -in-netns ns1
تقديم الطلب عبر ns1 ```shell
sudo ip netns exec ns1 curl -Nv --proxy http://127.0.0.1:8083 https://example.com
يجب أن ينجح الطلب
2. **وكيل HTTP2 - مستمعو الوكيل في `ns1` (لا يوجد مسار افتراضي، لا يوجد وصول إلى الإنترنت)، مآخذ التوصيل الصادرة على المضيف**
تشغيل الوكيل: ```shell
sudo ./bin/gohpts -s 0.0.0.0:1080 -l :8083 -4 -6 -d -sniff -body -in-netns ns1 -c ./cert.pem -k ./key.pem
قم بإجراء الطلب عبر ns1 ```shell
sudo ip netns exec ns1 curl -Nvk --http2 --proxy-insecure --proxy-http2 --proxy https://127.0.0.1:8083 https://example.com
يجب أن ينجح الطلب
3. **وكيل HTTP3 - مستمعو الوكيل في `ns1` (لا يوجد مسار افتراضي، لا يوجد وصول إلى الإنترنت)، مآخذ التوصيل الصادرة على المضيف**
تشغيل الوكيل: ```shell
sudo ./bin/gohpts -s 0.0.0.0:1080 -l :8083 -4 -6 -d -sniff -body -in-netns ns1 -c ./cert.pem -k ./key.pem
قم بإجراء الطلب عبر ns1 ```shell
sudo ip netns exec ns1 ./http3-socks-proxy/bin/client -a 127.0.0.1:8083 www.google.com
يجب أن ينجح الطلب
4. **وكيل إعادة التوجيه الشفاف (`-M redirect`) - مستمعو الوكيل في `ns1` (المسار الافتراضي، بدون وصول إلى الإنترنت)، مآخذ الاتصال الصادرة على المضيف**
تشغيل الوكيل: ```shell
sudo ./bin/gohpts -s 0.0.0.0:1080 -l :8083 -4 -6 -d -sniff -body -in-netns ns1 -nohttp -M redirect -T :8888 -auto
قم بإجراء الطلب عبر ns1 ```shell
sudo ip netns exec ns1 curl -Nv https://example.com
يجب أن يفشل الطلب
أضف مسارًا افتراضيًا إلى `ns1` ```shell
sudo ip netns exec ns1 ip route add default via 10.0.0.1
sudo ip netns exec ns1 ip -6 route add default via fd12:3456:789a::1
حاول مرة أخرى ```shell sudo ip netns exec ns1 curl -Nv https://example.com
يجب أن ينجح الطلب الآن
5. **وكيل HTTP - مستمعو الوكيل على المضيف، مآخذ الاتصال الصادرة في `ns1` (المسار الافتراضي، الوصول إلى الإنترنت)**
أضف قواعد NAT للسماح لـ `ns1` بالاتصال بالإنترنت عبر `wlan0` ```shell
sudo iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o wlan0 -j MASQUERADE
sudo ip6tables -t nat -A POSTROUTING -s fd12:3456:789a::/64 -o wlan0 -j MASQUERADE
تشغيل proxy: ``` sudo ./bin/gohpts -s :1080 -l :8083 -4 -6 -d -sniff -body -out-netns ns1 -i wlan0
تقديم الطلب عبر المضيف ```shell
curl -Nv --proxy http://$WLAN_IP:8083 https://example.com
يجب أن ينجح الطلب
-
وكيل HTTP3 - مستمعو الوكيل على المضيف، مآخذ الاتصال الصادرة في
ns1(المسار الافتراضي، الوصول إلى الإنترنت)تشغيل الوكيل: ``` sudo ./bin/gohpts -s :1080 -l :8083 -4 -6 -d -sniff -body -out-netns ns1 -i wlan0 -c ./cert.pem -k ./key.pem
تقديم الطلب عبر المضيف ```shell ./http3-socks-proxy/bin/client -a $WLAN_IP:8083 www.google.com
يجب أن ينجح الطلب
7. **وكيل شفاف لإعادة التوجيه - مستمعو الوكيل على المضيف، ومآخذ الاتصال الصادرة في `ns1` (المسار الافتراضي، الوصول إلى الإنترنت)**
تشغيل الوكيل (`-auto` لا يعمل مع خادم socks5 المحلي بالنسبة لي، لذا أستخدم خادمًا بعيدًا): ```
sudo ./bin/gohpts -s <remote> -4 -6 -d -sniff -body -out-netns ns1 -nohttp -M redirect -T :8888 -auto
إجراء طلب عبر المضيف ```shell curl -Nv https://example.com
يجب أن ينجح الطلب
8. **وكيل HTTP - LAN (`ns2` (مستمعو الوكيل)، `ns3`، `ns4`)، مآخذ التوصيل الصادرة في `ns1` (المسار الافتراضي، الوصول إلى الإنترنت)**
إنشاء LAN ```shell
sudo ip link add br0 type bridge
sudo ip addr add 10.0.1.1/24 dev br0
sudo ip -6 addr add fd12:3456:789b::1/64 dev br0
sudo ip link set br0 up
sudo ip netns add ns2
sudo ip link add veth2 type veth peer name veth3 netns ns2
sudo ip link set veth2 master br0
sudo ip link set veth2 up
sudo ip netns exec ns2 ip addr add 10.0.1.2/24 dev veth3
sudo ip netns exec ns2 ip -6 addr add fd12:3456:789b::2/64 dev veth3
sudo ip netns exec ns2 ip link set lo up
sudo ip netns exec ns2 ip link set veth3 up
sudo ip netns exec ns2 ip route add default via 10.0.1.1
sudo ip netns exec ns2 ip -6 route add default via fd12:3456:789b::1
sudo ip netns add ns3
sudo ip link add veth4 type veth peer name veth5 netns ns3
sudo ip link set veth4 master br0
sudo ip link set veth4 up
sudo ip netns exec ns3 ip addr add 10.0.1.3/24 dev veth5
sudo ip netns exec ns3 ip -6 addr add fd12:3456:789b::3/64 dev veth5
sudo ip netns exec ns3 ip link set lo up
sudo ip netns exec ns3 ip link set veth5 up
sudo ip netns exec ns3 ip route add default via 10.0.1.1
sudo ip netns exec ns3 ip -6 route add default via fd12:3456:789b::1
sudo ip netns add ns4
sudo ip link add veth6 type veth peer name veth7 netns ns4
sudo ip link set veth6 master br0
sudo ip link set veth6 up
sudo ip netns exec ns4 ip addr add 10.0.1.4/24 dev veth7
sudo ip netns exec ns4 ip -6 addr add fd12:3456:789b::4/64 dev veth7
sudo ip netns exec ns4 ip link set lo up
sudo ip netns exec ns4 ip link set veth7 up
sudo ip netns exec ns4 ip route add default via 10.0.1.1
sudo ip netns exec ns4 ip -6 route add default via fd12:3456:789b::1
تشغيل proxy: ``` sudo ./bin/gohpts -s $WLAN_IP:1080 -l 0.0.0.0:8083 -4 -6 -d -sniff -body -in-netns ns2 -out-netns ns1
إجراء الطلبات ```shell
curl -Nv --proxy http://10.0.1.2:8083 http://example.com
sudo ip netns exec ns2 curl -Nv --proxy http://10.0.1.2:8083 https://example.com
sudo ip netns exec ns3 curl -Nv --proxy http://10.0.1.2:8083 https://example.com
sudo ip netns exec ns4 curl -Nv --proxy http://10.0.1.2:8083 https://example.com
يجب أن تنجح جميع الطلبات
-
وكيل HTTP3 - LAN (
ns2(مستمعو الوكيل)،ns3،ns4)، مآخذ التوصيل الصادرة فيns1(المسار الافتراضي، الوصول إلى الإنترنت)تشغيل الوكيل: ``` sudo ./bin/gohpts -s $WLAN_IP:1080 -l 0.0.0.0:8083 -4 -6 -d -sniff -body -in-netns ns2 -out-netns ns1 -c ./cert.pem -k ./key.pem
إجراء الطلبات ```shell ./http3-socks-proxy/bin/client -a 10.0.1.2:8083 www.google.com sudo ip netns exec ns2 ./http3-socks-proxy/bin/client -a 10.0.1.2:8083 www.google.com sudo ip netns exec ns3 ./http3-socks-proxy/bin/client -a 10.0.1.2:8083 www.google.com sudo ip netns exec ns4 ./http3-socks-proxy/bin/client -a 10.0.1.2:8083 www.google.com
يجب أن تنجح جميع الطلبات
10. **وكيل شفاف لإعادة التوجيه - LAN (`ns2` (مستمعو الوكيل)، `ns3`، `ns4`)، مآخذ صادرة في `ns1` (المسار الافتراضي، الوصول إلى الإنترنت)**
تشغيل الوكيل:
```shell
sudo ./bin/gohpts -s $WLAN_IP:1080 -4 -6 -d -sniff -body -in-netns ns2 -out-netns ns1 -nohttp -M redirect -T :8888 -auto
```
إجراء الطلبات
```shell
sudo ip netns exec ns2 curl -Nv https://example.com
```
بالنسبة لـ `ns3` و `ns4` يفشل الطلب
11. **وكيل شفاف مع `IP_TRANSPARENT` (تمكين انتحال arp/ndp) LAN (`ns2` (مستمعو الوكيل)، `ns3`، `ns4`)، مآخذ صادرة في `ns1` (المسار الافتراضي، الوصول إلى الإنترنت)**
تشغيل الوكيل:
```shell
sudo ./bin/gohpts -s $WLAN_IP:1080 -4 -6 -d -sniff -body -in-netns ns2 -out-netns ns1 -nohttp -M tproxy -T :8888 -auto -arpspoof "fullduplex 1;debug 1;interval 1s" -ndpspoof "ra true;interval 10s;debug 1"
```
الآن يجب أن تعمل الطلبات السابقة على `ns3` و `ns4`
```
sudo ip netns exec ns3 curl -Nv https://example.com
sudo ip netns exec ns4 curl -Nv https://example.com
```
12. **وكيل HTTP3 - مستمعو الوكيل في `ns1`، مآخذ صادرة على المضيف، علامة `-nosocks`**
تشغيل الوكيل:
```shell
sudo ./bin/gohpts -l 0.0.0.0:8083 -4 -6 -d -sniff -body -in-netns ns1 -c ./cert.pem -k ./key.pem -nosocks
```
إجراء الطلب
```shell
./http3-socks-proxy/bin/client -a 10.0.0.2:8083 www.google.com
```
يجب أن ينجح الطلب
13. **وكيل HTTP3 - مستمعو الوكيل على المضيف، مآخذ صادرة في `ns1`، علامة `-nosocks`**
تشغيل الوكيل:
```shell
sudo ./bin/gohpts -l 0.0.0.0:8083 -4 -6 -d -sniff -body -out-netns ns1 -c ./cert.pem -k ./key.pem -nosocks
```
إجراء الطلب
```shell
./http3-socks-proxy/bin/client -a 127.0.0.1:8083 www.google.com
```
يجب أن يفشل الطلب
إضافة قواعد إلى سلسلة `FORWARD`
```shell
sudo iptables -A FORWARD -i wlan0 -o veth0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i veth0 -o wlan0 -j ACCEPT
sudo ip6tables -A FORWARD -i veth0 -j ACCEPT
sudo ip6tables -A FORWARD -o veth0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
```
إجراء الطلب
```shell
./http3-socks-proxy/bin/client -a 127.0.0.1:8083 www.google.com
```
يجب أن ينجح الطلب
## خادم مختلط
[[رجوع]](#table-of-contents)
يمكن تكوين `GoHPTS` للاستماع لاتصالات SOCKS على نفس عنوان خادم HTTP، فقط أضف علامة `-mixed` لتشغيل خادم SOCKS إضافي. هذا يسمح لـ `GoHPTS` بالعمل ليس فقط كـ وكيل `HTTP-to-SOCKS` ولكن أيضًا كـ وكيل `SOCKS-to-SOCKS`. يدعم خادم SOCKS5 المحلي أمر `UDP ASSOCIATE`، لذا تقنيًا يمكن للمستخدمين إرسال مخططات بيانات UDP مع هذا الخادم المختلط.
تشغيل الوكيل:```shell
gohpts -s :1080 -l :8080 -mixed
اختبار الاتصال:```shell curl -Nv --proxy socks5://127.0.0.1:8080 "https://example.com"
أو قم بتعطيل وكيل SOCKS العلوي واتصل مباشرةً بإضافة `-nosocks`:```shell
gohpts -l :8080 -mixed -nosocks
اختبار الاتصال:```shell curl -Nv --proxy socks5://127.0.0.1:8080 "https://example.com"
أضف علامة `-socks4` لاستخدام بروتوكول SOCKS4 بدلاً من ذلك:```shell
# :1080 should be a socks4 server
gohpts -s :1080 -l :8080 -mixed -socks4
اختبار الاتصال:```shell curl -Nv --proxy socks4://127.0.0.1:8080 "https://example.com"
## الروابط
[[رجوع]](#table-of-contents)
تعرّف على المزيد حول الوكلاء الشفافين من خلال زيارة الروابط التالية:
- [دعم الوكيل الشفاف في نواة لينكس](https://docs.kernel.org/networking/tproxy.html)
- [درس الوكيل الشفاف من Gost](https://latest.gost.run/en/tutorials/redirect/)
- [مثال بسيط على tproxy](https://github.com/FarFetchd/simple_tproxy_example)
- [Golang TProxy](https://github.com/KatelynHaworth/go-tproxy)
- [تنفيذ الوكيل الشفاف باستخدام eBPF و Go](https://medium.com/all-things-ebpf/building-a-transparent-proxy-with-ebpf-50a012237e76)
- [https://github.com/heiher/hev-socks5-tproxy](https://github.com/heiher/hev-socks5-tproxy)
وكيل `socks5` مع دعم `UDP ASSOCIATE`:
- [https://github.com/wzshiming/socks5](https://github.com/wzshiming/socks5)
- [https://github.com/things-go/go-socks5](https://github.com/things-go/go-socks5)
- [https://github.com/0990/socks5](https://github.com/0990/socks5)
- [https://github.com/dizda/fast-socks5](https://github.com/dizda/fast-socks5)
- [https://github.com/semigodking/redsocks](https://github.com/semigodking/redsocks)
- [https://github.com/ginuerzh/gost](https://github.com/ginuerzh/gost)
أمن شبكات IPv4/IPv6:
- [https://caster0x00.com/legless/](https://caster0x00.com/legless/)
- [https://caster0x00.com/intercept/](https://caster0x00.com/intercept/)
- [https://www.prosec-networks.com/en/blog/ipv6-mitm/](https://www.prosec-networks.com/en/blog/ipv6-mitm/)
## المساهمة
[[رجوع]](#table-of-contents)
هل أنت مطوّر؟
- قم بعمل Fork للمستودع
- أنشئ فرع الميزة الخاص بك: `git switch -c my-new-feature`
- قم بعمل Commit لتغييراتك: `git commit -am 'Add some feature'`
- ادفع التغييرات إلى الفرع: `git push origin my-new-feature`
- قدّم طلب سحب (pull request)
## الترخيص
[[رجوع]](#table-of-contents)
GPLv3