Commit 08726a47 by devttys0

Merge pull request #102 from Lekensteyn/fixes

Remove java dependency and fix running binwalk from non-standard location
parents 8723f899 2b61f4f0
...@@ -56,7 +56,7 @@ Binwalk relies on multiple external utilties in order to automatically extract/d ...@@ -56,7 +56,7 @@ Binwalk relies on multiple external utilties in order to automatically extract/d
```bash ```bash
# Install standard extraction utilities # Install standard extraction utilities
$ sudo apt-get install mtd-utils gzip bzip2 tar arj lhasa p7zip p7zip-full cabextract openjdk-6-jdk cramfsprogs cramfsswap squashfs-tools $ sudo apt-get install mtd-utils gzip bzip2 tar arj lhasa p7zip p7zip-full cabextract cramfsprogs cramfsswap squashfs-tools
``` ```
```bash ```bash
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
^xz compressed data:tar:tar xJf '%e' ^xz compressed data:tar:tar xJf '%e'
^bzip2 compressed data:bz2:bzip2 -d -f '%e' ^bzip2 compressed data:bz2:bzip2 -d -f '%e'
^compress'd data:Z:gzip -d '%e' ^compress'd data:Z:gzip -d '%e'
^zip archive data:zip:jar xf '%e' # jar does a better job of unzipping than unzip does... ^zip archive data:zip:7z x -y '%e':0,1
^posix tar archive:tar:tar xvf '%e' ^posix tar archive:tar:tar xvf '%e'
^rar archive data:rar:unrar e '%e' ^rar archive data:rar:unrar e '%e'
^rar archive data:rar:unrar -x '%e' # This is for the 'free' version ^rar archive data:rar:unrar -x '%e' # This is for the 'free' version
......
...@@ -7,11 +7,19 @@ from threading import Thread ...@@ -7,11 +7,19 @@ from threading import Thread
# If installed to a custom prefix directory, binwalk may not be in # If installed to a custom prefix directory, binwalk may not be in
# the default module search path(s). Try to resolve the prefix module # the default module search path(s). Try to resolve the prefix module
# path and make it the first entry in sys.path. # path and make it the first entry in sys.path.
_module_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), # Ensure that 'src/binwalk' becomes '.' instead of an empty string
"lib", _parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
for _module_path in [
# from repo: src/scripts/ -> src/
_parent_dir,
# from build dir: build/scripts-3.4/ -> build/lib/
os.path.join(_parent_dir, "lib"),
# installed in non-default path: bin/ -> lib/python3.4/site-packages/
os.path.join(_parent_dir, "lib",
"python%d.%d" % (sys.version_info[0], sys.version_info[1]), "python%d.%d" % (sys.version_info[0], sys.version_info[1]),
"site-packages") "site-packages")
if os.path.exists(_module_path) and _module_path not in sys.path: ]:
if os.path.exists(_module_path) and _module_path not in sys.path:
sys.path = [_module_path] + sys.path sys.path = [_module_path] + sys.path
import binwalk import binwalk
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment