Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _sniff_in_from_client(self, src_ip, dst_ip, dst_port, interf, interf_mac, ne
self._logger.debug("Created a new sniffer to sniff incoming client packets. Process id: "
f"{os.getpid()}, Parent id: {os.getppid()}")
while True:
sniff(filter=f"ip proto UDP and not ether src {interf_mac} and ip dst host {dst_ip} and"
sniff(filter=f"ip proto 17 and not ether src {interf_mac} and ip dst host {dst_ip} and"
f" ip src host {src_ip} and ((dst port {dst_port}) or (((ip[6:2] > 0) or "
"(ip[7] > 0)) and (not ip[6] = 64)))",
iface=interf,
Expand All @@ -39,7 +39,7 @@ def _sniff_out_to_client(self, src_ip, src_port, interf, new_src_ip, new_src_por
self._logger.debug("Created a new sniffer to sniff outgoing client packets. Process id: "
f"{os.getpid()}, Parent id: {os.getppid()}")
while True:
sniff(filter=f"ip proto UDP and ip src host {src_ip} and src port {src_port}",
sniff(filter=f"ip proto 17 and ip src host {src_ip} and src port {src_port}",
iface=interf,
prn=func(new_src_ip, new_src_port, new_dst_ip, new_dst_port))

Expand All @@ -49,7 +49,7 @@ def _sniff_in_from_server(self, src_ip, src_port, dst_ip, interf, interf_mac, ne
self._logger.debug("Created a new sniffer to sniff incoming server packets. Process id: "
f"{os.getpid()}, Parent id: {os.getppid()}")
while True:
sniff(filter=f"ip proto UDP and not ether src {interf_mac} and ip dst host {dst_ip} and"
sniff(filter=f"ip proto 17 and not ether src {interf_mac} and ip dst host {dst_ip} and"
f" ip src host {src_ip} and ((src port {src_port}) or (((ip[6:2] > 0) or "
"(ip[7] > 0)) and (not ip[6] = 64)))",
iface=interf,
Expand All @@ -62,7 +62,7 @@ def _sniff_out_to_server(self, src_ip, dst_port, interf, new_src_ip, new_src_por
self._logger.debug("Created a new sniffer to sniff outgoing server packets. Process id: "
f"{os.getpid()}, Parent id: {os.getppid()}")
while True:
sniff(filter=f"ip proto UDP and ip src host {src_ip} and dst port {dst_port}",
sniff(filter=f"ip proto 17 and ip src host {src_ip} and dst port {dst_port}",
iface=interf,
prn=func(new_src_ip, new_src_port, new_dst_ip, new_dst_port))

Expand Down