dpyproxy 2.2.0__tar.gz → 2.2.1__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.
Files changed (59) hide show
  1. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/.gitignore +0 -3
  2. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/PKG-INFO +9 -7
  3. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/README.md +8 -6
  4. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/dns/DnsModule.py +6 -4
  5. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/dns/DnsProxy.py +13 -7
  6. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/pyproject.toml +1 -1
  7. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/LICENSE +0 -0
  8. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/dpyproxy/__init__.py +0 -0
  9. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/dpyproxy/__main__.py +0 -0
  10. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/enumerators/DnsProxyMode.py +0 -0
  11. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/enumerators/DnsResolvers.py +0 -0
  12. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/enumerators/HttpMethod.py +0 -0
  13. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/enumerators/Modules.py +0 -0
  14. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/enumerators/Port.py +0 -0
  15. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/enumerators/TcpProxyMode.py +0 -0
  16. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/enumerators/TlsVersion.py +0 -0
  17. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/enumerators/__init__.py +0 -0
  18. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/exception/DnsException.py +0 -0
  19. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/exception/ParserException.py +0 -0
  20. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/exception/__init__.py +0 -0
  21. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/main.py +0 -0
  22. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/Module.py +0 -0
  23. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/__init__.py +0 -0
  24. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/dns/DnsModeDeterminator.py +0 -0
  25. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/dns/DnsResolver.py +0 -0
  26. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/dns/__init__.py +0 -0
  27. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/http/HttpModule.py +0 -0
  28. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/http/HttpStrategies.py +0 -0
  29. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/http/HttpUtils.py +0 -0
  30. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/http/__init__.py +0 -0
  31. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/tls/TcpProxy.py +0 -0
  32. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/tls/TlsModule.py +0 -0
  33. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/modules/tls/__init__.py +0 -0
  34. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/DomainResolver.py +0 -0
  35. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/NetworkAddress.py +0 -0
  36. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/WrappedSocket.py +0 -0
  37. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/__init__.py +0 -0
  38. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/protocols/Dns.py +0 -0
  39. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/protocols/Http.py +0 -0
  40. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/protocols/Socksv4.py +0 -0
  41. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/protocols/Socksv5.py +0 -0
  42. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/protocols/Tls.py +0 -0
  43. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/protocols/__init__.py +0 -0
  44. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/tcp/Forwarder.py +0 -0
  45. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/tcp/TcpConnectionHandler.py +0 -0
  46. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/tcp/WrappedTcpSocket.py +0 -0
  47. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/tcp/__init__.py +0 -0
  48. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/network/udp/__init__.py +0 -0
  49. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/test/Sink.py +0 -0
  50. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/test/__init__.py +0 -0
  51. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/test/test_dns.py +0 -0
  52. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/test/test_http.py +0 -0
  53. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/test/test_tls.py +0 -0
  54. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/util/DnsAutoModeRuntimeMeasurement.py +0 -0
  55. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/util/DnsReachabilityCollector.py +0 -0
  56. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/util/DnsResolversDomainResolver.py +0 -0
  57. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/util/Util.py +0 -0
  58. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/util/__init__.py +0 -0
  59. {dpyproxy-2.2.0 → dpyproxy-2.2.1}/util/constants.py +0 -0
@@ -159,8 +159,5 @@ cython_debug/
159
159
  # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
160
  .idea/
161
161
 
162
- # Custom
163
- working_resolver_config.json
164
-
165
162
  # ruff
166
163
  .ruff_cache/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dpyproxy
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: Python proxy that implements DPI evasion mechanisms (TLS record fragmentation, TCP segmentation, encrypted DNS, HTTP)
5
5
  Project-URL: Homepage, https://github.com/UPB-SysSec/DPYProxy
6
6
  Project-URL: Issues, https://github.com/UPB-SysSec/DPYProxy/issues
@@ -62,9 +62,9 @@ DNS censorship. In a typical setup, DPYProxy runs locally replacing your previou
62
62
  The DNS module automatically determines a working circumvention method and DNS resolver. You can also specify a
63
63
  circumvention method and resolver manually (see Usage).
64
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.
65
+ The DNS module can save working circumvention methods and resolvers to a file see
66
+ (`--dns_working_resolver_configuration`). This file is loaded on startup to speed up the determination of a working
67
+ circumvention method. By default, a new working circumvention method is determined in each run.
68
68
 
69
69
  ### TLS Module
