How to send packets in python?

Viewed 7448

I tried this piece of code for sending packet using scapy in python

data= "University of texas at San Antonio"
a=IP(dst="129.132.2.21")/TCP()/Raw(load=data)
sendp(a)

But I'm getting error in third line "sendp(a)" saying

Traceback (most recent call last):
   File "<pyshell#7>", line 1, in <module>
     sendp(a)
   File "C:\Python25\lib\site-packages\scapy\sendrecv.py", line 259, in sendp
     __gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter, loop=loop, 
   count=count, verbose=verbose, realtime=realtime)
   File "C:\Python25\lib\site-packages\scapy\arch\pcapdnet.py", line 313, in __init__
     self.outs = dnet.eth(iface)
   File "dnet.pyx", line 112, in dnet.eth.__init__
   OSError: No such file or directory

Please let me know where am I wrong.

1 Answers
Related