kamene
kamene copied to clipboard
get_windows_if_list ValueError: too many values to unpack (expected 2)
With python 3.4.4, used "pip3 install scapy-python3" on a Windows7 VM and I am seeing this error on "from scapy.all import *":
C:\Users\admin>pip3 list ... pip (8.1.2) scapy-python3 (0.18) ...
C:\Windows\system32>python Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import * WARNING: Windows support for scapy3k is currently in testing. Sniffing/sending/receiving packets should be working with WinPcap driver and Powershell. Create issues at https://github.com/phaethon/scapy Traceback (most recent call last): File "
", line 1, in File "C:\Python34\lib\site-packages\scapy\all.py", line 16, in from .arch import * File "C:\Python34\lib\site-packages\scapy\arch__init__.py", line 88, in from .windows import * File "C:\Python34\lib\site-packages\scapy\arch\windows__init__.py", line 198, in ifaces.load_from_powershell() File "C:\Python34\lib\site-packages\scapy\arch\windows__init__.py", line 149, in load_from_powershell for i in get_windows_if_list(): File "C:\Python34\lib\site-packages\scapy\arch\windows__init__.py", line 85, in get_windows_if_list name, value = [ j.strip() for j in i.split(b':') ] ValueError: too many values to unpack (expected 2)
Here is the output from netsh show interface: C:\Users\admin>netsh interface show interface
Admin State State Type Interface Name
Enabled Connected Dedicated Local Area Connection
After more research, it appears that my Win7 VM does not have powershell support for Get-NetAdapter:
"The term 'Get-NetAdapter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check \nthe spelling of the name, or if a path was included, verify that the path is correct and try again.\nAt line:1 char:15\n+ Get-NetAdapter <<<< | select Name, InterfaceIndex, InterfaceDescription, InterfaceGuid, MacAddress | fl\n + CategoryInfo : ObjectNotFound: (Get-NetAdapter:String) [], CommandNotFoundException\n + FullyQualifiedErrorId : CommandNotFoundException\n \n"
I only need scapy-python3 for packet assembly and dissection. In the install guide it mentioned that Win7 could be operated in "offline packet crafting/dissection". Is there a simple way to put it into that mode instead of going down the PowerShell rat hole?
Hello there, I solved this problem in Win7 with updating my PowerShell: Windows Management Framework 4.0. Link: https://www.microsoft.com/en-us/download/details.aspx?id=40855
Thanks @fjjupc for comment I was using latest PowerShell and was not aware of issues with earlier versions. @jp281, please, confirm this solves the issue for you, too, and we can close it.
After upgrading to PSVersion = 4.0, it is still failing at the same spot:

Note that this is a Windows7 VM instance running in VMWare ESX.
Well, did u reboot your instance? Please try again in the powershell after rebooting, thanks.
Yes, I tried after rebooting the Win7 VM, after uninstalling/reinstalling scapy-python3 with pip3. It still ends up with the same error. I have tried by running python 3.4.4/scapy-python3 in a command shell as Administrator and also within the powershell:

Note that if I "import scapy" and then issue "from scapy.all import *" I see a different error regarding pcapdnet:

@jp281 Has this been fixed ?
I also have this problem. installed pip3 install scapy-python3 on a windows 7 environment. I have winpcap installed, which is the problem is in the screenshot above.
That was fixed on the original version of scapy. Feel free to have a look at it