debug server sends push packet back with correct seq ack
This commit is contained in:
parent
6c1261d994
commit
e32dfbdabe
@ -26,6 +26,9 @@ class Sniffer(Thread):
|
|||||||
self.debug_src = ""
|
self.debug_src = ""
|
||||||
self.debug_sport = 0
|
self.debug_sport = 0
|
||||||
|
|
||||||
|
self.last_ack = 0
|
||||||
|
self.last_seq = 0
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.socket = conf.L2listen(
|
self.socket = conf.L2listen(
|
||||||
@ -73,22 +76,44 @@ class Sniffer(Thread):
|
|||||||
self.debug_src = packet[IP].src
|
self.debug_src = packet[IP].src
|
||||||
self.debug_sport = tcp_sport
|
self.debug_sport = tcp_sport
|
||||||
|
|
||||||
|
self.last_ack = packet[TCP].ack
|
||||||
|
self.last_seq = packet[TCP].seq
|
||||||
|
|
||||||
self.recv_count += 1
|
self.recv_count += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_send_payload():
|
||||||
|
|
||||||
|
payload = "BBBBBBBBBBB"
|
||||||
|
|
||||||
|
return payload
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def send_debug_packet(sniffer):
|
def send_debug_packet(sniffer):
|
||||||
|
|
||||||
debug_port = sniffer.debug_sport
|
debug_port = sniffer.debug_sport
|
||||||
debug_ip = sniffer.debug_src
|
debug_ip = sniffer.debug_src
|
||||||
|
|
||||||
|
send_seq = sniffer.last_ack
|
||||||
|
send_ack = sniffer.last_seq
|
||||||
|
|
||||||
|
|
||||||
if debug_port == 0 or debug_ip == '':
|
if debug_port == 0 or debug_ip == '':
|
||||||
print("There was no debug source connection to send to")
|
print("There was no debug source connection to send to")
|
||||||
return
|
return
|
||||||
|
|
||||||
print("sending debug packet to " + str(debug_ip) + ":" + str(debug_port))
|
print("sending debug packet to " + str(debug_ip) + ":" + str(debug_port))
|
||||||
|
|
||||||
packet = IP(dst=debug_ip) / TCP(dport=debug_port, sport=server_port, flags='R')
|
send_payload = get_send_payload()
|
||||||
|
packet = IP(dst=debug_ip) / TCP(dport=debug_port, sport=server_port, flags='PA', seq=send_seq, ack=send_ack) / send_payload
|
||||||
send(packet, iface="ens18")
|
send(packet, iface="ens18")
|
||||||
print("sent debug packet: ")
|
print("sent debug packet: ")
|
||||||
packet.show()
|
packet.show()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user