Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make disassembly output AT&T syntax? #1477

Open
tyjman opened this issue Mar 22, 2024 · 1 comment
Open

Make disassembly output AT&T syntax? #1477

tyjman opened this issue Mar 22, 2024 · 1 comment

Comments

@tyjman
Copy link

tyjman commented Mar 22, 2024

Is it possible to make the disassembly engine output using the AT & T syntax?

It seems by default it outputs using the Intel syntax:

elffile = pathlib.Path('bin.elf).open('rb')
loc_db = miasm.core.locationdb.LocationDB()
container = miasm.analysis.binary.Container.from_stream(elffile, loc_db)
machine = miasm.analysis.machine.Machine(container.arch)
mdis = machine.dis_engine(container.bin_stream, loc_db=container.loc_db)
addr = container.entry_point
asmcfg = mdis.dis_multiblock(addr)
for block in asmcfg.blocks:
    print(block)

outputs

_start
ENDBR64    
XOR        EBP, EBP
MOV        R9, RDX
POP        RSI
MOV        RDX, RSP
AND        RSP, 0xFFFFFFFFFFFFFFF0
PUSH       RAX
PUSH       RSP
XOR        R8D, R8D
XOR        ECX, ECX
LEA        RDI, QWORD PTR [RIP + 0xDA]
CALL       QWORD PTR [RIP + 0x2E8B]
->	c_next:loc_1135 
loc_1135
HLT   

I would like it to look like this:

0000000000001110 <_start>:
endbr64
xor    %ebp,%ebp
mov    %rdx,%r9
pop    %rsi
mov    %rsp,%rdx
and    $0xfffffffffffffff0,%rsp
push   %rax
push   %rsp
xor    %r8d,%r8d
xor    %ecx,%ecx
lea    0xda(%rip),%rdi
call   *0x2e8b(%rip)
hlt

Are different syntaxes supported?

@serpilliere
Copy link
Contributor

Hi @tyjman !
It may be possible, but it will take some time.
If you are interested in doing it, feel free to give it a try.
But keep in mind that this code part of Miasm is, in my opinion, the least interesting/clean part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants