Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GNU nano 3.2 dnsFinalserver.py
- 1 from scapy.all import sniff
- 2 from scapy.all import *
- 3 from scapy.utils import hexdump
- 4 import base64
- 7 packets = sniff( filter = "host 192.168.43.42", timeout = 10)
- 8 RecivedText = []
- 9 num = 0
- 10 for packet in packets:
- 11 if not ARP in packet:
- 12 if packet[IP].src == '192.168.43.42':
- 13 c = raw(packet.lastlayer())
- 14 c = base64.b64decode(c)
- 15 RecivedText.append(c)
- 16 if packet[3].id == num:
- 17 print ("You have recived: ", num, "packets")
- 18 num+ = 1
- 19 print ("d")
- 20 else:
- 21 x = sr(IP(dst = '192.168.43.42')/UDP(dport = 53)/DNS(rd = 1, qd = DNSQR(qname = "google.com", qtype = "A"), id = num))
- 22 with open ('trump.txt', 'wb') as f:
- 23 for string in text:
- 24 f.write(string)
- 25 print ("Package sent! ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement