View Issue Details

IDProjectCategoryView StatusLast Update
0000460Kali LinuxKali Package Bugpublic2013-12-04 21:40
Reporterg0tmi1k Assigned Todookie  
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
Platformx86OSKaliOS Version1.0
Fixed in Version1.0.6 
Summary0000460: binwalk - NameError: global name 'Plugins' is not defined
Description

When trying to use binwalk with a firmware, program crashes.

root@kali ~/TL-WA801ND_V2_130121$ binwalk -B wa801nv2_en_3_13_30_up_boot\(130121\).bin                                                                                                                     
Traceback (most recent call last):
  File "/usr/bin/binwalk", line 536, in <module>
    main()
  File "/usr/bin/binwalk", line 481, in main
    plugins_blacklist=plugin_blacklist)
  File "/usr/lib/pymodules/python2.7/binwalk/__init__.py", line 306, in scan
    self.plugins = Plugins(self, whitelist=plugins_whitelist, blacklist=plugins_blacklist)
NameError: global name 'Plugins' is not defined
root@kali ~/TL-WA801ND_V2_130121$

Forum posting: http://forums.kali.org/showthread.php?18082-Binwalk-Plugins-is-not-defined&p=25273&viewfull=1#post25273

Steps To Reproduce

wget http://www.tp-link.com/resources/software/TL-WA801ND_V2_130121.zip
unzip TL-WA801ND_V2_130121.zip
cd TL-WA801ND_V2_130121
binwalk -B wa801nv2_en_3_13_30_up_boot(130121).bin

Additional Information

Tested on x86 - with and without bleeding edge enabled (both times fully up-to-date)
root@kali ~$ binwalk 2>&1 | head

Binwalk v1.2.1
Craig Heffner, http://www.devttys0.com

Usage: binwalk [OPTIONS] [FILE1] [FILE2] [FILE3] ...

Signature Analysis:
    -B, --binwalk                 Perform a file signature scan (default)
    -R, --raw-bytes=<string>      Search for a custom signature
    -A, --opcodes                 Scan for executable code signatures
root@kali ~$

Activities

kdog

kdog

2013-08-27 21:13

reporter   ~0000802

I am working with the 64 bit iso but I think my comment is relevant to any of the builds. The files init.py and init.pyc in the binwalk/plugins directory are preventing the python import from finding the plugins.py file that has the definition for the Plugins class. Apparently, the import is finding the package init files first and ignoring the plugins.py file. I do not see these files in the binwalk package and I don't think they should be there. The python compile script update-python-modules creates these files during install time, thinking that this directory is supposed to be a package and thus it needs these files. Had a look at that script and you can turn that behavior off by including a file named .noinit in the plugins directory. It won't automatically create an init.py if it sees that file in the directory.

dookie

dookie

2013-12-04 21:40

reporter   ~0001124

Upgraded and fixed in binwalk_1.2.2-1-1kali0.

Thanks for the bug report and fix.

Issue History

Date Modified Username Field Change
2013-07-25 15:28 g0tmi1k New Issue
2013-08-27 21:13 kdog Note Added: 0000802
2013-12-04 21:40 dookie Note Added: 0001124
2013-12-04 21:40 dookie Status new => resolved
2013-12-04 21:40 dookie Fixed in Version => 1.0.6
2013-12-04 21:40 dookie Resolution open => fixed
2013-12-04 21:40 dookie Assigned To => dookie