資源簡介
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個文件信息
評論
共有 條評論