nopasaran 0.2.97__tar.gz → 0.2.98__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.
- {nopasaran-0.2.97 → nopasaran-0.2.98}/PKG-INFO +1 -1
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/http_1_socket_server.py +41 -34
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran.egg-info/PKG-INFO +1 -1
- {nopasaran-0.2.97 → nopasaran-0.2.98}/setup.py +1 -1
- {nopasaran-0.2.97 → nopasaran-0.2.98}/LICENSE +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/README.md +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/__main__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/controllers/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/controllers/controller.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/controllers/factory.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/controllers/protocol.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/decorators.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/definitions/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/definitions/commands.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/definitions/control_channel.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/definitions/events.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/definitions/transitions.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/errors/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/errors/parsing_error.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/http_2_utils.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/interpreters/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/interpreters/action_interpreter.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/interpreters/condition_interpreter.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/interpreters/interpreter.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/interpreters/transition_interpreter.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/machines/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/machines/action_queue.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/machines/state_machine.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/parsers/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/parsers/interpreter_parser.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/parsers/state_machine_parser.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/action_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/certificate_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/client_echo_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/control_channel_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/data_channel_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/data_manipulation.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/dns_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/event_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/http_1_request_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/http_1_response_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/http_2_client_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/http_2_server_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/http_simple_client_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/https_1_request_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/https_1_response_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/icmp_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/io_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/ip_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/nested_machine_utils.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/probing_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/replay_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/server_echo_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/signaling_primitive.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/tcp_dns_request_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/tcp_dns_response_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/tcp_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/timing_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/tls_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/udp_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/condition_primitives/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/condition_primitives/condition_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/condition_primitives/variable_comparisons.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/transition_primitives/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/transition_primitives/assignment_transitions.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/transition_primitives/transition_primitives.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/sniffers/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/sniffers/sniffer.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/__init__.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/checks.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/echo_socket_server.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/http_2_overwrite.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/http_2_socket_base.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/http_2_socket_client.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/http_2_socket_server.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/https_1_socket_server.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/tools/tcp_dns_socket_server.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/utils.py +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran.egg-info/SOURCES.txt +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran.egg-info/dependency_links.txt +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran.egg-info/entry_points.txt +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran.egg-info/requires.txt +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran.egg-info/top_level.txt +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/setup.cfg +0 -0
- {nopasaran-0.2.97 → nopasaran-0.2.98}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nopasaran
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.98
|
4
4
|
Summary: NoPASARAN is an advanced network tool designed to detect, fingerprint, and locate network middleboxes in a unified framework.
|
5
5
|
Home-page: https://github.com/BenIlies/NoPASARAN
|
6
6
|
Author: Ilies Benhabbour
|
@@ -17,21 +17,45 @@ class HTTP1SocketServer:
|
|
17
17
|
self.client_socket = None
|
18
18
|
self.TIMEOUT = 5.0
|
19
19
|
|
20
|
-
def handle_client_connection(self, client_socket):
|
20
|
+
def handle_client_connection(self, client_socket, timeout):
|
21
21
|
"""
|
22
22
|
Handle a client connection by processing the incoming request and sending the appropriate response.
|
23
23
|
"""
|
24
|
-
|
25
|
-
|
24
|
+
client_socket.setblocking(False)
|
25
|
+
ready_to_read, _, _ = select.select([client_socket], [], [], timeout)
|
26
|
+
|
27
|
+
if not ready_to_read:
|
28
|
+
client_socket.close()
|
29
|
+
return None, EventNames.TIMEOUT.name
|
30
|
+
|
31
|
+
try:
|
32
|
+
request = client_socket.recv(4096)
|
33
|
+
except socket.timeout:
|
34
|
+
client_socket.close()
|
35
|
+
return None, EventNames.TIMEOUT.name
|
36
|
+
except ConnectionResetError as e:
|
37
|
+
client_socket.close()
|
38
|
+
return str(e), EventNames.ERROR.name
|
39
|
+
|
40
|
+
if not request:
|
41
|
+
client_socket.close()
|
42
|
+
return None, EventNames.TIMEOUT.name
|
43
|
+
|
44
|
+
request_str = request.decode('utf-8', errors='ignore')
|
45
|
+
|
26
46
|
# Extract request line and headers
|
27
47
|
headers_end_index = request_str.find("\r\n\r\n")
|
28
48
|
headers_part = request_str[:headers_end_index] if headers_end_index != -1 else request_str
|
29
49
|
request_line = headers_part.split("\r\n")[0]
|
30
|
-
|
50
|
+
|
51
|
+
try:
|
52
|
+
method, path, _ = request_line.split(" ", 2)
|
53
|
+
except ValueError:
|
54
|
+
method, path = "GET", "/"
|
31
55
|
|
32
56
|
route_key = (path, method)
|
33
57
|
route_info_list = self.routes.get(route_key)
|
34
|
-
|
58
|
+
|
35
59
|
if route_info_list:
|
36
60
|
response = ""
|
37
61
|
for route_info in route_info_list:
|
@@ -39,42 +63,30 @@ class HTTP1SocketServer:
|
|
39
63
|
status_code = route_info.get('status', 200)
|
40
64
|
headers = route_info.get('headers', [])
|
41
65
|
|
42
|
-
# Construct each part of the response
|
43
66
|
response_part = f"HTTP/1.1 {status_code} OK\r\n"
|
44
67
|
for header_name, header_value in headers:
|
45
68
|
response_part += f"{header_name}: {header_value}\r\n"
|
46
|
-
response_part += f"\r\n{response_body}\r\n\r\n"
|
69
|
+
response_part += f"\r\n{response_body}\r\n\r\n"
|
47
70
|
|
48
|
-
# Append the response part to the full response
|
49
71
|
response += response_part
|
50
72
|
|
51
|
-
# Send the full combined response to the client
|
52
73
|
client_socket.sendall(response.encode())
|
53
|
-
|
54
74
|
else:
|
55
75
|
response_body = 'NoPASARAN HTTP/1.1 Server'
|
56
76
|
status_code = 404
|
57
|
-
|
58
|
-
|
59
|
-
# Construct the HTTP response
|
60
|
-
response = f"HTTP/1.1 {status_code} OK\r\n"
|
61
|
-
for header_name, header_value in headers:
|
62
|
-
response += f"{header_name}: {header_value}\r\n"
|
63
|
-
response += f"\r\n{response_body}"
|
64
|
-
|
65
|
-
# Send response to client
|
77
|
+
response = f"HTTP/1.1 {status_code} Not Found\r\nContent-Length: {len(response_body)}\r\n\r\n{response_body}"
|
66
78
|
client_socket.sendall(response.encode())
|
67
79
|
|
68
80
|
client_socket.close()
|
69
81
|
|
70
|
-
# Store the raw received request data
|
71
82
|
self.received_request_data = request
|
72
83
|
|
73
|
-
# Notify that a request has been received
|
74
84
|
if self.request_received:
|
75
85
|
with self.request_received:
|
76
86
|
self.request_received.notify_all()
|
77
87
|
|
88
|
+
return request, EventNames.REQUEST_RECEIVED.name
|
89
|
+
|
78
90
|
def wait_for_request(self, port, timeout):
|
79
91
|
"""
|
80
92
|
Wait for an HTTP request or timeout.
|
@@ -84,7 +96,7 @@ class HTTP1SocketServer:
|
|
84
96
|
timeout (int): The timeout duration in seconds.
|
85
97
|
|
86
98
|
Returns:
|
87
|
-
Tuple[bytes, str]: The raw received request data or None if a timeout occurs, and the event name.
|
99
|
+
Tuple[bytes or None, str]: The raw received request data or None if a timeout occurs, and the event name.
|
88
100
|
"""
|
89
101
|
server_address = ('', port)
|
90
102
|
self.request_received = threading.Condition()
|
@@ -96,22 +108,18 @@ class HTTP1SocketServer:
|
|
96
108
|
server_socket.listen(1)
|
97
109
|
server_socket.setblocking(False)
|
98
110
|
|
99
|
-
# Initialize the timeout timer
|
100
111
|
start_time = time.time()
|
101
112
|
|
102
113
|
while True:
|
103
|
-
# Check if the timeout has elapsed
|
104
114
|
elapsed_time = time.time() - start_time
|
105
|
-
if elapsed_time
|
115
|
+
if elapsed_time >= timeout:
|
106
116
|
return None, EventNames.TIMEOUT.name
|
107
|
-
|
108
|
-
# Use select to wait for a connection with a timeout
|
117
|
+
|
109
118
|
ready_to_read, _, _ = select.select([server_socket], [], [], timeout - elapsed_time)
|
110
|
-
|
119
|
+
|
111
120
|
if ready_to_read:
|
112
121
|
client_socket, _ = server_socket.accept()
|
113
|
-
self.handle_client_connection(client_socket)
|
114
|
-
return self.received_request_data, EventNames.REQUEST_RECEIVED.name
|
122
|
+
return self.handle_client_connection(client_socket, timeout - elapsed_time)
|
115
123
|
|
116
124
|
def start(self, host, port):
|
117
125
|
"""
|
@@ -121,7 +129,7 @@ class HTTP1SocketServer:
|
|
121
129
|
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
122
130
|
self.sock.bind((host, port))
|
123
131
|
self.sock.listen(5)
|
124
|
-
|
132
|
+
|
125
133
|
return EventNames.SERVER_STARTED.name, f"Server successfully started at {host}:{port}."
|
126
134
|
|
127
135
|
def close(self):
|
@@ -131,11 +139,10 @@ class HTTP1SocketServer:
|
|
131
139
|
self.client_socket.close()
|
132
140
|
if self.sock:
|
133
141
|
self.sock.close()
|
134
|
-
|
135
|
-
# Clear references
|
142
|
+
|
136
143
|
self.client_socket = None
|
137
144
|
self.sock = None
|
138
|
-
|
145
|
+
|
139
146
|
return EventNames.CONNECTION_ENDING.name
|
140
147
|
except Exception as e:
|
141
148
|
return EventNames.CONNECTION_ENDING.name
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nopasaran
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.98
|
4
4
|
Summary: NoPASARAN is an advanced network tool designed to detect, fingerprint, and locate network middleboxes in a unified framework.
|
5
5
|
Home-page: https://github.com/BenIlies/NoPASARAN
|
6
6
|
Author: Ilies Benhabbour
|
@@ -13,7 +13,7 @@ with open(requirements_file, "r") as f:
|
|
13
13
|
# Version will automatically be updated when pushed on the main branch
|
14
14
|
setup(
|
15
15
|
name="nopasaran",
|
16
|
-
version='0.2.
|
16
|
+
version='0.2.98',
|
17
17
|
author="Ilies Benhabbour",
|
18
18
|
author_email="ilies.benhabbour@kaust.edu.sa",
|
19
19
|
description="NoPASARAN is an advanced network tool designed to detect, fingerprint, and locate network middleboxes in a unified framework.",
|
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
|
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
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/action_primitives.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/data_manipulation.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/dns_primitives.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/event_primitives.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
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/icmp_primitives.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/io_primitives.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/ip_primitives.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/nested_machine_utils.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/probing_primitives.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/replay_primitives.py
RENAMED
File without changes
|
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/signaling_primitive.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/tcp_primitives.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/timing_primitives.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/tls_primitives.py
RENAMED
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/action_primitives/udp_primitives.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{nopasaran-0.2.97 → nopasaran-0.2.98}/nopasaran/primitives/transition_primitives/__init__.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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|