Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 from scapy.all import *
- 2 import sys
- 3 def main():
- 4 while(True):
- 5 readpacket = sniff(count=1)
- 6 if(readpacket[0].haslayer(ICMP)) and (readpacket[0][ICMP].type == 8):
- 7 uh = str(readpacket[0][ICMP].chksum)
- 8 print(( "Source IP Address: " + readpacket[0].src + "\n" +
- 9 "Destination IP address: " + readpacket[0].dst + "\n" +
- 10 "ICMP sequence number:" + str(readpacket[0][ICMP].seq)))
- 11 print("ICMP Checksum: {} ".format(uh))
- 12 pktreturn = IP(src=readpacket[0].dst, dst=readpacket[0].src)/ICMP(type=0, id=readpacket[0][ICMP].id, se q=readpacket[0][ICMP].seq)
- 13 sendp(pktreturn)
- 14
- 15 if __name__ == "__main__":
- 16 # execute only if run as a script
- 17 main()
- ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement