
PE to shellcode

🛠️ PEファイル(EXE/DLL)を位置非依存シェルコードに変換するための強力なツール。
pip install pefile lznt1
python clematis.py -f <PE_file> -o <output_file> [-g <true/false>] [-c <true/false>] [-p <parameters>]
# ヘルプ情報を表示
python clematis.py -h
# 基本的な使用法
python clematis.py -f target.exe -o output.bin
# 難読化と圧縮を無効化
python clematis.py -f target.exe -o output.bin -g false -c false
# ターゲットプログラムに引数を渡す
python clematis.py -f target.exe -o output.bin -p arg1 arg2
python clematis.py -f target.exe -o output.bin -p "arg1 arg2"
- 🛡️ プロセスインジェクションができない(AV/EDR/XDRによるブロック)
- 🔄 現在のプロセスでgolangプログラムを実行するとブロッキングが発生する可能性がある
- 💾 golangプログラム実行後にメモリリークが発生する可能性がある
- ⚠️ golangが作成したスレッドを解放できない!
- ✨ golangプログラムをシェルコードに変換
- 🎯 現在のプロセスで直接実行
- ♻️ 実行後にメモリを自動解放
- 🚀 golang関連のメモリ問題を完全に回避
- 🔄 golangが作成したすべてのスレッドを回収
2024-12-27
2024-12-28
DOT NETプログラムの潜在的なクラッシュを修正(発生しない場合あり)
IMAGE_DIRECTORY_ENTRY_EXCEPTION(x64)の処理を追加
APIをNTAPIに更新

Clematis は以下の手順でPEファイルをシェルコードに変換します:
flowchart TD
A[START] --> B[Read PE file]
B --> C[Parse PE structure]
C --> D{Is there a command line argument?}
D -- TRUE --> E[Process command line arguments]
D -- FALSE --> F{Enable compression?}
E --> F
F -- TRUE --> G[LZNT1 compression]
F -- FALSE --> H{Enable obfuscation?}
G --> H
H -- TRUE --> I[Execute obfuscation processing]
H -- FALSE --> J[Generate shellcode]
I --> J
J --> K[Output result]
K --> L[END]
Issue と Pull Request を歓迎します!
| desc | default | required |
|---|
| -f | --file | 変換するPEファイルへのパス | true | |
| -o | --output | 出力ファイル名 | true | |
| -g | --garble | 難読化を有効にする | true | false |
| -c | --compress | 圧縮を有効にする | true | false |
| -p | --parameter | PEファイルに渡す実行パラメータ | false |
| before | now |
|---|
VirtualAlloc | NtAllocateVirtualMemory |
VirtualProtect | NtProtectVirtualMemory |
VirtualFree | NtFreeVirtualMemory |
LoadLibrary | LdrLoadDll |
GetProcAddress | LdrGetProcedureAddress |
WaitForMultipleObjects | NtWaitForMultipleObjects |
CreateEvent | NtCreateEvent |
CloseHandle | NtClose |
SignalObjectAndWait | NtSignalAndWaitForSingleObject |
TerminateThread | NtTerminateThread |
SuspendThread | NtSuspendThread |
OpenThread | NtOpenThread |
ResumeThread | NtResumeThread |
GetContextThread | NtGetContextThread |
SetContextThread | NtSetContextThread |
| ... |
2025-1-1