Bitmancer 是一个用 Nim 编写的、面向 Windows 操作系统的进攻性安全工具开发库。它旨在提供通用的 API、例程和宏,并具有高度可配置、位置无关、独立的实现。
如果你正在寻找开发 Implant、测试快速 PoC 或编写全新闪亮工具,Bitmancer 可以帮助你快速入门!
⚠️ 该仓库目前是一个巨大的 WIP(正在进行中的工作)!使用它可能会出现问题,并且目前不保证稳定性。 ⚠️
Bitmancer 部分使用 winim 作为其类型。要安装,请运行:
nimble install winim
Bitmancer 尚未被纳入 nimble 仓库。目前,你只需运行以下命令即可从 Github 安装:
nimble install https://github.com/zimawhit3/Bitmancer
MingW 和 Nim 会引入对 MSVCRT 和 Kernel32 的依赖,以及 Nim 系统模块使用的全局变量。如果你想为位置无关代码避免这些依赖,请使用提供的 nim.cfg。
要编译:
nim c -d:mingw <Your_Nim_File>
对于所有模块:
import Bitmancer
如果你不需要 NTDLL 例程或系统调用,只需使用:
import Bitmancer/core
如果只需要哈希过程:
import Bitmancer/core/obfuscation/hash
如果你希望实现某个功能或技术,请告诉我!
堆栈字符串:
var wStr {.stackStringW.} = "Hello!"
var cStr {.stackStringA.} = "World!"
如果你想为当前不可用的系统调用生成包装器,基本流程如下:
## Import syscalls
import Bitmancer/syscalls
## For hashing
import Bitmancer/core/obfuscation/hash
## Define your type
type NtClose = proc(h: HANDLE): NTSTATUS {.stdcall, gcsafe.}
## Generate the wrapper
genSyscall(NtClose)
## Define configurations for how to retrieve and execute the syscall
## The procedure's symbol enumeration method - available options are:
## UseEAT - use the export address table to resolve the symbol
## UseIAT - use the import address table to resolve the symbol
## UseLdrThunks - use the NTLoader's LdrThunkSignatures to map a clean NTDLL to resolve symbols from
const symEnum = SymbolEnumeration.UseEAT
## The SSN enumeration method - available options are:
## HellsGate
## HalosGate
## TartarusGate
## ZwCounter
const ssnEnum = SsnEnumeration.HellsGate
## Finally, the execution method - available options are:
## Direct - use the direct syscall stub
## Indirect - use the indirect syscall stub
const exeEnum = SyscallExecution.Indirect
## Define an ident to use to identify the symbol
const NtCloseHash = ctDjb2 "NtClose"
## Retrive NTDLL
let Ntdll = ? NTDLL_BASE()
## Call ctGetNtSyscall, retrieving the NtSyscall object containing the SSN, pointer to the address of the function
## and a casted stub to your type.
let NtSyscall = ctGetNtSyscall[NtClose](Ntdll, ModuleHandle(NULL), NtCloseHash, symEnum, ssnEnum, exeEnum)
## Finally, call the wrapper!
NtCloseWrapper(h, NtSyscall.wSyscall, NtSyscall.pSyscall, NtSyscall.pFunction)
有关完整示例,请参阅 runShellCode 示例。
更多示例也可以在 ntdll 中找到。