python - Scapy Raw Sockets -
i try implement 3-way-hadnshake raw socket in python , using scapy.
the code is:
s=socket.socket(socket.af_packet, socket.sock_raw, socket.ipproto_tcp) ss=streamsocket(s) iph=ipheader() syn = tcp(sport=tcp_source_port,dport=tcp_destination_port, flags="s") synack = ss.sr1(iph/syn) myack = iph/tcp(dport=synack[tcp].sport, sport=synack[tcp].dport, seq=synack[tcp].ack, ack=synack[tcp].seq+1, flags="a") ss.send(myack)
ipheader() method return scapy ip header.
when running script error:
error: --- error in child 3057 traceback (most recent call last): file "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 89, in sndrcv pks.send(p) file "/usr/lib/python2.7/dist-packages/scapy/supersocket.py", line 34, in send return self.outs.send(sx) error: [errno 6] no such device or address
i see couple of possible problems code:
before invoking
streamsocket()
need establish connection regular socket. need make connection,s.connect(("10.1.1.1",9000))
before liness=streamsocket(s)
. further information can found hereyou may need correct base socket type. suggest
s=socket.socket(socket.af_inet, socket.sock_raw, socket.ipproto_tcp)
. further information check this
Comments
Post a Comment