totalamd totalamd -4 years ago 192
Python Question

Scapy won't start

My Scapy v2.3.3 won't start. Fresh reinstalled Python 2.7, WinPcap10 and pyreadline. Sometimes it starts after at second try in the same console.


c:\Python27\Scripts>python c:\Python27\Scripts\scapy
INFO: Can't import matplotlib. Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
Traceback (most recent call last):
File "c:\Python27\Scripts\scapy", line 26, in <module>
File "C:\Python27\lib\site-packages\scapy\", line 300, in interact
scapy_builtins = __import__("all",globals(),locals(),".").__dict__
File "C:\Python27\lib\site-packages\scapy\", line 16, in <module>
from scapy.arch import *
File "C:\Python27\lib\site-packages\scapy\arch\", line 83, in <module>
from import *
File "C:\Python27\lib\site-packages\scapy\arch\windows\", line 318, in <module>
File "C:\Python27\lib\site-packages\scapy\arch\windows\", line 270, in load_from_powershell
for i in get_windows_if_list():
File "C:\Python27\lib\site-packages\scapy\arch\windows\", line 206, in get_windows_if_list
for line in query)
File "C:\Python27\lib\site-packages\scapy\arch\windows\", line 205, in <genexpr>
(dict(zip(['name', 'win_index', 'description', 'guid', 'mac'], line))
File "C:\Python27\lib\site-packages\scapy\arch\windows\", line 53, in _exec_query_ps
l.append(line.split(':', 1)[1].strip())
IndexError: list index out of range

Answer Source

This bug was implemented in 6840d30 (v2.3.3) and fixed in a454ef4, it could be fixed by changing

l.append(line.split(':', 1)[1].strip())


 sl = line.split(':', 1)
 if len(sl) == 1:
     l[-1] += sl[0].strip()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download