Chum
Binary rewriter for 64-bit PE files.
Install / Use
/learn @jonomango/ChumREADME
chum
chum is a binary rewriting tool for 64-bit PE files.
Disclaimer
This is an old, incomplete project that I have abandoned and will not be working on. It is missing several key features and just has a flawed design. It is fun to mess around with, but that's about it. Feel free to create pull-requests or whatever though.
Building
git clone --recursive https://github.com/jonomango/chum.git
cd chum
mkdir build
cd build
# Any variant of Visual Studio is fine.
cmake -G "Visual Studio 16 2019" ..
cmake --build .
Example
#include "chum.h"
#include <algorithm>
#include <random>
// Insert a NOP before every instruction.
void insert_nops(chum::binary& bin) {
for (auto const bb : bin.basic_blocks()) {
for (std::size_t i = bb->instructions.size(); i > 0; --i)
bb->insert(bin.instr("\x90"), i - 1);
}
}
// Add a call at the start of every basic block to an instrumentation function.
void instrument(chum::binary& bin) {
// Create a basic block.
auto const block = bin.create_basic_block();
block->push(bin.instr("\x90")); // NOP
block->push(bin.instr("\xC3")); // RET
for (auto const bb : bin.basic_blocks()) {
if (bb == block)
continue;
// Memory operands are replaced with symbol IDs.
// E8 00 00 00 00 CALL block
bb->insert(bin.instr("\xE8", block));
}
}
// Shuffle the order of every basic block in the binary.
void shuffle_blocks(chum::binary& bin) {
auto rd = std::random_device{};
auto rng = std::default_random_engine{ rd() };
std::shuffle(std::begin(bin.basic_blocks()), std::end(bin.basic_blocks()), rng);
}
int main() {
auto bin = chum::disassemble("hello-world-x64.dll");
if (!bin)
return 0;
insert_nops(*bin);
instrument(*bin);
shuffle_blocks(*bin);
bin->print();
bin->create("output.dll");
}
Related Skills
qqbot-channel
345.4kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.0k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
345.4kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
ddd
Guía de Principios DDD para el Proyecto > 📚 Documento Complementario : Este documento define los principios y reglas de DDD. Para ver templates de código, ejemplos detallados y guías paso
