
Beaengine é uma biblioteca C projetada para decodificar instruções de 16 bits, 32 bits e 64 bits Intel Architecturas. It includes standard instructions set and instructions set from FPU, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, VMX, CLMUL, AES, MPX, AVX, AVX2, AVX512 (VEX & EVEX prefixes), CET, BMI1, BMI2, SGX, UINTR, KL, TDX and AMX extensões. Se você deseja analisar códigos maliciosos e os códigos ofuscados, mais geralmente, Beaengine envia de volta uma estrutura complexa que descreve com precisão as instruções analisadas.
Você pode usá -lo em C/C ++ (utilizável e compilável com Visual Studio, GCC, Mingw, Digitalmars, Borlandc, Watcomc, Sunforte, Pelles C, LCC), em assembler (utilizável com MASM32 e MOSM64, NASM, FASM, GoMm) em C#, Python3, em Del. Você pode usá -lo no modo de usuário e no modo kernel.
Primeiro, você pode recuperar mnemônicos e operando de acordo com a sintaxe especificada: Sintaxe Intel para NASM, MASM32 e MASM64, GOASM32 e GOASM64, FASM (sem sintaxe AT&T na verdade). Em seguida, você pode realizar análises precisas sobre fluxo de dados e fluxo de controle para gerar fatias ou padrões de ofuscação.
Seu código -fonte está sob licença LGPL3 com um "construtor de makefile" e cabeçalhos para os seguintes idiomas: C/C ++, C#, Python3, Delphi, PureBasic, MASM32, MASM64, NASM (X86 e X64), FASM (x86 e x64), GoMm (x86 e x64).
Beengine é implementado usando tabelas Opcode a partir da Documentação da Intel, tabelas do site Christian Ludloff www.sandpile.org e Projeto X86Doc da Felix Cloutier https://www.felixcloutier.com
Este software é distribuído pela licença LGPL. Consulte os arquivos de cópia e cópia. Para obter mais detalhes.
#!/usr/bin/python3
from BeaEnginePython import *
instr = Disasm(bytes.fromhex('6202054000443322'))
instr.read()
print(instr.repr())
A saída é:
vpshufb zmm24, zmm31, zmmword ptr [r11+r14+0880h]
rax REGISTRO: #!/usr/bin/python3
from BeaEnginePython import *
buffer = bytes.fromhex('4831c04889fbffc04989c49031ed66586a005f80c40c')
instr = Disasm(buffer)
while instr.read() > 0:
if instr.modifies("rax"):
print(f"{instr.repr():20}rax register is modified")
else:
print(instr.repr())
A saída é:
xor rax, rax rax register is modified
mov rbx, rdi
inc eax rax register is modified
mov r12, rax
nop
xor ebp, ebp
pop ax rax register is modified
push 00000000h
pop rdi
add ah, 0Ch rax register is modified
#!/usr/bin/python3
from BeaEnginePython import *
instr = Disasm(bytes.fromhex('e90000000090e901000000cc90'))
while instr.read() > 0:
print(instr.repr())
if instr.is_jump():
instr.follow()
Vamos extrair estrutura completa de instruções:
#!/usr/bin/python3
from BeaEnginePython import *
instr = Disasm(bytes.fromhex('62017d8115443322'))
instr.read()
print(instr.json())
A saída é:
{
"repr": "vunpckhpd xmm24, xmm16, xmmword ptr [r11+r14+0220h]",
"category": "AVX512_INSTRUCTION",
"mnemonic": "vunpckhpd ",
"bytes": "62 01 7d 81 15 44 33 22",
"error": 0,
"arch": 64,
"operands": {
"1": {
"repr": "xmm24",
"type": "register",
"size": 128,
"mode": "write",
"register": {
"type": "xmm",
"value": "REG24"
}
},
"2": {
"repr": "xmm16",
"type": "register",
"size": 128,
"mode": "read",
"register": {
"type": "xmm",
"value": "REG16"
}
},
"3": {
"repr": "r11+r14+0220h",
"type": "memory",
"size": 128,
"mode": "read",
"memory": {
"base": "REG11",
"index": "REG14",
"scale": 1,
"displacement": "0x22"
}
}
},
"registers": {
"modified": {
"type": 4,
"gpr": "",
"mmx": "",
"xmm": "REG24",
"ymm": "",
"zmm": "",
"special": "",
"cr": "",
"dr": "",
"mem_management": "",
"mpx": "",
"opmask": "",
"segment": "",
"fpu": "",
"tmm": ""
},
"read": {
"type": 5,
"gpr": "REG11+REG14",
"mmx": "",
"xmm": "REG16",
"ymm": "",
"zmm": "",
"special": "",
"cr": "",
"dr": "",
"mem_management": "",
"mpx": "",
"opmask": "",
"segment": "",
"fpu": "",
"tmm": ""
}
},
"rflags": {
"of": null,
"sf": null,
"zf": null,
"af": null,
"pf": null,
"cf": null,
"tf": null,
"if": null,
"df": null,
"nt": null,
"rf": null
}
}
https://github.com/beaengine/beaengine/releases
apt install cmake
git clone https://github.com/BeaEngine/beaengine.git
cmake beaengine
make
cmake -DoptBUILD_DLL=ON beaengine
make
A documentação atual aqui explica como as estruturas de trabalho de Beengine.
A documentação antiga pode ser lida aqui: http://beatrix2004.free.fr/beaengine/index1.php
Cada lançamento de Beaengine é fornecido com documentação em PDF:
sudo apt install pandoc texlive-latex-extra
cd doc
pandoc --highlight-style tango -V mainfont="Arial" -V geometry:margin=1cm --output=beaengine.pdf beaengine.md
pandoc --highlight-style tango -V mainfont="Arial" -V geometry:margin=1cm --output=examples.pdf examples.md
Alguns exemplos básicos para mostrar como Beengine está funcionando aqui
Se você deseja melhorar Beaengine ou apenas adicionar alguns recursos privados, aqui estão alguns links: