So I've been working with this code for some time now. Pretty new to Assembly language I'm trying to make this work using gcc and gdb in Kali Linux.
I'm unsure how to set breakpoints properly as well as get this program to get the desired output.
Please let me know if I'm using this incorrectly or missed something.
Thanks!
Here's what I got:
file name: "reveng.s"
.global main
.type main, @function
.intel_syntax noprefix
main:
fx:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], edi
mov eax, DWORD PTR [rbp-4]
sal eax, 3
cmp eax, 5744
sete al
movzx eax, al
pop rbp
ret
After working with this file I ran this in the terminal:
sudo gcc -c reveng.s -o reveng.o
sudo gcc reveng.o -o reveng
gdb reveng
Terminal Output:
(gdb) disas main
Dump of assembler code for function main:
0x0000555555555129 <+0>: push %rbp
0x000055555555512a <+1>: mov %rsp,%rbp
0x000055555555512d <+4>: mov %edi,-0x4(%rbp)
0x0000555555555130 <+7>: mov -0x4(%rbp),%eax
0x0000555555555133 <+10>: shl $0x3,%eax
0x0000555555555136 <+13>: cmp $0x1670,%eax
0x000055555555513b <+18>: sete %al
0x000055555555513e <+21>: movzbl %al,%eax
0x0000555555555141 <+24>: pop %rbp
0x0000555555555142 <+25>: ret
0x0000555555555143 <+26>: nopw %cs:0x0(%rax,%rax,1)
0x000055555555514d <+36>: nopl (%rax)
End of assembler dump.
(gdb) bt
No stack.
(gdb) b 0x000055555555513e
Function "0x000055555555513e" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (0x000055555555513e) pending.
(gdb) r
Starting program: /home/chaoswraith/Desktop/CTF/BCW2022/Practice/reveng
[Inferior 1 (process 57477) exited normally]
(gdb) p $eax
No registers.