mirror of
https://github.com/bitdefender/bddisasm.git
synced 2025-01-03 03:40:54 +00:00
Significant cleanup in disasmtool: the obsolete search functionality, and supplying registers for shemu from a file are no longer supported.
This commit is contained in:
parent
61382e95f0
commit
089e6d5e7e
Binary file not shown.
@ -27,7 +27,7 @@ def test_dir(dir):
|
|||||||
mod += ' -k'
|
mod += ' -k'
|
||||||
|
|
||||||
print(' * Running test case %s...' % f)
|
print(' * Running test case %s...' % f)
|
||||||
os.system('disasm -shemu %s -f %s >%s.temp' % (mod, f, f))
|
os.system('disasm shemu %s -f %s >%s.temp' % (mod, f, f))
|
||||||
try:
|
try:
|
||||||
res = open('%s.result' % f).read()
|
res = open('%s.result' % f).read()
|
||||||
except:
|
except:
|
||||||
@ -63,7 +63,7 @@ def regenerate(dir):
|
|||||||
mod += ' -k'
|
mod += ' -k'
|
||||||
|
|
||||||
print(' * Regenerating test case %s...' % f)
|
print(' * Regenerating test case %s...' % f)
|
||||||
os.system('disasm -exi -shemu %s -f %s >%s.result' % (mod, f, f))
|
os.system('disasm -exi shemu %s -f %s >%s.result' % (mod, f, f))
|
||||||
|
|
||||||
for f in glob.glob('%s\\*_decoded.bin' % dir):
|
for f in glob.glob('%s\\*_decoded.bin' % dir):
|
||||||
os.remove(f)
|
os.remove(f)
|
||||||
|
File diff suppressed because it is too large
Load Diff
59
disasmtool/disasmtool.h
Normal file
59
disasmtool/disasmtool.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Bitdefender
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
#ifndef DISASMTOOL_H
|
||||||
|
#define DISASMTOOL_H
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum _DISASM_COMMAND
|
||||||
|
{
|
||||||
|
commandNone = 0,
|
||||||
|
commandDecode,
|
||||||
|
commandShemu,
|
||||||
|
} DISASM_COMMAND;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum _INPUT_MODE
|
||||||
|
{
|
||||||
|
inputNone = 0,
|
||||||
|
inputFile,
|
||||||
|
inputHex
|
||||||
|
} INPUT_MODE;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _DISASM_OPTIONS
|
||||||
|
{
|
||||||
|
DISASM_COMMAND Command; // Command.
|
||||||
|
uint8_t *Buffer; // The buffer containing the instructions.
|
||||||
|
size_t Size; // Buffer size.
|
||||||
|
size_t Offset; // Offset inside the buffer.
|
||||||
|
size_t Rip; // Virtual RIP.
|
||||||
|
BOOLEAN Highlight; // Highlight instruction components, if true.
|
||||||
|
BOOLEAN ExtendedInfo; // Display extended instruction info, if true.
|
||||||
|
BOOLEAN BitFields; // Display the various bitfields inside the instruction, if true.
|
||||||
|
BOOLEAN Skip16; // Automatically jump over 16 bytes after each instruction.
|
||||||
|
BOOLEAN Stats; // Display disassembly stats (clocks / instruction, instructions / second), if true.
|
||||||
|
BOOLEAN Print; // Print instruction disassembly, if true.
|
||||||
|
uint8_t Mode; // Mode - 16, 32 or 64-bit mode.
|
||||||
|
uint8_t Ring; // Ring - 0, 1, 2 or 3.
|
||||||
|
uint8_t Vendor; // Preffered vendor.
|
||||||
|
uint8_t Feature; // Used features.
|
||||||
|
char *FileName; // Input file, if any.
|
||||||
|
size_t ShemuRegs[ND_MAX_GPR_REGS];
|
||||||
|
BOOLEAN UseShemuRegs; // If truue, the registers in ShemuRegs will be used for shemu input.
|
||||||
|
BOOLEAN BypassSelfWrites; // If true, shemu emulation will ignore self-modifications made by the shellcode.
|
||||||
|
|
||||||
|
// Internal.
|
||||||
|
INPUT_MODE InputMode;
|
||||||
|
HANDLE HandleFile;
|
||||||
|
HANDLE HandleMapping;
|
||||||
|
|
||||||
|
} DISASM_OPTIONS, *PDISASM_OPTIONS;
|
||||||
|
|
||||||
|
|
||||||
|
#define PAGE_SIZE 0x1000
|
||||||
|
#define PAGE_MASK 0xFFFFFFFFFFFFF000
|
||||||
|
|
||||||
|
|
||||||
|
#endif // DISASMTOOL_H
|
@ -307,6 +307,9 @@
|
|||||||
<Project>{3c9b2ca7-cf4f-471b-bb72-6490c476cdca}</Project>
|
<Project>{3c9b2ca7-cf4f-471b-bb72-6490c476cdca}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="disasmtool.h" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@ -19,4 +19,9 @@
|
|||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="disasmtool.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user