File tree 4 files changed +55
-0
lines changed
4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ section .text
2
+ extern printf
3
+ extern exit
4
+ global _start
5
+ ; nasm -f elf32 -o asm3.o asm3.asm
6
+ ; ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o asm3 -lc asm3.o
7
+ _start:
8
+ push 0xe54409d5
9
+ push 0xe6cf51f0
10
+ push 0xd2c26416
11
+ call asm3
12
+ add esp , 12
13
+ push eax
14
+ push fmt
15
+ call printf
16
+ add esp , 8
17
+ push 0x00
18
+ call exit
19
+ asm3:
20
+ push ebp
21
+ mov ebp , esp
22
+ xor eax , eax
23
+ mov ah , BYTE [ ebp + 0x9 ]
24
+ shl ax , 0x10
25
+ sub al , BYTE [ ebp + 0xe ]
26
+ add ah , BYTE [ ebp + 0xf ]
27
+ xor ax , WORD [ ebp + 0x12 ]
28
+ nop
29
+ pop ebp
30
+ ret
31
+
32
+ section .data
33
+ fmt: db "0x%x" , 0xa , 0x00
34
+
Original file line number Diff line number Diff line change
1
+ from pwn import p32
2
+ # Broken, use asm3.asm instead
3
+ a1 = 0xd2c26416
4
+ a2 = 0xe6cf51f0
5
+ a3 = 0xe54409d5
6
+ mem = p32 (a1 )+ p32 (a2 )+ p32 (a3 )
7
+ print (mem .hex ())
8
+ ax = 0
9
+ print (hex (ax ))
10
+ ax = mem [0x9 - 0x8 ]<< 8
11
+ print (hex (ax ))
12
+ ax <<= 0x10
13
+ print (hex (ax ))
14
+ ax = ax - (ax & 0xff )+ (((ax & 0xff )- mem [0xe - 0x8 ])% 256 )
15
+ print (hex (ax ))
16
+ ax = ax - ((ax >> 8 )& 0xff )+ (((ax >> 8 )& 0xff )+ mem [0xf - 0x8 ])% 256
17
+ print (hex (ax ))
18
+ ax ^= mem [0x12 - 0x8 ]+ mem [0x12 - 0x8 + 1 ]<< 8
19
+ print ('final' , hex (ax ))
20
+
21
+
You can’t perform that action at this time.
0 commit comments