Advertisement
Guest User

Untitled

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