-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestmanip.py.save
48 lines (37 loc) · 1.35 KB
/
testmanip.py.save
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from scapy.all import *
i
mport sys
def handle_packet(packet):
if ((packet[IP].src == "10.10.10.4" and packet[IP].dst == "10.10.10.3"):
print("Captured a packet:")
print(packet.show())
packet[IP].src = "10.10.10.89"
print("New packet:")
print(packet.show())
print("Sending packet")
resp_packet = sr(packet, timeout=1)
#print("Response:")
#print(resp_packet.show())
if (packet[IP].src == "10.10.10.4" and packet[IP].dst == "10.10.10.89"):
print("Captured altered packet from 10.10.10.4:")
print(packet.show())
packet[IP].src = "10.10.10.89"
packet[IP].dst = "10.10.10.3"
print("New altered packet:")
print(packet.show())
print("Sending packet")
resp_packet = sr1(packet, timeout=1)
#print("Response:")
#print(resp_packet.show())
if (packet[IP].src == "10.10.10.3" and packet[IP].dst == "10.10.10.89"):
print("Captured altered packet from 10.10.10.3:")
print(packet.show())
packet[IP].src = "10.10.10.89"
packet[IP].dst = "10.10.10.4"
print("New altered packet:")
print(packet.show())
print("Sending packet")
resp_packet = sr1(packet, timeout=1)
#print("Response:")
#print(resp_packet.show())
sniff(prn=handle_packet, filter='ip')