dpyproxy 2.2.0__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.
- dpyproxy-2.2.0/.gitignore +166 -0
- dpyproxy-2.2.0/LICENSE +201 -0
- dpyproxy-2.2.0/PKG-INFO +296 -0
- dpyproxy-2.2.0/README.md +246 -0
- dpyproxy-2.2.0/dpyproxy/__init__.py +1 -0
- dpyproxy-2.2.0/dpyproxy/__main__.py +4 -0
- dpyproxy-2.2.0/enumerators/DnsProxyMode.py +39 -0
- dpyproxy-2.2.0/enumerators/DnsResolvers.py +141 -0
- dpyproxy-2.2.0/enumerators/HttpMethod.py +17 -0
- dpyproxy-2.2.0/enumerators/Modules.py +38 -0
- dpyproxy-2.2.0/enumerators/Port.py +11 -0
- dpyproxy-2.2.0/enumerators/TcpProxyMode.py +17 -0
- dpyproxy-2.2.0/enumerators/TlsVersion.py +21 -0
- dpyproxy-2.2.0/enumerators/__init__.py +0 -0
- dpyproxy-2.2.0/exception/DnsException.py +7 -0
- dpyproxy-2.2.0/exception/ParserException.py +7 -0
- dpyproxy-2.2.0/exception/__init__.py +0 -0
- dpyproxy-2.2.0/main.py +94 -0
- dpyproxy-2.2.0/modules/Module.py +45 -0
- dpyproxy-2.2.0/modules/__init__.py +0 -0
- dpyproxy-2.2.0/modules/dns/DnsModeDeterminator.py +358 -0
- dpyproxy-2.2.0/modules/dns/DnsModule.py +113 -0
- dpyproxy-2.2.0/modules/dns/DnsProxy.py +277 -0
- dpyproxy-2.2.0/modules/dns/DnsResolver.py +18 -0
- dpyproxy-2.2.0/modules/dns/__init__.py +0 -0
- dpyproxy-2.2.0/modules/http/HttpModule.py +69 -0
- dpyproxy-2.2.0/modules/http/HttpStrategies.py +849 -0
- dpyproxy-2.2.0/modules/http/HttpUtils.py +94 -0
- dpyproxy-2.2.0/modules/http/__init__.py +0 -0
- dpyproxy-2.2.0/modules/tls/TcpProxy.py +106 -0
- dpyproxy-2.2.0/modules/tls/TlsModule.py +173 -0
- dpyproxy-2.2.0/modules/tls/__init__.py +0 -0
- dpyproxy-2.2.0/network/DomainResolver.py +472 -0
- dpyproxy-2.2.0/network/NetworkAddress.py +10 -0
- dpyproxy-2.2.0/network/WrappedSocket.py +97 -0
- dpyproxy-2.2.0/network/__init__.py +0 -0
- dpyproxy-2.2.0/network/protocols/Dns.py +62 -0
- dpyproxy-2.2.0/network/protocols/Http.py +109 -0
- dpyproxy-2.2.0/network/protocols/Socksv4.py +70 -0
- dpyproxy-2.2.0/network/protocols/Socksv5.py +106 -0
- dpyproxy-2.2.0/network/protocols/Tls.py +113 -0
- dpyproxy-2.2.0/network/protocols/__init__.py +0 -0
- dpyproxy-2.2.0/network/tcp/Forwarder.py +203 -0
- dpyproxy-2.2.0/network/tcp/TcpConnectionHandler.py +264 -0
- dpyproxy-2.2.0/network/tcp/WrappedTcpSocket.py +30 -0
- dpyproxy-2.2.0/network/tcp/__init__.py +0 -0
- dpyproxy-2.2.0/network/udp/__init__.py +0 -0
- dpyproxy-2.2.0/pyproject.toml +101 -0
- dpyproxy-2.2.0/test/Sink.py +23 -0
- dpyproxy-2.2.0/test/__init__.py +0 -0
- dpyproxy-2.2.0/test/test_dns.py +98 -0
- dpyproxy-2.2.0/test/test_http.py +57 -0
- dpyproxy-2.2.0/test/test_tls.py +63 -0
- dpyproxy-2.2.0/util/DnsAutoModeRuntimeMeasurement.py +62 -0
- dpyproxy-2.2.0/util/DnsReachabilityCollector.py +160 -0
- dpyproxy-2.2.0/util/DnsResolversDomainResolver.py +36 -0
- dpyproxy-2.2.0/util/Util.py +62 -0
- dpyproxy-2.2.0/util/__init__.py +0 -0
- dpyproxy-2.2.0/util/constants.py +8 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
160
|
+
.idea/
|
|
161
|
+
|
|
162
|
+
# Custom
|
|
163
|
+
working_resolver_config.json
|
|
164
|
+
|
|
165
|
+
# ruff
|
|
166
|
+
.ruff_cache/
|
dpyproxy-2.2.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
dpyproxy-2.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dpyproxy
|
|
3
|
+
Version: 2.2.0
|
|
4
|
+
Summary: Python proxy that implements DPI evasion mechanisms (TLS record fragmentation, TCP segmentation, encrypted DNS, HTTP)
|
|
5
|
+
Project-URL: Homepage, https://github.com/UPB-SysSec/DPYProxy
|
|
6
|
+
Project-URL: Issues, https://github.com/UPB-SysSec/DPYProxy/issues
|
|
7
|
+
Author-email: Niklas Niere <niklas.niere@upb.de>, Felix Lange <felix.lange@upb.de>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: censorship,dns,dpi,http,privacy,proxy,tls
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Internet :: Proxy Servers
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: aioquic>=1.3.0
|
|
25
|
+
Requires-Dist: anyio>=4.14.0
|
|
26
|
+
Requires-Dist: attrs>=26.1.0
|
|
27
|
+
Requires-Dist: certifi>=2026.5.20
|
|
28
|
+
Requires-Dist: cffi>=2.0.0
|
|
29
|
+
Requires-Dist: cryptography>=49.0.0
|
|
30
|
+
Requires-Dist: dnspython>=2.8.0
|
|
31
|
+
Requires-Dist: exceptiongroup>=1.2.2; python_version < '3.11'
|
|
32
|
+
Requires-Dist: h11>=0.16.0
|
|
33
|
+
Requires-Dist: h2>=4.3.0
|
|
34
|
+
Requires-Dist: hpack>=4.1.0
|
|
35
|
+
Requires-Dist: httpcore>=1.0.9
|
|
36
|
+
Requires-Dist: httpx>=0.28.1
|
|
37
|
+
Requires-Dist: hyperframe>=6.1.0
|
|
38
|
+
Requires-Dist: idna>=3.18
|
|
39
|
+
Requires-Dist: pyasn1-modules>=0.4.2
|
|
40
|
+
Requires-Dist: pyasn1>=0.6.3
|
|
41
|
+
Requires-Dist: pycparser>=3.0
|
|
42
|
+
Requires-Dist: pylsqpack>=0.3.24
|
|
43
|
+
Requires-Dist: pyopenssl>=26.3.0
|
|
44
|
+
Requires-Dist: pytest>=9.1.0
|
|
45
|
+
Requires-Dist: ruff>=0.15.17
|
|
46
|
+
Requires-Dist: service-identity>=26.1.0
|
|
47
|
+
Requires-Dist: sniffio>=1.3.1
|
|
48
|
+
Requires-Dist: typing-extensions>=4.12.2; python_version < '3.12'
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
|
|
51
|
+
# DPYProxy
|
|
52
|
+
DPYProxy is a python proxy that implements DPI evasion mechanisms. To circumvent TLS censorship, TLS record fragmentation and TCP
|
|
53
|
+
segmentation are implemented. To circumvent DNS censorship, DPYProxy uses encrypted DNS and TCP segmentation. All DPI evasion mechanisms can be enabled separately.
|
|
54
|
+
|
|
55
|
+
DPYProxy comes with a TLS and DNS module circumventing TLS and DNS censorship respectively. Both modules are enabled by default:
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### DNS Module
|
|
59
|
+
You can run the DNS module of DPYProxy locally or on a separate machine. It functions as a DNS resolver that circumvents
|
|
60
|
+
DNS censorship. In a typical setup, DPYProxy runs locally replacing your previous DNS resolver in your system setup.
|
|
61
|
+
|
|
62
|
+
The DNS module automatically determines a working circumvention method and DNS resolver. You can also specify a
|
|
63
|
+
circumvention method and resolver manually (see Usage).
|
|
64
|
+
|
|
65
|
+
The DNS module saves working circumvention methods and resolvers to a file `working_resolvers.json`. This file is loaded
|
|
66
|
+
on startup to speed up the determination of a working circumvention method. You can force re-determination using the
|
|
67
|
+
`--dns_skip_working_file` flag.
|
|
68
|
+
|
|
69
|
+
### TLS Module
|
|
70
|
+
You can run the TLS Module of DPYProxy locally or on a separate machine. It functions like an HTTP CONNECT/SOCKSv4/SOCKSv5 proxy. I.e., you can specify
|
|
71
|
+
it as your Firefox/Chrome/System Proxy.
|
|
72
|
+
|
|
73
|
+
In a typical setup, DPYProxy runs locally replacing your previous proxy in your browser or system setup. You can specify
|
|
74
|
+
your previous proxy as a forward proxy for DPYProxy. This can be helpful if you need DPYProxy for DPI evasion and a
|
|
75
|
+
separate proxy for IP censorship circumvention.
|
|
76
|
+
|
|
77
|
+
The TLS module does not automatically determine a working circumvention method. You need to specify the circumvention
|
|
78
|
+
method manually (see Usage). However, by default, the TLS module uses the DNS module to resolve DNS queries.
|
|
79
|
+
Thus, if you run both modules, the DNS module automatically determines a working circumvention method for DNS queries
|
|
80
|
+
used by the TLS module.
|
|
81
|
+
|
|
82
|
+
### HTTP Module
|
|
83
|
+
You can run the HTTP module of DPYProxy locally or on a separate machine. It functions like an HTTP CONNECT/SOCKSv4/SOCKSv5 proxy. I.e., you can specify
|
|
84
|
+
it as your Firefox/Chrome/System Proxy.
|
|
85
|
+
|
|
86
|
+
In a typical setup, DPYProxy runs locally replacing your previous proxy in your browser or system setup. You can specify
|
|
87
|
+
your previous proxy as a forward proxy for DPYProxy. This can be helpful if you need DPYProxy for DPI evasion and a
|
|
88
|
+
separate proxy for IP censorship circumvention.
|
|
89
|
+
|
|
90
|
+
The HTTP module does not automatically determine a working circumvention method. You need to specify the circumvention
|
|
91
|
+
method manually (see Usage). Simple HTTP request alterations (e.g., lowercase request) and HTTP Request Smuggling
|
|
92
|
+
strategies are implemented. A list of all implemented strategies can be found in: modules/http/HttpStrategies.
|
|
93
|
+
**Be careful: HTTP request smuggling is a network attack against benign hosts and its implementation is experimental.
|
|
94
|
+
Plain HTTP traffic is also visible to any party that can read your traffic (such as your ISP). Use HTTPS (HTTP over TLS)
|
|
95
|
+
instead**
|
|
96
|
+
|
|
97
|
+
> The HTTP module is disabled by default. Enable by providing --disabled-modules ""
|
|
98
|
+
|
|
99
|
+
> HTTP request smuggling can be dangerous: https://portswigger.net/web-security/request-smuggling. Only enable if you
|
|
100
|
+
> know what you are doing and only use it against servers you have permission access via request smuggling.
|
|
101
|
+
> HttpStrategies 100-129 are HTTP request smuggling strategies.
|
|
102
|
+
|
|
103
|
+
# Requirements
|
|
104
|
+
You can run DPYProxy with Python or Docker. The requirements for both options are listed below.
|
|
105
|
+
- python3 (if you want to run DPYPRoxy with Python)
|
|
106
|
+
- `sudo apt install python3`
|
|
107
|
+
- `pip3 install .` to run as module with `python3 main.py` or `python3 -m dpyproxy`
|
|
108
|
+
- OR [install hatch](https://hatch.pypa.io/latest/install/) and run using `hatch run dpyproxy`
|
|
109
|
+
- docker (if you want to run DPYProxy in a container)
|
|
110
|
+
- https://docs.docker.com/engine/install/
|
|
111
|
+
|
|
112
|
+
# Quick Start
|
|
113
|
+
Start DPYProxy with Docker:
|
|
114
|
+
```sh
|
|
115
|
+
docker-compose up
|
|
116
|
+
```
|
|
117
|
+
Alternatively, start DPYProxy with Python:
|
|
118
|
+
```sh
|
|
119
|
+
python3 main.py --tls_record_frag --tls_tcp_frag --tls_frag_size 20 --tls_port 4433 --dns_port 5533
|
|
120
|
+
```
|
|
121
|
+
After automatically determining a circumvention method, the expected output looks like this:
|
|
122
|
+
```
|
|
123
|
+
INFO:root:DNS Module and TLS module found. Setting DNS server for TLS Module
|
|
124
|
+
INFO:root:Determining working circumvention method / resolver!
|
|
125
|
+
### Started TCP proxy on localhost:4433 ###
|
|
126
|
+
INFO:root:Found working circumvention method / resolver UDP - 1.0.0.3:53! Checking if consistently reachable!
|
|
127
|
+
INFO:root:UDP - 1.0.0.3:53 consistently reachable, keeping!
|
|
128
|
+
INFO:root:Finding consistent mode and starting resolvers took 0.0792999267578125 seconds in total.
|
|
129
|
+
### Started UDP DNS server on 127.0.0.1:5533 ###
|
|
130
|
+
### Started TCP DNS server on 127.0.0.1:5533 ###
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
DPYProxy now resolves all DNS requests to port 5533.
|
|
134
|
+
You can send a DNS request to the DNS server using `dig`:
|
|
135
|
+
```sh
|
|
136
|
+
dig wikipedia.org @127.0.0.1 -p 5533
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
You can also configure the DNS resolver `127.0.0.1:5533` in any application that supports custom DNS resolvers, e.g., in your browser or system settings.
|
|
140
|
+
|
|
141
|
+
You can test the TLS circumventions using curl
|
|
142
|
+
```sh
|
|
143
|
+
curl -p -x localhost:4433 https://www.wikipedia.org
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Detailed usage of DPYPRoxy-DNS and the original TLS module can be found below.
|
|
147
|
+
|
|
148
|
+
# Usage
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
usage: main.py [options]
|
|
152
|
+
|
|
153
|
+
Proxy for circumventing DPI-based censorship.
|
|
154
|
+
|
|
155
|
+
TLS Module:
|
|
156
|
+
--tls_disabled_modes {HTTP,HTTPS,SNI,SOCKSv4,SOCKSv4a,SOCKSv5}
|
|
157
|
+
List of proxy modes to ignore. By default, all none are disabled. Hence, all are enabled
|
|
158
|
+
--tls_timeout TLS_TIMEOUT
|
|
159
|
+
Connection timeout in seconds
|
|
160
|
+
--tls_host TLS_HOST Address the proxy server runs on
|
|
161
|
+
--tls_port TLS_PORT Port the proxy server runs on
|
|
162
|
+
--tls_record_frag, --no-tls_record_frag
|
|
163
|
+
Whether to use record fragmentation to forwarded TLS handshake messages (default: True)
|
|
164
|
+
--tls_tcp_frag, --no-tls_tcp_frag
|
|
165
|
+
Whether to use TCP fragmentation to forwarded messages. (default: True)
|
|
166
|
+
--tls_frag_size TLS_FRAG_SIZE
|
|
167
|
+
Bytes in each TCP/TLS record fragment
|
|
168
|
+
--tls_dns_server_ip TLS_DNS_SERVER_IP
|
|
169
|
+
DNS server IP for all DNS queries of the TLS module. If not given, the DNS server started by the DNS module us used. If DNS module is not used, the OS default DNS server is used.
|
|
170
|
+
--tls_dns_server_port TLS_DNS_SERVER_PORT
|
|
171
|
+
DNS server port for all DNS queries. Only set if a DNS server IP is given. If not given, the default port 53 is used.
|
|
172
|
+
--tls_forward_proxy_host TLS_FORWARD_PROXY_HOST
|
|
173
|
+
Host of the forward proxy if any is present
|
|
174
|
+
--tls_forward_proxy_port TLS_FORWARD_PROXY_PORT
|
|
175
|
+
Port the forward proxy server runs on
|
|
176
|
+
--tls_forward_proxy_mode {HTTP,HTTPS,SNI,SOCKSv4,SOCKSv4a,SOCKSv5}
|
|
177
|
+
The proxy type of the forward proxy
|
|
178
|
+
--tls_forward_proxy_resolve_address, --no-tls_forward_proxy_resolve_address
|
|
179
|
+
Whether to resolve domains before including them in the HTTP CONNECT request to the second proxy (default: False)
|
|
180
|
+
|
|
181
|
+
DNS Module:
|
|
182
|
+
--dns_mode DNS_MODE Mode that the DNS proxy operates in. Default AUTO. If not set to AUTO, still attempts to automatically determine a resolver for the configured mode. To pre-define the used DNS mode and server set this flag and the dns_resolver_host and optionally the dns_resolver_port flags.
|
|
183
|
+
--dns_timeout DNS_TIMEOUT
|
|
184
|
+
Connection timeout in seconds. For the LAST_RESPONSE mode this timeout will always be reached. Set this timeout and the timeout of calling application accordingly.
|
|
185
|
+
--dns_host DNS_HOST Address the proxy server runs on
|
|
186
|
+
--dns_port DNS_PORT Port the proxy server runs on
|
|
187
|
+
--dns_resolver_host DNS_RESOLVER_HOST
|
|
188
|
+
DNS resolver IP. If set, must correspond to the selected dns_mode.
|
|
189
|
+
--dns_resolver_port DNS_RESOLVER_PORT
|
|
190
|
+
DNS resolver port. If set, must correspond to the selected dns_mode. If unset, port is chosen based on the chosen or determined mode's standard port
|
|
191
|
+
--dns_censored_domain DNS_CENSORED_DOMAIN
|
|
192
|
+
A domain name censored in your location. Used to determine working circumventions methods. Specify together with --dns_censored_domain_ip
|
|
193
|
+
--dns_compare_ip_ranges DNS_COMPARE_IP_RANGES
|
|
194
|
+
A list of IP ranges the resolved IP of the censored domain lies in. The censored domain is specifiable in --dns_censored_domain.
|
|
195
|
+
--dns_block_page_ips DNS_BLOCK_PAGE_IPS
|
|
196
|
+
Whether the given IP ranges to compare are block page IPs or not. Default is False.
|
|
197
|
+
--dns_add_sni DNS_ADD_SNI
|
|
198
|
+
Whether or not to include the SNI for encrypted DNS modes. Defaults to True.
|
|
199
|
+
--dns_skip_working_file DNS_SKIP_WORKING_FILE
|
|
200
|
+
Whether taking the stored working resolver from a file should be skipped. Defaults to False.
|
|
201
|
+
|
|
202
|
+
HTTP Module:
|
|
203
|
+
--http_timeout HTTP_TIMEOUT
|
|
204
|
+
Connection timeout in seconds
|
|
205
|
+
--http_host HTTP_HOST
|
|
206
|
+
Address the proxy server runs on
|
|
207
|
+
--http_port HTTP_PORT
|
|
208
|
+
Port the proxy server runs on
|
|
209
|
+
--http_strategy HTTP_STRATEGY
|
|
210
|
+
Number of which specific http manipulation strategy to apply. None: no manipulation, [1..70]: basic manipulations, [101, 129]: Smuggling.See HttpStrategies for meaning.
|
|
211
|
+
--http_smuggling_uncensored_url HTTP_SMUGGLING_UNCENSORED_URL
|
|
212
|
+
Uncensored url to use for http smuggling.
|
|
213
|
+
|
|
214
|
+
Standard options:
|
|
215
|
+
-h, --help Show this help message and exit
|
|
216
|
+
--debug, --no-debug Turns on debugging (default: False)
|
|
217
|
+
--disabled_modules DISABLED_MODULES
|
|
218
|
+
List of proxy modules to disable. By default, all none are disabled. Hence, all are enabled
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Examples
|
|
222
|
+
|
|
223
|
+
`python3 main.py --disabled_modules TLS` launches DPYProxy with just the DNS module enabled. The TLS module is disabled and not
|
|
224
|
+
used at all. The DNS module starts in its auto mode by default.
|
|
225
|
+
|
|
226
|
+
`python3 main.py --tls_record_frag --no-tls_tcp_frag` launches DPYProxy with TLS record fragmentation enabled. TCP fragmentation is
|
|
227
|
+
turned off. The DNS module is also enabled with its default auto mode to determine a working circumvention. Using this circumvention, a
|
|
228
|
+
resolver is started that can be used on the system in general and is used by the TLS module by default.
|
|
229
|
+
|
|
230
|
+
`python3 main.py --tls_frag_size 100` launches DPYProxy with both TLS record and TCP fragmentation
|
|
231
|
+
and sets the fragment size to 100 bytes. The TLS record will be of size 100 while the encompassing TCP segments will be
|
|
232
|
+
just large enough to contain the fragmented TLS record. The DNS module is also enabled with its default auto mode to determine a working circumvention. Using this circumvention, a
|
|
233
|
+
resolver is started that can be used on the system in general and is used by the TLS module by default.
|
|
234
|
+
|
|
235
|
+
`python3 main.py --http_smuggling 23 --http_smuggling_uncensored_url 2` launches DPYProxy with HTTP Request Smuggling strategy number 23 enabled, using the second of three incorporated urls that are found to be uncensored (in china). This specific strategy includes the Content-Length Header to set the bounds before the hidden request and the Transfer-Encoding Header to set them after the body to hide the second request. Additionally the Transfer-Encoding Header gets modified to include a
|
|
236
|
+
second Colon (Transfer-Encoding:: chunked).
|
|
237
|
+
A list of all implemented smuggling strategies (and direct manipulations) can be found in: modules/http/HttpStrategies. There you will also find the three uncensored urls.
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
`python3 main.py --record_frag --forward_proxy_address 192.168.0.1 --forward_proxy_port 8080 --forward_proxy_mode HTTPS
|
|
241
|
+
--forward_proxy_resolve_address` launches DPYProxy with TLS record fragmentation and a forward proxy. The forward proxy
|
|
242
|
+
is specified by its address and port. While DPYProxy accepts HTTP GET, HTTP CONNECT and TLS ClientHello messages for
|
|
243
|
+
proxying, it connects to the forward proxy using HTTP CONNECT. The DNS module is also enabled with its default auto mode to determine a working circumvention. Using this circumvention, a
|
|
244
|
+
resolver is started that can be used on the system in general and is used by the TLS module by default.
|
|
245
|
+
|
|
246
|
+
## Testing
|
|
247
|
+
|
|
248
|
+
Setup DPYProxy using
|
|
249
|
+
```sh
|
|
250
|
+
python3 main.py --tls_record_frag --tls_tcp_frag --tls_frag_size 20 --tls_port 4433 --dns_port 5533
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
You can test the TLS circumventions using curl
|
|
254
|
+
```sh
|
|
255
|
+
curl -p -x localhost:4433 https://www.wikipedia.org
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Using some kind of capturing tool like Wireshark, you can inspect the fragmented TLS records and TCP segments.
|
|
259
|
+
|
|
260
|
+
You can test the DNS circumventions using dig
|
|
261
|
+
```sh
|
|
262
|
+
dig wikipedia.org @127.0.0.1 -p 5533
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Using some kind of capturing tool like Wireshark, you can inspect the made DNS requests for the selected circumvention strategy.
|
|
266
|
+
# Docker
|
|
267
|
+
|
|
268
|
+
You can run DPYProxy in a Docker container. A standard setting is provided in the `docker-compose.yml` file. You can
|
|
269
|
+
also build the image yourself using the provided `Dockerfile` or change the parameters in the `docker-compose.yml` file.
|
|
270
|
+
|
|
271
|
+
Start the container with:
|
|
272
|
+
```sh
|
|
273
|
+
docker-compose up
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
# Roadmap
|
|
277
|
+
|
|
278
|
+
We developed DPYProxy when writing a blogpost in which we circumvented the GFW with TLS record fragmentation. Thus, the
|
|
279
|
+
functionality of DPYProxy is currently limited. Below, I gathered some potential avenues for the future.
|
|
280
|
+
|
|
281
|
+
## Implemented
|
|
282
|
+
- [x] HTTP Connect Proxy
|
|
283
|
+
- [x] SNI Proxy
|
|
284
|
+
- [x] DNS Resolver
|
|
285
|
+
- [x] Socksv4/Sockv5 proxy
|
|
286
|
+
- [x] TLS record fragmentation
|
|
287
|
+
- [x] TCP Fragmentation
|
|
288
|
+
- [x] HTTP Circumventions
|
|
289
|
+
|
|
290
|
+
## Todo
|
|
291
|
+
- [ ] unit tests...
|
|
292
|
+
- [ ] IPv6
|
|
293
|
+
|
|
294
|
+
## Maintainance
|
|
295
|
+
- Run `ruff check --fix` to fix the auto fixable lint issues.
|
|
296
|
+
- Run `ruff format .` to pretty the code. Few could need a manual effort.
|