Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- from scapy.all import *
- import hashlib
- hasher=hashlib.md5()
- #ip=str(input("Enter src ip(who send you the file: "))
- #dest=str(input("enter dst ip(your local ip: "))
- ip = '10.0.0.8'
- dest = '10.0.0.2 '
- lod=""
- filters=str("src " + ip + " && dst " + dest + "&& port 53")
- recv=""
- c=1
- print(filters)
- while c!=0:
- pkt=sniff(filter=filters,count=1)
- lod=str(pkt[Padding].load)
- parts=int(lod[1:4])
- orghash=lod[6:]
- pkts=sniff(filter=filters,count=parts)
- for pkt in pkts:
- recv+=pkt[Padding].load
- hasher.update(recv)
- recvhash=hasher.hexdigest()
- if recvhash==orghash:
- filename=input("enternametofile")
- with open(filename,"wb") as file:
- file.write(recv)
- print(f"file {filename} receive ")
- break
- else:
- continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement