Sending packets with Scapy within Python environment -


i playing around scapy , want use within python script sending packets seem problem. here code.

scapy shell:

send(ip(src="10.0.99.100",dst="10.1.99.100")/icmp()/"hello world") 

this works fine , sends packet.

python script:

#! /usr/bin/env python  scapy.all import sr1,ip,icmp  p=sr1(ip(src="10.0.99.100",dst="10.1.99.100")/icmp()/"hello world") 

this runs fine when tries send packet get:

warning: no route found ipv6 destination :: (no default route?) begin emission: .finished send 1 packets. ....^c received 5 packets, got 0 answers, remaining 1 packets 

when run in python environment using sr1 function. sr1 function send packet , wait answer, keeping count of received packets. see more here -

http://www.secdev.org/projects/scapy/doc/usage.html#send-and-receive-packets-sr

to behavior desire, need use send function, did when using scapy shell.

#! /usr/bin/env python  scapy.all import send, ip, icmp  send(ip(src="10.0.99.100",dst="10.1.99.100")/icmp()/"hello world") 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -