Chepy是一款基於CyberChef工具的Python庫&命令行實現,它是一個Python庫/命令行,實現了跟CyberChef工具相同的功能。
Chepy是一個帶有完整命令行接口的Python庫,它完整複製了CyberChef的大部分功能。開發人員在Chepy上付出了非常多的努力,並使它成功變成了基於CyberChef的Python實現,而且其中所有的代碼均採用純Python開發。Chepy跟CyberChef相比,有很多核心優勢,而且Chepy還將CyberChef中對棧的概念以不同模塊的形式仍然保留在了Chepy中。
當然了,Chepy還沒有達到完美的程度,因此還需要社區中的各位開發人員貢獻自己的力量。
工具安裝
Chepy可以通過下列幾個方式來進行安裝。
Pypi安裝
pip3 install chepy
# optionally with extra requirements
pip3 install chepy[extras]
Git安裝
git clone --recursive https://github.com/securisec/chepy.git
cd chepy
pip3 install -e .
# I use -e here so that if I update later with git pull, I dont have it install it again (unless dependencies have changed)
Docker安裝 docker run --rm -ti -v $PWD:/data securisec/chepy "some string" [somefile, "another string"] 獨立代碼
當然了,我們也可以將Chepy以獨立代碼的形式進行構建,這裡需要涉及到將所有的依賴組件封裝整合成一體。
git clone https://github.com/securisec/chepy.git
cd chepy
pip install .
pip install pyinstaller
pyinstaller cli.py --name chepy --onefile
構建完成的代碼將存儲在dist/目錄下。
插件系統-【 參考文檔】
.. toctree::
:maxdepth: 3
:caption: Contents:
usage.md
examples.md
cli.rst
chepy.md
core.md
modules.rst
extras.rst
plugins.md
pullrequest.md
config.md
faq.md
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
項目代碼庫中託管了大量Chepy插件,我們也可以根據自己的需要來用自定義插件擴展Chepy的功能。所有的Chepy插件必須繼承ChepyCore類,如需使用插件庫,請運行下列命令:
git clone https://github.com/securisec/chepy_plugins.git
然後編輯Chepy配置文件,將pluginpath設置為chepy_plugin目錄。配置文件位於$User/.chepy/chepy.conf路徑下。
下面給出的是配置文件樣本:
[Plugin]
pluginpath = /home/test/chepy_plugins
[Cli]
history_path = /home/test/.chepy/chepy_history
prompt_char = >
prompt_colors = #00ffff #ff0000 #ffd700
show_rprompt = false
prompt_rprompt = #00ff48
prompt_bottom_toolbar = #000000
prompt_toolbar_version = #00ff48
prompt_toolbar_states = #60cdd5
prompt_toolbar_buffers = #ff00ff
prompt_toolbar_type = #ffd700
prompt_toolbar_errors = #ff0000
Chepy vs Cyberchef
Chepy所實現的棧機制比CyberChef要簡單,並且是以模塊化的形式實現的。比如說,CyberChef中的棧概念如下:
但在Chepy中的形式如下:
from chepy import Chepy
file_path = "/tmp/demo/encoding"
print(
Chepy(file_path)
.load_file
.reverse
.rot_13
.base64_decode
.base32_decode
.hexdump_to_str
.o
)
優勢
1、Chepy以純Python實現,並且支持各種Python API;
2、Chepy提供了命令行接口;
3、Chepy命令行接口支持完整的自動化補全;
4、支持對PE、ELF和其他特殊文件格式進行解析;
5、可通過插件系統實現功能擴展;
6、可利用各種Python庫實現不同功能;
7、Chepy可與CyberChef Web應用程式進行交互;
8、Chepy Python庫的速度比CyberChef Node庫要快很多;
9、支持HTTP/HTTPS請求;
劣勢
1、Chepy不是一個Web應用程式;
2、Chepy沒有100%實現CyberChef的每一個功能;
3、Chepy目前還不提供magic方法;
工具使用樣例
請識別以下二維碼關注
部分文字、圖片來源於網絡,如涉及版權請聯繫刪除。