pythonscapy

Scapy IndexError: list index out of range


some of you may say that this question is already answered but it is not , scapy was working very well but suddenly i had to format my computer after that i installed everything correctly , and i get this error every time i need to print ANY information in scapy classes like IP or TCP , etc :

Traceback (most recent call last):
File "C:/Users/work/PycharmProjects/Scapy/lesson3.py", line 20, in <module>
print(send(IP(dst='192.168.100.1', ttl=(1, 4))/ICMP(),   return_packets=True).summary()) # if return_packets are True then it will   show a PacketList .
File "C:\Users\work\PycharmProjects\Scapy\venv\lib\site-packages\scapy\sendrecv.py", line 300, in send
socket = conf.L3socket(*args, **kargs)
File "C:\Users\work\PycharmProjects\Scapy\venv\lib\site-packages\scapy\arch\pcapdnet.py", line 259, in __init__
self.ins = open_pcap(iface, 1600, self.promisc, 100, monitor=monitor)
File "C:\Users\work\PycharmProjects\Scapy\venv\lib\site-packages\scapy\arch\windows\__init__.py", line 914, in open_pcap
if conf.use_npcap and isinstance(iface, NetworkInterface) and iface.ismonitor():
File "C:\Users\work\PycharmProjects\Scapy\venv\lib\site-packages\scapy\arch\windows\__init__.py", line 596, in ismonitor
return self.mode() == "monitor"
File "C:\Users\work\PycharmProjects\Scapy\venv\lib\site-packages\scapy\arch\windows\__init__.py", line 590, in mode
return POWERSHELL_PROCESS.query([_WlanHelper, self.guid[1:-1], "mode"], crp=False, rst_t=True)[0].strip()
IndexError: list index out of range

and this is the code of the program :

send(IP(dst='192.168.100.1', ttl=(1, 4))/ICMP(), return_packets=True).summary()

so every time i want to print any information i get that error like it is like stifling me and i have no idea about what is going on .


Solution

  • i fixed it , but the only thing that did not work is sniff function , but that is fine with me .. Npcap did not work on my PC , don't know why , so i have installed WinPcap 4.1.3 and it worked correctly except sniffing packets in montior mode . no need to uninstall Npcap .