资源简介
Binwalk是用于搜索给定二进制镜像文件以获取嵌入的文件和代码的工具。 具体来说,它被设计用于识别嵌入固件镜像内的文件和代码。 Binwalk使用libmagic库,因此它与Unix文件实用程序创建的魔数签名兼容。 Binwalk还包括一个自定义魔数签名文件,其中包含常见的诸如压缩/存档文件,固件头,Linux内核,引导加载程序,文件系统等的固件映像中常见文件的改进魔数签名。
代码片段和文件信息
#!/usr/bin/env python
import os
import sys
import glob
import shutil
import subprocess
from distutils.core import setup Command
from distutils.dir_util import remove_tree
MODULE_NAME = “binwalk“
MODULE_VERSION = “2.1.2“
script_NAME = MODULE_NAME
MODULE_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
VERSION_FILE = os.path.join(MODULE_DIRECTORY “src“ “binwalk“ “core“ “version.py“)
# Python3 has a built-in DEVNULL; for Python2 we have to open
# os.devnull to redirect subprocess stderr output to the ether.
try:
from subprocess import DEVNULL
except ImportError:
DEVNULL = open(os.devnull ‘wb‘)
# If this version of binwalk was checked out from the git repository
# include the git commit hash as part of the version number reported
# by binwalk.
try:
label = subprocess.check_output([“git“ “rev-parse“ “--short“ “HEAD“] stderr=DEVNULL).decode(‘utf-8‘)
MODULE_VERSION = “%s-%s“ % (MODULE_VERSION label.strip())
except KeyboardInterrupt as e:
raise e
except Exception:
pass
# Python2/3 compliance
try:
raw_input
except NameError:
raw_input = input
def which(command):
# /usr/local/bin is usually the default install path though it may not be in $PATH
usr_local_bin = os.path.sep.join([os.path.sep ‘usr‘ ‘local‘ ‘bin‘ command])
try:
location = subprocess.Popen(
[“which“ command]
shell=False stdout=subprocess.PIPE).communicate()[0].strip()
except KeyboardInterrupt as e:
raise e
except Exception as e:
pass
if not location and os.path.exists(usr_local_bin):
location = usr_local_bin
return location
def find_binwalk_module_paths():
paths = []
try:
import binwalk
paths = binwalk.__path__
except KeyboardInterrupt as e:
raise e
except Exception:
pass
return paths
def remove_binwalk_module(pydir=None pybin=None):
if pydir:
module_paths = [pydir]
else:
module_paths = find_binwalk_module_paths()
for path in module_paths:
try:
remove_tree(path)
except OSError:
pass
if not pybin:
pybin = which(MODULE_NAME)
if pybin:
try:
sys.stdout.write(“removing ‘%s‘\n“ % pybin)
os.remove(pybin)
except KeyboardInterrupt:
pass
except Exception:
pass
class IDAUnInstallCommand(Command):
description = “Uninstalls the binwalk IDA plugin module“
user_options = [
(‘idadir=‘ None ‘Specify the path to your IDA install directory.‘)
]
def initialize_options(self):
self.idadir = None
self.mydir = os.path.join(os.path.dirname(
os.path.realpath(__file__)) “src“)
def finalize_options(self):
pass
def run(self):
if self.idadir is None:
sys.stderr.write(
“Please specify the path to your IDA install directory with the ‘--idadir‘ option!
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 0 2020-07-30 22:13 2020-07-30.txt
目录 0 2018-08-06 18:33 binwalk-master\
文件 50 2018-08-06 18:33 binwalk-master\.gitignore
文件 271 2018-08-06 18:33 binwalk-master\.travis.yml
文件 6346 2018-08-06 18:33 binwalk-master\API.md
文件 4530 2018-08-06 18:33 binwalk-master\INSTALL.md
文件 1085 2018-08-06 18:33 binwalk-master\LICENSE
文件 1497 2018-08-06 18:33 binwalk-master\README.md
文件 6881 2018-08-06 18:33 binwalk-master\deps.sh
目录 0 2018-08-06 18:33 binwalk-master\images\
文件 87 2018-08-06 18:33 binwalk-master\images\README.md
文件 140144 2018-08-06 18:33 binwalk-master\images\binwalk_ida_plugin_output.png
文件 32996 2018-08-06 18:33 binwalk-master\images\binwalk_ida_plugin_usage.png
文件 11117 2018-08-06 18:33 binwalk-master\setup.py
目录 0 2018-08-06 18:33 binwalk-master\src\
目录 0 2018-08-06 18:33 binwalk-master\src\binwalk\
文件 455 2018-08-06 18:33 binwalk-master\src\binwalk\__init__.py
目录 0 2018-08-06 18:33 binwalk-master\src\binwalk\config\
文件 4227 2018-08-06 18:33 binwalk-master\src\binwalk\config\extract.conf
目录 0 2018-08-06 18:33 binwalk-master\src\binwalk\core\
文件 0 2018-08-06 18:33 binwalk-master\src\binwalk\core\__init__.py
文件 16762 2018-08-06 18:33 binwalk-master\src\binwalk\core\common.py
文件 1998 2018-08-06 18:33 binwalk-master\src\binwalk\core\compat.py
文件 9081 2018-08-06 18:33 binwalk-master\src\binwalk\core\display.py
文件 475 2018-08-06 18:33 binwalk-master\src\binwalk\core\exceptions.py
文件 4363 2018-08-06 18:33 binwalk-master\src\binwalk\core\idb.py
文件 38791 2018-08-06 18:33 binwalk-master\src\binwalk\core\magic.py
文件 34268 2018-08-06 18:33 binwalk-master\src\binwalk\core\module.py
文件 9726 2018-08-06 18:33 binwalk-master\src\binwalk\core\plugin.py
文件 7282 2018-08-06 18:33 binwalk-master\src\binwalk\core\settings.py
文件 2689 2018-08-06 18:33 binwalk-master\src\binwalk\core\statuserver.py
............此处省略79个文件信息
评论
共有 条评论