Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. from scapy.all import *
  3. import hashlib
  4. hasher=hashlib.md5()
  5. #ip=str(input("Enter src ip(who send you the file: "))
  6. #dest=str(input("enter dst ip(your local ip: "))
  7. ip = '10.0.0.8'
  8. dest = '10.0.0.2 '
  9. lod=""
  10. filters=str("src " + ip + " && dst " + dest + "&& port 53")
  11. recv=""
  12. c=1
  13. print(filters)
  14. while c!=0:
  15. pkt=sniff(filter=filters,count=1)
  16. lod=str(pkt[Padding].load)
  17. parts=int(lod[1:4])
  18. orghash=lod[6:]
  19. pkts=sniff(filter=filters,count=parts)
  20. for pkt in pkts:
  21. recv+=pkt[Padding].load
  22. hasher.update(recv)
  23. recvhash=hasher.hexdigest()
  24. if recvhash==orghash:
  25. filename=input("enternametofile")
  26. with open(filename,"wb") as file:
  27. file.write(recv)
  28. print(f"file {filename} receive ")
  29. break
  30. else:
  31. continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement