Skip to content

Instantly share code, notes, and snippets.

@averagesecurityguy
Created October 7, 2015 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save averagesecurityguy/2c9384c30689ae344424 to your computer and use it in GitHub Desktop.
Save averagesecurityguy/2c9384c30689ae344424 to your computer and use it in GitHub Desktop.
Scapy Issue
from scapy.all import *
http = IP(dst="10.0.2.15)/TCP(dport=80)/"GET /index.html HTTP/1.0\r\n\r\n"
send(http)
sendp(http, iface="eth0")
sudo tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
23:33:25.286185 00:00:40:06:62:96 (oui Unknown) > 45:00:00:44:00:01 (oui Unknown), ethertype Unknown (0x0a00), length 68:
0x0000: 020f 0a00 020f 0014 0050 0000 0000 0000 .........P......
0x0010: 0000 5002 2000 b589 0000 4745 5420 2f69 ..P.......GET./i
0x0020: 6e64 6578 2e68 746d 6c20 4854 5450 2f31 ndex.html.HTTP/1
0x0030: 2e30 0d0a 0d0a .0....
@tedher
Copy link

tedher commented Oct 7, 2015

Hi Stephen,
Looks like you forgot to quote the dst correctly. I tested the code on my system and the send works correctly.

>>> http = IP(dst="192.168.203.129")/TCP(dport=80)/"GET /index.html HTTP/1.0\r\n\r\n"
>>> send(http)
.
Sent 1 packets.
>>> sendp(http, iface="eth0")
.
Sent 1 packets.

@averagesecurityguy
Copy link
Author

I had the quotes correct in my script. Not sure what happened when creating the gist. Scapy tells me both packets are sent but I only see one in tcpdump when listening on eth0. If I listen on the loopback interface I see the packet from send but not the packet from sendp. If I listen on eth0 I see the packet from sendp but not send. I guess send defaults to loopback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment