python - when i made a 3 handshake with ubuntu in VMware return package R -
#!/usr/bin/python scapy.all import * def findweb(): = sr1(ip(dst="8.8.8.8")/udp()/dns(qd=dnsqr(qname="www.google.com")),verbose=0) return a[dnsrr].rdata def sendpacket(dst,src): ip = ip(dst = dst) syn = tcp(sport=1500, dport=80, flags='s') synack = sr1(ip/syn) my_ack = synack.seq + 1 ack = tcp(sport=1050, dport=80, flags='a', ack=my_ack) send(ip/ack) payload = "stuff" push = tcp(sport=1050, dport=80, flags='pa', seq=11, ack=my_ack) send(ip/push/payload) http = sr1(ip/tcp()/'get /index.html http/1.0 \n\n',verbose=0) print http.show() src = '10.0.0.24' dst = findweb() sendpacket(dst,src)
i'm trying http packets scapy using ubuntu on vmwaer
the problem every time send messages have reset how fix it?
thanks
few things notice wrong. 1. have sequence number set statically (seq=11) wrong. sequence numbers randomly generated , must used per rfc793. sequence should = synack[tcp].ack
you set source port 1500 during syn packet, use 1050 (typo?)
you don't need payload/push.
also, have @ these threads:
how create http request scapy?
python-scapy or like-how can create http request @ packet level
Comments
Post a Comment