Skip to content

Commit

Permalink
fix 16/n
Browse files Browse the repository at this point in the history
  • Loading branch information
xhdix committed Jan 12, 2022
1 parent 1d31ffa commit ae0feec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions utils/packet_input.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
from scapy.layers.inet import IP
from scapy.layers.inet import IP, TCP
from scapy.utils import import_hexcap

firewall_commands_help = "\r\n( · - · · · \r\n\
Expand Down Expand Up @@ -37,14 +37,15 @@ def copy_input_packets(os_name: str, trace_retransmission: bool):
copy_packet_1.show()
print(" . . . - . . . . - . . . . - . . . . - . ")
if not trace_retransmission:
if os_name == "Linux":
do_tcph1 = yesno_second_packet(
"Would you like to do a TCP Handshake before sending this packet?"
+ firewall_commands_help)
else:
do_tcph1 = yesno_second_packet(
"Would you like to do a TCP Handshake before sending this packet?")
print(" · - · - · · - · - · · - · - · · - · - · ")
if copy_packet_1.haslayer(TCP):
if os_name == "Linux":
do_tcph1 = yesno_second_packet(
"Would you like to do a TCP Handshake before sending this packet?"
+ firewall_commands_help)
else:
do_tcph1 = yesno_second_packet(
"Would you like to do a TCP Handshake before sending this packet?")
print(" · - · - · · - · - · · - · - · · - · - · ")
if yesno_second_packet("Would you like to add a second packet"):
print(
" paste here the second packet hex dump start with the IP layer and then enter (optional) :")
Expand All @@ -53,8 +54,9 @@ def copy_input_packets(os_name: str, trace_retransmission: bool):
print(" . . . - . developed view of this packet:")
copy_packet_2.show()
print(" . . . - . . . . - . . . . - . . . . - . ")
do_tcph2 = yesno_second_packet(
"Would you like to do a TCP Handshake before sending this packet?")
if copy_packet_1.haslayer(TCP):
do_tcph2 = yesno_second_packet(
"Would you like to do a TCP Handshake before sending this packet?")
print(
" ********************************************************************** ")
return copy_packet_1, copy_packet_2, do_tcph1, do_tcph2
2 changes: 1 addition & 1 deletion utils/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def trace_route(
do_tcphandshake.append(do_tcph1)
do_tcphandshake.append(do_tcph2)
have_2_packet = True
if ip_list == "":
if len(ip_list) == 0:
if request_packet_1[IP].dst == "" or request_packet_1[IP].dst == LOCALHOST:
if have_2_packet:
if request_packet_2[IP].dst == "" or request_packet_2[IP].dst == LOCALHOST:
Expand Down

0 comments on commit ae0feec

Please sign in to comment.