Bug Fix: Binwalk "Global Name 'Plugins' Is Not Defined"

Recently, while trying to work with binwalk on a fresh Kali 1.0 build, I came across this error:

root@kali:~/Desktop/# binwalk XXXXXXX.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

It looks like the binwalk.plugins module is referencing something that Python doesn’t recognize, so to fix this issue, remove the following files:

/usr/lib/pymodules/python2.7/binwalk/__init__.py
/usr/lib/pymodules/python2.7/binwalk/__init__.pyc

If that still doesn’t work (or you’re using Python 2.6), remove:

/usr/lib/pymodules/python2.6/binwalk/__init__.py
/usr/lib/pymodules/python2.6/binwalk/__init__.pyc