simple-proxy 0.0.30__tar.gz → 0.0.32__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {simple_proxy-0.0.30/simple_proxy.egg-info → simple_proxy-0.0.32}/PKG-INFO +58 -31
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/README.md +56 -29
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/pyproject.toml +2 -2
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/__main__.py +2 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/handler/http_proxy_channel_handler.py +4 -1
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/run.py +9 -1
- {simple_proxy-0.0.30 → simple_proxy-0.0.32/simple_proxy.egg-info}/PKG-INFO +58 -31
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy.egg-info/requires.txt +1 -1
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/LICENSE +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/setup.cfg +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/__init__.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/clients.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/handler/__init__.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/handler/echo_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/handler/proxy_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/handler/shell_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/handler/socks5_proxy_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/utils/__init__.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/utils/certutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/utils/logutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/utils/netutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/utils/osutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/utils/proxyutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/utils/stringutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/utils/tlsutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/version.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy.egg-info/SOURCES.txt +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy.egg-info/dependency_links.txt +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy.egg-info/entry_points.txt +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy.egg-info/top_level.txt +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/handler/test_echo_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/handler/test_http_proxy_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/handler/test_proxy_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/handler/test_shell_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/handler/test_socks5_proxy_channel_handler.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/test_clients.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/test_run.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/utils/test_certutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/utils/test_logutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/utils/test_netutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/utils/test_osutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/utils/test_proxyutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/utils/test_stringutils.py +0 -0
- {simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/utils/test_tlsutils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simple_proxy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.32
|
|
4
4
|
Summary: A simple NIO proxy tool
|
|
5
5
|
Home-page: https://github.com/ruanhao/simple-proxy
|
|
6
6
|
Author-email: Hao Ruan <ruanhao1116@gmail.com>
|
|
@@ -26,7 +26,7 @@ Requires-Python: <4,>=3.7
|
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: click-option-group
|
|
29
|
-
Requires-Dist: py-netty>=1.0.
|
|
29
|
+
Requires-Dist: py-netty>=1.0.9
|
|
30
30
|
Requires-Dist: cryptography>=42.0.0
|
|
31
31
|
Requires-Dist: attrs>=22.1.0
|
|
32
32
|
Provides-Extra: dev
|
|
@@ -70,55 +70,77 @@ pip install simple-proxy -U
|
|
|
70
70
|
Usage: simple-proxy [OPTIONS]
|
|
71
71
|
|
|
72
72
|
Options:
|
|
73
|
-
Common configuration: Configuration for local/remote
|
|
74
|
-
|
|
75
|
-
-
|
|
73
|
+
Common configuration: Configuration for local/remote
|
|
74
|
+
endpoints
|
|
75
|
+
-l, --listening-host TEXT Listening server address
|
|
76
|
+
[default: localhost]
|
|
77
|
+
-lp, -p, --listening-port INTEGER
|
|
76
78
|
Listening port [default: 8080]
|
|
77
79
|
-g, --global Listening on all interfaces
|
|
78
80
|
-r, --remote-host TEXT Remote host [default: localhost]
|
|
79
81
|
-rp, --remote-port INTEGER Remote port [default: 80]
|
|
80
|
-
-s, --tls Denote remote is listening on
|
|
82
|
+
-s, --tls Denote remote is listening on
|
|
83
|
+
secure port
|
|
81
84
|
-ss Listening on secure port
|
|
82
85
|
TCP proxy configuration: Configuration for TCP proxy mode
|
|
83
86
|
--read-delay-millis INTEGER Read delay(ms) [default: 0]
|
|
84
87
|
--write-delay-millis INTEGER Write delay(ms) [default: 0]
|
|
85
88
|
-sni, --server-name-indication TEXT
|
|
86
|
-
Server Name Indication(SNI) for
|
|
89
|
+
Server Name Indication(SNI) for
|
|
90
|
+
TLS connection to remote server
|
|
87
91
|
Thread configuration: Configuration for thread
|
|
88
|
-
--workers INTEGER Number of worker threads
|
|
89
|
-
|
|
92
|
+
--workers INTEGER Number of worker threads
|
|
93
|
+
[default: 1]
|
|
94
|
+
--proxy-workers INTEGER Number of proxy threads [default:
|
|
95
|
+
1]
|
|
90
96
|
Traffic dump configuration: Configuration for traffic dump
|
|
91
97
|
-c, --tcp-flow Dump tcp flow on to console
|
|
92
98
|
-f, --save-tcp-flow Save tcp flow to file
|
|
93
|
-
TLS certificate configuration:
|
|
99
|
+
TLS certificate configuration:
|
|
94
100
|
Configuration for TLS certificate
|
|
95
101
|
-kf, --key-file PATH Key file for local server
|
|
96
102
|
-cf, --cert-file PATH Certificate file for local server
|
|
97
|
-
--alpn Set ALPN protocol as [h2,
|
|
98
|
-
|
|
103
|
+
--alpn Set ALPN protocol as [h2,
|
|
104
|
+
http/1.1]
|
|
105
|
+
Traffic monitor configuration:
|
|
99
106
|
Configuration for traffic monitor
|
|
100
|
-
-m, --monitor Print speed info to console for
|
|
107
|
+
-m, --monitor Print speed info to console for
|
|
108
|
+
established connection
|
|
101
109
|
-mi, --monitor-interval INTEGER
|
|
102
|
-
Speed monitor interval(seconds)
|
|
103
|
-
|
|
110
|
+
Speed monitor interval(seconds)
|
|
111
|
+
[default: 3]
|
|
112
|
+
TLS Disguise configuration: Configuration for protection
|
|
113
|
+
against unwanted inspection
|
|
104
114
|
-dti, --disguise-tls-ip TEXT Disguised upstream TLS IP
|
|
105
115
|
-dtp, --disguise-tls-port INTEGER
|
|
106
|
-
Disguised upstream TLS port
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
Disguised upstream TLS port
|
|
117
|
+
[default: 443]
|
|
118
|
+
--run-disguise-tls-server Run builtin disguise TLS server
|
|
119
|
+
without specifying external one
|
|
120
|
+
-wl, --white-list TEXT IP White list for legal incoming
|
|
121
|
+
TLS connections (comma separated)
|
|
122
|
+
Proxy configuration: Configuration for application
|
|
123
|
+
proxies
|
|
110
124
|
-e, --echo-proxy Run as Echo server
|
|
111
125
|
--shell-proxy Run as shell proxy server
|
|
112
126
|
--http-proxy Run as HTTP proxy server
|
|
113
127
|
--socks5-proxy Run as SOCKS5 proxy server
|
|
114
|
-
--proxy-username TEXT Proxy username for HTTP/SOCKS5
|
|
115
|
-
|
|
128
|
+
--proxy-username TEXT Proxy username for HTTP/SOCKS5
|
|
129
|
+
proxy
|
|
130
|
+
--proxy-password TEXT Proxy password for HTTP/SOCKS5
|
|
131
|
+
proxy
|
|
116
132
|
-t, --proxy-transform <TEXT INTEGER TEXT INTEGER>...
|
|
117
|
-
List of target
|
|
118
|
-
|
|
119
|
-
|
|
133
|
+
List of target
|
|
134
|
+
transformations(origin_host,
|
|
135
|
+
origin_port, transformed_host,
|
|
136
|
+
transformed_port) for HTTP/SOCKS5
|
|
137
|
+
proxy
|
|
138
|
+
Misc configuration:
|
|
120
139
|
-v, --verbose
|
|
121
140
|
--log-file PATH Log file
|
|
141
|
+
--internal-socks5-host TEXT [Internal] SOCKS5 proxy host
|
|
142
|
+
--internal-socks5-port INTEGER
|
|
143
|
+
[Internal] SOCKS5 proxy port
|
|
122
144
|
--version Show the version and exit.
|
|
123
145
|
-h, --help Show this message and exit.
|
|
124
146
|
```
|
|
@@ -127,7 +149,7 @@ Options:
|
|
|
127
149
|
## Features
|
|
128
150
|
### Basic proxy (TLS termination)
|
|
129
151
|
```commandline
|
|
130
|
-
> simple-proxy --tls -r www.google.com -rp 443 -
|
|
152
|
+
> simple-proxy --tls -r www.google.com -rp 443 -p 8080
|
|
131
153
|
Proxy server started listening: localhost:8080 => www.google.com:443(TLS) ...
|
|
132
154
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
133
155
|
> curl -I -H 'Host: www.google.com' http://localhost:8080
|
|
@@ -136,7 +158,7 @@ HTTP/1.1 200 OK
|
|
|
136
158
|
```
|
|
137
159
|
|
|
138
160
|
```commandline
|
|
139
|
-
> simple-proxy -r www.google.com -rp 80 -
|
|
161
|
+
> simple-proxy -r www.google.com -rp 80 -p 8443 -ss
|
|
140
162
|
Proxy server started listening: localhost:8443(TLS) => www.google.com:80 ...
|
|
141
163
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
142
164
|
> curl -I -H 'Host: www.google.com' -k https://localhost:8443
|
|
@@ -147,7 +169,7 @@ HTTP/1.1 200 OK
|
|
|
147
169
|
### Dump TCP flow
|
|
148
170
|
TCP flow can be dumped into console or files (under directory __tcpflow__)
|
|
149
171
|
```commandline
|
|
150
|
-
> simple-proxy -r www.google.com -rp 443 -
|
|
172
|
+
> simple-proxy -r www.google.com -rp 443 -p 8443 -ss -s -c -f
|
|
151
173
|
Proxy server started listening: localhost:8443(TLS) => www.google.com:443(TLS) ...
|
|
152
174
|
console:True, file:True, disguise:n/a, whitelist:*
|
|
153
175
|
> curl -k -I -H 'Host: www.google.com' https://localhost:8443
|
|
@@ -156,7 +178,7 @@ console:True, file:True, disguise:n/a, whitelist:*
|
|
|
156
178
|
|
|
157
179
|
### Connection status monitor
|
|
158
180
|
```commandline
|
|
159
|
-
> $ simple-proxy -r echo-server.proxy.com -rp 8080 -
|
|
181
|
+
> $ simple-proxy -r echo-server.proxy.com -rp 8080 -p 48080 -m
|
|
160
182
|
Proxy server started listening: localhost:48080 => echo-server.proxy.com:8080 ...
|
|
161
183
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
162
184
|
Connection opened: ('127.0.0.1', 60937)
|
|
@@ -187,15 +209,20 @@ Average Read Speed: 32765.0 bytes/s, Average Write Speed: 32752.88 bytes/s
|
|
|
187
209
|
|
|
188
210
|
|
|
189
211
|
### HTTP Proxy
|
|
190
|
-
You can set global envs *
|
|
212
|
+
You can set global envs *http_proxy* or *https_proxy* after http proxy server started.
|
|
191
213
|
```commandline
|
|
192
214
|
> simple-proxy --http-proxy
|
|
193
215
|
|
|
194
216
|
> simple-proxy --http-proxy --proxy-username=test --proxy-password=test
|
|
195
217
|
|
|
196
218
|
> simple-proxy --http-proxy --proxy-transform www.google.com 443 man-in-middle.com 8443
|
|
219
|
+
|
|
220
|
+
# Use this when an application supports only HTTP proxy,
|
|
221
|
+
# but your upstream proxy is SOCKS5.
|
|
222
|
+
> simple-proxy --http-proxy --internal-socks5-host=localhost --internal-socks5-port=1080
|
|
197
223
|
```
|
|
198
224
|
|
|
225
|
+
|
|
199
226
|
### SOCKS5 Proxy
|
|
200
227
|
You can set global envs *https_proxy* or *https_proxy* after socks5 proxy server startd.
|
|
201
228
|
```commandline
|
|
@@ -225,10 +252,10 @@ Any connection beyond whitelist will be served by a mock https server. Real serv
|
|
|
225
252
|
For example, you can protect your Scurrying Squirrel against attack from Grim Foolish Weasel.
|
|
226
253
|
|
|
227
254
|
```commandline
|
|
228
|
-
> simple-proxy -rp 8388 -
|
|
255
|
+
> simple-proxy -rp 8388 -p 443 -g --run-disguise-tls-server -wl=<your ip>,<your girlfriend's ip>,<your friend's girlfriend's ip>
|
|
229
256
|
# only you and your girlfriends can access :8388
|
|
230
257
|
|
|
231
|
-
> simple-proxy -rp 8388 -
|
|
258
|
+
> simple-proxy -rp 8388 -p 443 -g --disguise-tls-ip=www.google.com --disguise-tls-port=443
|
|
232
259
|
# only non-https can access :8388, https traffic through :443 will be directed to google
|
|
233
260
|
```
|
|
234
261
|
|
|
@@ -29,55 +29,77 @@ pip install simple-proxy -U
|
|
|
29
29
|
Usage: simple-proxy [OPTIONS]
|
|
30
30
|
|
|
31
31
|
Options:
|
|
32
|
-
Common configuration: Configuration for local/remote
|
|
33
|
-
|
|
34
|
-
-
|
|
32
|
+
Common configuration: Configuration for local/remote
|
|
33
|
+
endpoints
|
|
34
|
+
-l, --listening-host TEXT Listening server address
|
|
35
|
+
[default: localhost]
|
|
36
|
+
-lp, -p, --listening-port INTEGER
|
|
35
37
|
Listening port [default: 8080]
|
|
36
38
|
-g, --global Listening on all interfaces
|
|
37
39
|
-r, --remote-host TEXT Remote host [default: localhost]
|
|
38
40
|
-rp, --remote-port INTEGER Remote port [default: 80]
|
|
39
|
-
-s, --tls Denote remote is listening on
|
|
41
|
+
-s, --tls Denote remote is listening on
|
|
42
|
+
secure port
|
|
40
43
|
-ss Listening on secure port
|
|
41
44
|
TCP proxy configuration: Configuration for TCP proxy mode
|
|
42
45
|
--read-delay-millis INTEGER Read delay(ms) [default: 0]
|
|
43
46
|
--write-delay-millis INTEGER Write delay(ms) [default: 0]
|
|
44
47
|
-sni, --server-name-indication TEXT
|
|
45
|
-
Server Name Indication(SNI) for
|
|
48
|
+
Server Name Indication(SNI) for
|
|
49
|
+
TLS connection to remote server
|
|
46
50
|
Thread configuration: Configuration for thread
|
|
47
|
-
--workers INTEGER Number of worker threads
|
|
48
|
-
|
|
51
|
+
--workers INTEGER Number of worker threads
|
|
52
|
+
[default: 1]
|
|
53
|
+
--proxy-workers INTEGER Number of proxy threads [default:
|
|
54
|
+
1]
|
|
49
55
|
Traffic dump configuration: Configuration for traffic dump
|
|
50
56
|
-c, --tcp-flow Dump tcp flow on to console
|
|
51
57
|
-f, --save-tcp-flow Save tcp flow to file
|
|
52
|
-
TLS certificate configuration:
|
|
58
|
+
TLS certificate configuration:
|
|
53
59
|
Configuration for TLS certificate
|
|
54
60
|
-kf, --key-file PATH Key file for local server
|
|
55
61
|
-cf, --cert-file PATH Certificate file for local server
|
|
56
|
-
--alpn Set ALPN protocol as [h2,
|
|
57
|
-
|
|
62
|
+
--alpn Set ALPN protocol as [h2,
|
|
63
|
+
http/1.1]
|
|
64
|
+
Traffic monitor configuration:
|
|
58
65
|
Configuration for traffic monitor
|
|
59
|
-
-m, --monitor Print speed info to console for
|
|
66
|
+
-m, --monitor Print speed info to console for
|
|
67
|
+
established connection
|
|
60
68
|
-mi, --monitor-interval INTEGER
|
|
61
|
-
Speed monitor interval(seconds)
|
|
62
|
-
|
|
69
|
+
Speed monitor interval(seconds)
|
|
70
|
+
[default: 3]
|
|
71
|
+
TLS Disguise configuration: Configuration for protection
|
|
72
|
+
against unwanted inspection
|
|
63
73
|
-dti, --disguise-tls-ip TEXT Disguised upstream TLS IP
|
|
64
74
|
-dtp, --disguise-tls-port INTEGER
|
|
65
|
-
Disguised upstream TLS port
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
Disguised upstream TLS port
|
|
76
|
+
[default: 443]
|
|
77
|
+
--run-disguise-tls-server Run builtin disguise TLS server
|
|
78
|
+
without specifying external one
|
|
79
|
+
-wl, --white-list TEXT IP White list for legal incoming
|
|
80
|
+
TLS connections (comma separated)
|
|
81
|
+
Proxy configuration: Configuration for application
|
|
82
|
+
proxies
|
|
69
83
|
-e, --echo-proxy Run as Echo server
|
|
70
84
|
--shell-proxy Run as shell proxy server
|
|
71
85
|
--http-proxy Run as HTTP proxy server
|
|
72
86
|
--socks5-proxy Run as SOCKS5 proxy server
|
|
73
|
-
--proxy-username TEXT Proxy username for HTTP/SOCKS5
|
|
74
|
-
|
|
87
|
+
--proxy-username TEXT Proxy username for HTTP/SOCKS5
|
|
88
|
+
proxy
|
|
89
|
+
--proxy-password TEXT Proxy password for HTTP/SOCKS5
|
|
90
|
+
proxy
|
|
75
91
|
-t, --proxy-transform <TEXT INTEGER TEXT INTEGER>...
|
|
76
|
-
List of target
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
List of target
|
|
93
|
+
transformations(origin_host,
|
|
94
|
+
origin_port, transformed_host,
|
|
95
|
+
transformed_port) for HTTP/SOCKS5
|
|
96
|
+
proxy
|
|
97
|
+
Misc configuration:
|
|
79
98
|
-v, --verbose
|
|
80
99
|
--log-file PATH Log file
|
|
100
|
+
--internal-socks5-host TEXT [Internal] SOCKS5 proxy host
|
|
101
|
+
--internal-socks5-port INTEGER
|
|
102
|
+
[Internal] SOCKS5 proxy port
|
|
81
103
|
--version Show the version and exit.
|
|
82
104
|
-h, --help Show this message and exit.
|
|
83
105
|
```
|
|
@@ -86,7 +108,7 @@ Options:
|
|
|
86
108
|
## Features
|
|
87
109
|
### Basic proxy (TLS termination)
|
|
88
110
|
```commandline
|
|
89
|
-
> simple-proxy --tls -r www.google.com -rp 443 -
|
|
111
|
+
> simple-proxy --tls -r www.google.com -rp 443 -p 8080
|
|
90
112
|
Proxy server started listening: localhost:8080 => www.google.com:443(TLS) ...
|
|
91
113
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
92
114
|
> curl -I -H 'Host: www.google.com' http://localhost:8080
|
|
@@ -95,7 +117,7 @@ HTTP/1.1 200 OK
|
|
|
95
117
|
```
|
|
96
118
|
|
|
97
119
|
```commandline
|
|
98
|
-
> simple-proxy -r www.google.com -rp 80 -
|
|
120
|
+
> simple-proxy -r www.google.com -rp 80 -p 8443 -ss
|
|
99
121
|
Proxy server started listening: localhost:8443(TLS) => www.google.com:80 ...
|
|
100
122
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
101
123
|
> curl -I -H 'Host: www.google.com' -k https://localhost:8443
|
|
@@ -106,7 +128,7 @@ HTTP/1.1 200 OK
|
|
|
106
128
|
### Dump TCP flow
|
|
107
129
|
TCP flow can be dumped into console or files (under directory __tcpflow__)
|
|
108
130
|
```commandline
|
|
109
|
-
> simple-proxy -r www.google.com -rp 443 -
|
|
131
|
+
> simple-proxy -r www.google.com -rp 443 -p 8443 -ss -s -c -f
|
|
110
132
|
Proxy server started listening: localhost:8443(TLS) => www.google.com:443(TLS) ...
|
|
111
133
|
console:True, file:True, disguise:n/a, whitelist:*
|
|
112
134
|
> curl -k -I -H 'Host: www.google.com' https://localhost:8443
|
|
@@ -115,7 +137,7 @@ console:True, file:True, disguise:n/a, whitelist:*
|
|
|
115
137
|
|
|
116
138
|
### Connection status monitor
|
|
117
139
|
```commandline
|
|
118
|
-
> $ simple-proxy -r echo-server.proxy.com -rp 8080 -
|
|
140
|
+
> $ simple-proxy -r echo-server.proxy.com -rp 8080 -p 48080 -m
|
|
119
141
|
Proxy server started listening: localhost:48080 => echo-server.proxy.com:8080 ...
|
|
120
142
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
121
143
|
Connection opened: ('127.0.0.1', 60937)
|
|
@@ -146,15 +168,20 @@ Average Read Speed: 32765.0 bytes/s, Average Write Speed: 32752.88 bytes/s
|
|
|
146
168
|
|
|
147
169
|
|
|
148
170
|
### HTTP Proxy
|
|
149
|
-
You can set global envs *
|
|
171
|
+
You can set global envs *http_proxy* or *https_proxy* after http proxy server started.
|
|
150
172
|
```commandline
|
|
151
173
|
> simple-proxy --http-proxy
|
|
152
174
|
|
|
153
175
|
> simple-proxy --http-proxy --proxy-username=test --proxy-password=test
|
|
154
176
|
|
|
155
177
|
> simple-proxy --http-proxy --proxy-transform www.google.com 443 man-in-middle.com 8443
|
|
178
|
+
|
|
179
|
+
# Use this when an application supports only HTTP proxy,
|
|
180
|
+
# but your upstream proxy is SOCKS5.
|
|
181
|
+
> simple-proxy --http-proxy --internal-socks5-host=localhost --internal-socks5-port=1080
|
|
156
182
|
```
|
|
157
183
|
|
|
184
|
+
|
|
158
185
|
### SOCKS5 Proxy
|
|
159
186
|
You can set global envs *https_proxy* or *https_proxy* after socks5 proxy server startd.
|
|
160
187
|
```commandline
|
|
@@ -184,10 +211,10 @@ Any connection beyond whitelist will be served by a mock https server. Real serv
|
|
|
184
211
|
For example, you can protect your Scurrying Squirrel against attack from Grim Foolish Weasel.
|
|
185
212
|
|
|
186
213
|
```commandline
|
|
187
|
-
> simple-proxy -rp 8388 -
|
|
214
|
+
> simple-proxy -rp 8388 -p 443 -g --run-disguise-tls-server -wl=<your ip>,<your girlfriend's ip>,<your friend's girlfriend's ip>
|
|
188
215
|
# only you and your girlfriends can access :8388
|
|
189
216
|
|
|
190
|
-
> simple-proxy -rp 8388 -
|
|
217
|
+
> simple-proxy -rp 8388 -p 443 -g --disguise-tls-ip=www.google.com --disguise-tls-port=443
|
|
191
218
|
# only non-https can access :8388, https traffic through :443 will be directed to google
|
|
192
219
|
```
|
|
193
220
|
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "simple_proxy"
|
|
8
|
-
version = "0.0.
|
|
8
|
+
version = "0.0.32"
|
|
9
9
|
description = "A simple NIO proxy tool"
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.7, <4"
|
|
@@ -17,7 +17,7 @@ keywords = ["network", "tcp", "non-blocking", "proxy"]
|
|
|
17
17
|
|
|
18
18
|
dependencies = [
|
|
19
19
|
"click-option-group",
|
|
20
|
-
"py-netty>=1.0.
|
|
20
|
+
"py-netty>=1.0.9",
|
|
21
21
|
"cryptography>=42.0.0",
|
|
22
22
|
"attrs>=22.1.0",
|
|
23
23
|
]
|
|
@@ -62,6 +62,8 @@ logger = logging.getLogger(__name__)
|
|
|
62
62
|
@optgroup.group('Misc configuration')
|
|
63
63
|
@optgroup.option('-v', '--verbose', count=True)
|
|
64
64
|
@optgroup.option('--log-file', help='Log file', type=click.Path())
|
|
65
|
+
@optgroup.option('--internal-socks5-host', help='[Internal] SOCKS5 proxy host')
|
|
66
|
+
@optgroup.option('--internal-socks5-port', help='[Internal] SOCKS5 proxy port', default=0)
|
|
65
67
|
@click.version_option(prog_name='Simple Proxy', version=__version__)
|
|
66
68
|
def _cli(verbose, log_file: click.Path, **kwargs):
|
|
67
69
|
setup_logging(log_file, logging.INFO if verbose == 0 else logging.DEBUG)
|
{simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/handler/http_proxy_channel_handler.py
RENAMED
|
@@ -34,6 +34,9 @@ def get_local_peer_to_target_mapping() -> dict[str, str]:
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class HttpProxyChannelHandler(LoggingChannelHandler):
|
|
37
|
+
|
|
38
|
+
USE_SOCKSOCKET = False
|
|
39
|
+
|
|
37
40
|
def __init__(
|
|
38
41
|
self,
|
|
39
42
|
client_eventloop_group,
|
|
@@ -68,7 +71,7 @@ class HttpProxyChannelHandler(LoggingChannelHandler):
|
|
|
68
71
|
self._client = Bootstrap(
|
|
69
72
|
eventloop_group=self._client_eventloop_group,
|
|
70
73
|
handler_initializer=_ChannelHandler
|
|
71
|
-
).connect(ip, port, True).sync().channel()
|
|
74
|
+
).connect(ip, port, True, use_socksocket=HttpProxyChannelHandler.USE_SOCKSOCKET).sync().channel()
|
|
72
75
|
return self._client
|
|
73
76
|
|
|
74
77
|
def exception_caught(self, ctx, exception):
|
|
@@ -2,7 +2,7 @@ import codecs
|
|
|
2
2
|
import http.server
|
|
3
3
|
import signal
|
|
4
4
|
import ssl
|
|
5
|
-
|
|
5
|
+
import socks
|
|
6
6
|
from py_netty import EventLoopGroup, ServerBootstrap
|
|
7
7
|
|
|
8
8
|
from .clients import spawn_clients_monitor, stop_clients_monitor
|
|
@@ -56,7 +56,15 @@ def run_proxy(
|
|
|
56
56
|
server_name_indication: str | None = None,
|
|
57
57
|
workers=1, proxy_workers=1,
|
|
58
58
|
as_echo_server=False,
|
|
59
|
+
internal_socks5_host: str | None = None,
|
|
60
|
+
internal_socks5_port: int = 0,
|
|
59
61
|
):
|
|
62
|
+
if internal_socks5_port and internal_socks5_host:
|
|
63
|
+
pstderr("[Internal] Setting up internal SOCKS5 proxy for outgoing connection ...")
|
|
64
|
+
socks.set_default_proxy(socks.SOCKS5, internal_socks5_host, internal_socks5_port)
|
|
65
|
+
HttpProxyChannelHandler.USE_SOCKSOCKET = True
|
|
66
|
+
|
|
67
|
+
|
|
60
68
|
if tls and (disguise_tls_ip or run_disguise_tls_server):
|
|
61
69
|
pfatal("'--tls/-s' is not applicable if disguise mode is used!")
|
|
62
70
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simple_proxy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.32
|
|
4
4
|
Summary: A simple NIO proxy tool
|
|
5
5
|
Home-page: https://github.com/ruanhao/simple-proxy
|
|
6
6
|
Author-email: Hao Ruan <ruanhao1116@gmail.com>
|
|
@@ -26,7 +26,7 @@ Requires-Python: <4,>=3.7
|
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: click-option-group
|
|
29
|
-
Requires-Dist: py-netty>=1.0.
|
|
29
|
+
Requires-Dist: py-netty>=1.0.9
|
|
30
30
|
Requires-Dist: cryptography>=42.0.0
|
|
31
31
|
Requires-Dist: attrs>=22.1.0
|
|
32
32
|
Provides-Extra: dev
|
|
@@ -70,55 +70,77 @@ pip install simple-proxy -U
|
|
|
70
70
|
Usage: simple-proxy [OPTIONS]
|
|
71
71
|
|
|
72
72
|
Options:
|
|
73
|
-
Common configuration: Configuration for local/remote
|
|
74
|
-
|
|
75
|
-
-
|
|
73
|
+
Common configuration: Configuration for local/remote
|
|
74
|
+
endpoints
|
|
75
|
+
-l, --listening-host TEXT Listening server address
|
|
76
|
+
[default: localhost]
|
|
77
|
+
-lp, -p, --listening-port INTEGER
|
|
76
78
|
Listening port [default: 8080]
|
|
77
79
|
-g, --global Listening on all interfaces
|
|
78
80
|
-r, --remote-host TEXT Remote host [default: localhost]
|
|
79
81
|
-rp, --remote-port INTEGER Remote port [default: 80]
|
|
80
|
-
-s, --tls Denote remote is listening on
|
|
82
|
+
-s, --tls Denote remote is listening on
|
|
83
|
+
secure port
|
|
81
84
|
-ss Listening on secure port
|
|
82
85
|
TCP proxy configuration: Configuration for TCP proxy mode
|
|
83
86
|
--read-delay-millis INTEGER Read delay(ms) [default: 0]
|
|
84
87
|
--write-delay-millis INTEGER Write delay(ms) [default: 0]
|
|
85
88
|
-sni, --server-name-indication TEXT
|
|
86
|
-
Server Name Indication(SNI) for
|
|
89
|
+
Server Name Indication(SNI) for
|
|
90
|
+
TLS connection to remote server
|
|
87
91
|
Thread configuration: Configuration for thread
|
|
88
|
-
--workers INTEGER Number of worker threads
|
|
89
|
-
|
|
92
|
+
--workers INTEGER Number of worker threads
|
|
93
|
+
[default: 1]
|
|
94
|
+
--proxy-workers INTEGER Number of proxy threads [default:
|
|
95
|
+
1]
|
|
90
96
|
Traffic dump configuration: Configuration for traffic dump
|
|
91
97
|
-c, --tcp-flow Dump tcp flow on to console
|
|
92
98
|
-f, --save-tcp-flow Save tcp flow to file
|
|
93
|
-
TLS certificate configuration:
|
|
99
|
+
TLS certificate configuration:
|
|
94
100
|
Configuration for TLS certificate
|
|
95
101
|
-kf, --key-file PATH Key file for local server
|
|
96
102
|
-cf, --cert-file PATH Certificate file for local server
|
|
97
|
-
--alpn Set ALPN protocol as [h2,
|
|
98
|
-
|
|
103
|
+
--alpn Set ALPN protocol as [h2,
|
|
104
|
+
http/1.1]
|
|
105
|
+
Traffic monitor configuration:
|
|
99
106
|
Configuration for traffic monitor
|
|
100
|
-
-m, --monitor Print speed info to console for
|
|
107
|
+
-m, --monitor Print speed info to console for
|
|
108
|
+
established connection
|
|
101
109
|
-mi, --monitor-interval INTEGER
|
|
102
|
-
Speed monitor interval(seconds)
|
|
103
|
-
|
|
110
|
+
Speed monitor interval(seconds)
|
|
111
|
+
[default: 3]
|
|
112
|
+
TLS Disguise configuration: Configuration for protection
|
|
113
|
+
against unwanted inspection
|
|
104
114
|
-dti, --disguise-tls-ip TEXT Disguised upstream TLS IP
|
|
105
115
|
-dtp, --disguise-tls-port INTEGER
|
|
106
|
-
Disguised upstream TLS port
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
Disguised upstream TLS port
|
|
117
|
+
[default: 443]
|
|
118
|
+
--run-disguise-tls-server Run builtin disguise TLS server
|
|
119
|
+
without specifying external one
|
|
120
|
+
-wl, --white-list TEXT IP White list for legal incoming
|
|
121
|
+
TLS connections (comma separated)
|
|
122
|
+
Proxy configuration: Configuration for application
|
|
123
|
+
proxies
|
|
110
124
|
-e, --echo-proxy Run as Echo server
|
|
111
125
|
--shell-proxy Run as shell proxy server
|
|
112
126
|
--http-proxy Run as HTTP proxy server
|
|
113
127
|
--socks5-proxy Run as SOCKS5 proxy server
|
|
114
|
-
--proxy-username TEXT Proxy username for HTTP/SOCKS5
|
|
115
|
-
|
|
128
|
+
--proxy-username TEXT Proxy username for HTTP/SOCKS5
|
|
129
|
+
proxy
|
|
130
|
+
--proxy-password TEXT Proxy password for HTTP/SOCKS5
|
|
131
|
+
proxy
|
|
116
132
|
-t, --proxy-transform <TEXT INTEGER TEXT INTEGER>...
|
|
117
|
-
List of target
|
|
118
|
-
|
|
119
|
-
|
|
133
|
+
List of target
|
|
134
|
+
transformations(origin_host,
|
|
135
|
+
origin_port, transformed_host,
|
|
136
|
+
transformed_port) for HTTP/SOCKS5
|
|
137
|
+
proxy
|
|
138
|
+
Misc configuration:
|
|
120
139
|
-v, --verbose
|
|
121
140
|
--log-file PATH Log file
|
|
141
|
+
--internal-socks5-host TEXT [Internal] SOCKS5 proxy host
|
|
142
|
+
--internal-socks5-port INTEGER
|
|
143
|
+
[Internal] SOCKS5 proxy port
|
|
122
144
|
--version Show the version and exit.
|
|
123
145
|
-h, --help Show this message and exit.
|
|
124
146
|
```
|
|
@@ -127,7 +149,7 @@ Options:
|
|
|
127
149
|
## Features
|
|
128
150
|
### Basic proxy (TLS termination)
|
|
129
151
|
```commandline
|
|
130
|
-
> simple-proxy --tls -r www.google.com -rp 443 -
|
|
152
|
+
> simple-proxy --tls -r www.google.com -rp 443 -p 8080
|
|
131
153
|
Proxy server started listening: localhost:8080 => www.google.com:443(TLS) ...
|
|
132
154
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
133
155
|
> curl -I -H 'Host: www.google.com' http://localhost:8080
|
|
@@ -136,7 +158,7 @@ HTTP/1.1 200 OK
|
|
|
136
158
|
```
|
|
137
159
|
|
|
138
160
|
```commandline
|
|
139
|
-
> simple-proxy -r www.google.com -rp 80 -
|
|
161
|
+
> simple-proxy -r www.google.com -rp 80 -p 8443 -ss
|
|
140
162
|
Proxy server started listening: localhost:8443(TLS) => www.google.com:80 ...
|
|
141
163
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
142
164
|
> curl -I -H 'Host: www.google.com' -k https://localhost:8443
|
|
@@ -147,7 +169,7 @@ HTTP/1.1 200 OK
|
|
|
147
169
|
### Dump TCP flow
|
|
148
170
|
TCP flow can be dumped into console or files (under directory __tcpflow__)
|
|
149
171
|
```commandline
|
|
150
|
-
> simple-proxy -r www.google.com -rp 443 -
|
|
172
|
+
> simple-proxy -r www.google.com -rp 443 -p 8443 -ss -s -c -f
|
|
151
173
|
Proxy server started listening: localhost:8443(TLS) => www.google.com:443(TLS) ...
|
|
152
174
|
console:True, file:True, disguise:n/a, whitelist:*
|
|
153
175
|
> curl -k -I -H 'Host: www.google.com' https://localhost:8443
|
|
@@ -156,7 +178,7 @@ console:True, file:True, disguise:n/a, whitelist:*
|
|
|
156
178
|
|
|
157
179
|
### Connection status monitor
|
|
158
180
|
```commandline
|
|
159
|
-
> $ simple-proxy -r echo-server.proxy.com -rp 8080 -
|
|
181
|
+
> $ simple-proxy -r echo-server.proxy.com -rp 8080 -p 48080 -m
|
|
160
182
|
Proxy server started listening: localhost:48080 => echo-server.proxy.com:8080 ...
|
|
161
183
|
console:False, file:False, disguise:n/a, whitelist:*
|
|
162
184
|
Connection opened: ('127.0.0.1', 60937)
|
|
@@ -187,15 +209,20 @@ Average Read Speed: 32765.0 bytes/s, Average Write Speed: 32752.88 bytes/s
|
|
|
187
209
|
|
|
188
210
|
|
|
189
211
|
### HTTP Proxy
|
|
190
|
-
You can set global envs *
|
|
212
|
+
You can set global envs *http_proxy* or *https_proxy* after http proxy server started.
|
|
191
213
|
```commandline
|
|
192
214
|
> simple-proxy --http-proxy
|
|
193
215
|
|
|
194
216
|
> simple-proxy --http-proxy --proxy-username=test --proxy-password=test
|
|
195
217
|
|
|
196
218
|
> simple-proxy --http-proxy --proxy-transform www.google.com 443 man-in-middle.com 8443
|
|
219
|
+
|
|
220
|
+
# Use this when an application supports only HTTP proxy,
|
|
221
|
+
# but your upstream proxy is SOCKS5.
|
|
222
|
+
> simple-proxy --http-proxy --internal-socks5-host=localhost --internal-socks5-port=1080
|
|
197
223
|
```
|
|
198
224
|
|
|
225
|
+
|
|
199
226
|
### SOCKS5 Proxy
|
|
200
227
|
You can set global envs *https_proxy* or *https_proxy* after socks5 proxy server startd.
|
|
201
228
|
```commandline
|
|
@@ -225,10 +252,10 @@ Any connection beyond whitelist will be served by a mock https server. Real serv
|
|
|
225
252
|
For example, you can protect your Scurrying Squirrel against attack from Grim Foolish Weasel.
|
|
226
253
|
|
|
227
254
|
```commandline
|
|
228
|
-
> simple-proxy -rp 8388 -
|
|
255
|
+
> simple-proxy -rp 8388 -p 443 -g --run-disguise-tls-server -wl=<your ip>,<your girlfriend's ip>,<your friend's girlfriend's ip>
|
|
229
256
|
# only you and your girlfriends can access :8388
|
|
230
257
|
|
|
231
|
-
> simple-proxy -rp 8388 -
|
|
258
|
+
> simple-proxy -rp 8388 -p 443 -g --disguise-tls-ip=www.google.com --disguise-tls-port=443
|
|
232
259
|
# only non-https can access :8388, https traffic through :443 will be directed to google
|
|
233
260
|
```
|
|
234
261
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_proxy-0.0.30 → simple_proxy-0.0.32}/simple_proxy/handler/socks5_proxy_channel_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/handler/test_http_proxy_channel_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_proxy-0.0.30 → simple_proxy-0.0.32}/tests/handler/test_socks5_proxy_channel_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|