-
-
Save thepacketgeek/6928674 to your computer and use it in GitHub Desktop.
from scapy.all import * | |
answer = sr1(IP(dst="8.8.8.8")/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname="www.thepacketgeek.com")),verbose=0) | |
print answer[DNS].summary() |
scapy sr1(IP(dst="8.8.8.8")/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname="www.thepacketgeek.com")),verbose=0)
when we try to run this command on the terminal, it generates an error unexpected "("
@MarryamZulfiqar Scapy has a REPL. Just type scapy to your console (needs a superuser/admin account) and start forging packets and requests. Here's the documentation: https://scapy.readthedocs.io/en/latest/usage.html#simple-one-liners
Please help, when I try
sr1(IP(dst="8.8.8.8")/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname="google.com")),verbose=0)
It hangs, but when I use
sr1(IP(dst="192.168.1.1")/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname="google.com")),verbose=0)
, everything works.
192.168.1.1 is my wifi gateway, I don't know how to connect to 8.8.8.8
Edited:
Problem is solved by adding sport
.
sr1(IP(dst="8.8.8.8")/UDP(sport=RandShort(), dport=53)/DNS(rd=1,qd=DNSQR(qname="google.com")),verbose=0)
I suggest getting some DNS bins online to track your requests. In this case I used requestbin.net
Here is an example that works
>>> ans = sr1(IP(dst="8.8.8.8")/UDP(sport=RandShort(), dport=53)/DNS(rd=1,qd=DNSQR(qname="7a645c14a2eaac.d.requestbin.net",qtype="A")))
Begin emission:
Finished to send 1 packets.
*
Received 1 packets, got 1 answers, remaining 0 packets
>>> **ans.an.rdata**
'127.0.0.1'
Hi,
I need your help . can you please help me with the following
I need to use scapy or similar library to generate network packets to transfer files e.g. ASCII, JPG, PDF from one machine to another while pretending to be the following legitimate protocol
DNS
Skype
Windows SMB
While reviewing the header the packet should resemble like the legit protocol.