70
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
@@ -159,6 +159,8 @@ TLS Module:
159
159
  Connection timeout in seconds
160
160
  --tls_host TLS_HOST Address the proxy server runs on
161
161
  --tls_port TLS_PORT Port the proxy server runs on
162
+ --tls_record_version TLS_RECORD_VERSION
163
+ Overwrites the TLS version in the TLS record with the given bytes. Pre-defined values ['DEFAULT', 'TLS10', 'TLS11', 'TLS12', 'TLS13_DRAFT_28', 'TLS13', 'SSL3', 'INVALID_SMALLER', 'INVALID_BIGGER'] or 2 byte long values such as 0303 or FFFF can be provided.
162
164
  --tls_record_frag, --no-tls_record_frag
163
165
  Whether to use record fragmentation to forwarded TLS handshake messages (default: True)
164
166
  --tls_tcp_frag, --no-tls_tcp_frag
@@ -196,8 +198,8 @@ DNS Module:
196
198
  Whether the given IP ranges to compare are block page IPs or not. Default is False.
197
199
  --dns_add_sni DNS_ADD_SNI
198
200
  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
+ --dns_working_resolver_config DNS_WORKING_RESOLVER_CONFIG
202
+ DPYProxy can save a working DNS resolver configuration, provide a location for this file here. Example: ./.working_resolver_config.json. If empty (default) no configuration is saved and a working configuration is determined in each run.
201
203
 
202
204
  HTTP Module:
203
205
  --http_timeout HTTP_TIMEOUT
@@ -215,7 +217,7 @@ Standard options:
215
217
  -h, --help Show this help message and exit
216
218
  --debug, --no-debug Turns on debugging (default: False)
217
219
  --disabled_modules DISABLED_MODULES
218
- List of proxy modules to disable. By default, all none are disabled. Hence, all are enabled
220
+ List of proxy modules to disable. By default, only the HTTP module is disabled.
219
221
  ```
220
222
 
221
223
  ## Examples
@@ -12,9 +12,9 @@ DNS censorship. In a typical setup, DPYProxy runs locally replacing your previou
12
12
  The DNS module automatically determines a working circumvention method and DNS resolver. You can also specify a
13
13
  circumvention method and resolver manually (see Usage).
14
14
 
15
- The DNS module saves working circumvention methods and resolvers to a file `working_resolvers.json`. This file is loaded
16
- on startup to speed up the determination of a working circumvention method. You can force re-determination using the
17
- `--dns_skip_working_file` flag.
15
+ The DNS module can save working circumvention methods and resolvers to a file see
16
+ (`--dns_working_resolver_configuration`). This file is loaded on startup to speed up the determination of a working
17
+ circumvention method. By default, a new working circumvention method is determined in each run.
18
18
 
19
19
  ### TLS Module
20
20
  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
@@ -109,6 +109,8 @@ TLS Module:
109
109
  Connection timeout in seconds
110
110
  --tls_host TLS_HOST Address the proxy server runs on
111
111
  --tls_port TLS_PORT Port the proxy server runs on
112
+ --tls_record_version TLS_RECORD_VERSION
113
+ Overwrites the TLS version in the TLS record with the given bytes. Pre-defined values ['DEFAULT', 'TLS10', 'TLS11', 'TLS12', 'TLS13_DRAFT_28', 'TLS13', 'SSL3', 'INVALID_SMALLER', 'INVALID_BIGGER'] or 2 byte long values such as 0303 or FFFF can be provided.
112
114
  --tls_record_frag, --no-tls_record_frag
113
115
  Whether to use record fragmentation to forwarded TLS handshake messages (default: True)
114
116
  --tls_tcp_frag, --no-tls_tcp_frag
@@ -146,8 +148,8 @@ DNS Module:
146
148
  Whether the given IP ranges to compare are block page IPs or not. Default is False.
147
149
  --dns_add_sni DNS_ADD_SNI
148
150
  Whether or not to include the SNI for encrypted DNS modes. Defaults to True.
149
- --dns_skip_working_file DNS_SKIP_WORKING_FILE
150
- Whether taking the stored working resolver from a file should be skipped. Defaults to False.
151
+ --dns_working_resolver_config DNS_WORKING_RESOLVER_CONFIG
152
+ DPYProxy can save a working DNS resolver configuration, provide a location for this file here. Example: ./.working_resolver_config.json. If empty (default) no configuration is saved and a working configuration is determined in each run.
151
153
 
152
154
  HTTP Module:
153
155
  --http_timeout HTTP_TIMEOUT
@@ -165,7 +167,7 @@ Standard options:
165
167
  -h, --help Show this help message and exit
166
168
  --debug, --no-debug Turns on debugging (default: False)
167
169
  --disabled_modules DISABLED_MODULES
168
- List of proxy modules to disable. By default, all none are disabled. Hence, all are enabled
170
+ List of proxy modules to disable. By default, only the HTTP module is disabled.
169
171
  ```
170
172
 
171
173
  ## Examples
@@ -85,9 +85,11 @@ class DnsModule(Module):
85
85
  )
86
86
 
87
87
  dns_module.add_argument(
88
- "--dns_skip_working_file",
89
- default=False,
90
- help="Whether taking the stored working resolver from a file should be skipped. Defaults to False.",
88
+ "--dns_working_resolver_config",
89
+ default="",
90
+ help="DPYProxy can save a working DNS resolver configuration, provide a location for this file here."
91
+ " Example: ./.working_resolver_config.json. If empty (default) no configuration is saved and"
92
+ " a working configuration is determined in each run.",
91
93
  )
92
94
 
93
95
  def extract_parameters(self, args: Namespace):
@@ -103,7 +105,7 @@ class DnsModule(Module):
103
105
  compare_ip_ranges=[x for x in args.dns_compare_ip_ranges.split(",")],
104
106
  block_page_ips=args.dns_block_page_ips,
105
107
  add_sni=args.dns_add_sni,
106
- skip_working_file=args.dns_skip_working_file,
108
+ working_resolver_configuration=args.dns_working_resolver_config,
107
109
  )
108
110
 
109
111
  def start(self):
@@ -35,7 +35,7 @@ class DnsProxy:
35
35
  compare_ip_ranges: list[str],
36
36
  block_page_ips: bool,
37
37
  add_sni: bool,
38
- skip_working_file: bool,
38
+ working_resolver_configuration: str = "",
39
39
  ):
40
40
  # timeout for socket reads and message reception
41
41
  self.timeout = timeout
@@ -46,7 +46,7 @@ class DnsProxy:
46
46
  self.block_page_ips = block_page_ips
47
47
  self.proxy_mode = proxy_mode
48
48
  self.add_sni = add_sni
49
- self.skip_working_file = skip_working_file
49
+ self.working_resolver_configuration = working_resolver_configuration
50
50
 
51
51
  # initialize UDP and TCP server sockets
52
52
  self.udp_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -165,9 +165,13 @@ class DnsProxy:
165
165
  found_working = False
166
166
  domain_resolver_generator = self.generate_domain_resolver()
167
167
 
168
- if os.path.exists("working_resolver_config.json") and not self.skip_working_file:
169
- logging.info("Trying already found working resolver from config")
170
- with open("working_resolver_config.json", "r") as f:
168
+ if (
169
+ self.working_resolver_configuration
170
+ and not len(self.working_resolver_configuration) == 0
171
+ and os.path.exists(self.working_resolver_configuration)
172
+ ):
173
+ logging.info(f"Trying already found working resolver from config {self.working_resolver_configuration}")
174
+ with open(self.working_resolver_configuration, "r") as f:
171
175
  data = json.load(f)
172
176
  resolver = DomainResolver.from_dict(data)
173
177
  self.domain_resolver = resolver
@@ -200,8 +204,10 @@ class DnsProxy:
200
204
  logging.info(f"{domain_resolver} consistently reachable, keeping!")
201
205
  self.domain_resolver = domain_resolver
202
206
  self.proxy_mode = self.domain_resolver.dns_mode
203
- with open("working_resolver_config.json", "w") as f:
204
- json.dump(domain_resolver.to_dict(), f, indent=4)
207
+ if self.working_resolver_configuration and not len(self.working_resolver_configuration) == 0:
208
+ logging.info(f"Saving working resolver to {self.working_resolver_configuration}")
209
+ with open(self.working_resolver_configuration, "w") as f:
210
+ json.dump(domain_resolver.to_dict(), f, indent=4)
205
211
  logging.info(
206
212
  f"Finding consistent mode and starting resolvers took {time.time() - self.start_time} seconds "
207
213
  "in total."
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dpyproxy"
7
- version = "2.2.0"
7
+ version = "2.2.1"
8
8
  description = "Python proxy that implements DPI evasion mechanisms (TLS record fragmentation, TCP segmentation, encrypted DNS, HTTP)"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
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
File without changes
File without changes