
공격적 보안 개발을 위한 Nim 라이브러리
Bitmancer는 Nim으로 작성된 Windows 운영 체제용 공격적 보안(Offensive Security) 도구 개발을 위한 라이브러리입니다. 공통 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의 System 모듈에서 사용하는 전역 변수도 도입합니다. 위치 독립 코드를 위해 이러한 것들을 피하려면 제공된 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에서도 찾을 수 있습니다.