rizin/test/db/cmd/cmd_pd
Rot127 f82993a30d
librz/arch: capstone v6 update (without MIPS) (#4662)
* Bumps Capstone version to newest Capstone next (beyond first v6-Alpha1).
* Fixes leaks
* Fixes build and change to AArch64 and SystemZ compatibility headers.
* Marks M68k test as broken (see commit message).
* Fix AArch64 and SystemZ tests
* Handle op.size == 0 for x86 IL ops
2024-10-25 00:07:07 +08:00

3215 lines
87 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NAME=pd varsub-issue
FILE=bins/mach0/mac-ls2
CMDS=<<EOF
s 0x100001232
e asm.bytes=true
e asm.sub.var=0
pd 1
e asm.sub.var=1
pd 1
f+ fin.dus @ 0x1000054d0
pd 1
e asm.sub.rel=0
pd 1
EOF
EXPECT=<<EOF
0x100001232 c70594420000. mov dword [rip + 0x4294], 0x50 ; 'P' ; section.10.__DATA.__data
; [0x1000054d0:4]=80 ; U"P."
0x100001232 c70594420000. mov dword [section.10.__DATA.__data], 0x50 ; 'P'
; [0x1000054d0:4]=80 ; U"P."
0x100001232 c70594420000. mov dword [fin.dus], 0x50 ; 'P'
; [0x1000054d0:4]=80 ; U"P."
0x100001232 c70594420000. mov dword [rip + 0x4294], 0x50 ; 'P' ; fin.dus
; [0x1000054d0:4]=80 ; U"P."
EOF
RUN
NAME=pd multiplemain
FILE=bins/elf/mipsloop
CMDS=pd 1 @ main~main?
EXPECT=<<EOF
1
EOF
RUN
NAME=pd V8 and Cortex-M profiles
FILE=malloc://128
ARGS=-a arm -b 16
CMDS=<<EOF
echo
pad fff7c0ea@e:asm.cpu=v8
pad fff7c0ea@e:asm.cpu=cortexm
pad fff7c0ea@e:asm.cpu=v8
pad fff7c0ea@e:asm.cpu=cortexm
pad fff7c0ea@e:asm.cpu=v8
pad fff7c0ea@e:asm.cpu=
pad fff7c0ea@e:asm.cpu=tetris
EOF
EXPECT=<<EOF
blx 0xfffff584
invalid
blx 0xfffff584
invalid
blx 0xfffff584
blx 0xfffff584
blx 0xfffff584
EOF
RUN
NAME=immstr
FILE=malloc://128
CMDS=<<EOF
e asm.bytes=true
e asm.bits=64
e asm.arch=x86
e analysis.arch=x86
wx 6833320000
e asm.imm.str=1
pd 1
EOF
EXPECT=<<EOF
0x00000000 6833320000 push 0x3233 ; '32'
EOF
RUN
NAME=pd pseudo=1 cmtright=0
FILE=malloc://128
CMDS=<<EOF
wx 4889e5
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
e asm.pseudo=1
e asm.cmtright =0
pd 1
EOF
EXPECT=<<EOF
0x00000000 4889e5 rbp = rsp
EOF
RUN
NAME=pd 0
FILE=malloc://128
CMDS=pd 0
EXPECT=<<EOF
EOF
RUN
NAME=pd 1-1
FILE=malloc://128
CMDS=pd 1-1
EXPECT=<<EOF
EOF
RUN
NAME=pd foo-33
FILE=malloc://128
CMDS=f foo @ 33;pd foo-33
EXPECT=<<EOF
EOF
RUN
NAME=pd 1
FILE=malloc://128
CMDS=<<EOF
e asm.arch=x86
e asm.bytes=true
e asm.bits=64
wx 90
e asm.lines.bb=0
b 1
pd 1
pd 1
EOF
EXPECT=<<EOF
0x00000000 90 nop
0x00000000 90 nop
EOF
RUN
NAME=pd double comma
FILE=malloc://128
CMDS=<<EOF
e asm.bytes=true
e asm.bits=64
e asm.arch=x86
e analysis.arch=x86
wx b8ffffffff
e asm.lines.bb=0
pd 1
EOF
EXPECT=<<EOF
0x00000000 b8ffffffff mov eax, 0xffffffff ; -1
EOF
RUN
NAME=pd@x:90
FILE=malloc://128
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
e asm.lines.bb=0
pd 1@x:90
EOF
EXPECT=<<EOF
0x00000000 90 nop
EOF
RUN
NAME=asm.sub.names issue
FILE=malloc://1024
CMDS=<<EOF
e asm.bytes=true
e asm.sub.names=1
e asm.arch=arm
e asm.bits=64
wx fa67bba9
pd 1
EOF
EXPECT=<<EOF
0x00000000 fa67bba9 stp x26, x25, [sp, -0x50]!
EOF
RUN
NAME=asm.sub.names issue
FILE=malloc://1024
CMDS=<<EOF
e asm.sub.names=0
e asm.bytes=true
e asm.arch=arm
e asm.bits=64
wx fa67bba9
pd 1
EOF
EXPECT=<<EOF
0x00000000 fa67bba9 stp x26, x25, [sp, -0x50]!
EOF
RUN
NAME=asm.sub.names issue #6752
FILE=malloc://1024
CMDS=<<EOF
s 0x100
wx e801000000c350c3
e asm.arch=x86
e asm.bits=64
aaaa
e asm.pseudo=true
e asm.offset=false
e asm.lines.bb=false
e asm.marks=false
e asm.nbytes=0
e asm.comments=false
e asm.flags=false
e asm.lines.fcn=false
e asm.calls=false
e asm.functions=false
e scr.color=false
f- rip
pd 1
EOF
EXPECT=<<EOF
fcn.00000106 ()
EOF
RUN
NAME=pd pseudo test for issue #7026
FILE=malloc://8
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
wx 31ed
e asm.pseudo=true
e asm.comments=true
e asm.cmtright=true
pd 1
e asm.cmtright=false
pd 1
EOF
EXPECT=<<EOF
0x00000000 31ed ebp = 0
0x00000000 31ed ebp = 0
EOF
RUN
NAME=pd pseudo test for issue #7268
FILE=malloc://8
CMDS=<<EOF
e asm.arch=x86
e asm.bytes=true
e asm.bits=64
wx 4889e5
e asm.pseudo=true
e asm.comments=true
e scr.color=1
e asm.cmt.right=true
pd 1
e asm.cmt.right=false
pd 1
EOF
EXPECT=<<EOF
0x00000000 4889e5 rbp = rsp
 0x00000000 4889e5 rbp = rsp
EOF
RUN
NAME=pd bits hint
FILE==
ARGS=-a snes
CMDS=<<EOF
e asm.bytes=true
wx a97e00
ahb 8
e scr.color=1
pd 1
EOF
EXPECT=<<EOF
0x00000000 a97e00 lda #0x007e
EOF
RUN
NAME=ASCII Recognition
FILE=malloc://1024
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=32
e scr.columns=90
wx ba3d000000
pd 1
EOF
EXPECT=<<EOF
0x00000000 ba3d000000 mov edx, 0x3d ; '='
EOF
RUN
NAME=ASCII Recognition 2
FILE=malloc://1024
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=32
e scr.columns=90
wx c6852fffffff61
pd 1
EOF
EXPECT=<<EOF
0x00000000 c6852fffffff. mov byte [ebp - 0xd1], 0x61 ; 'a'
EOF
RUN
NAME=String capstone
FILE=bins/elf/analysis/main
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.arch=x86
e asm.bits=32
e scr.columns=90
aa
pd 1 @ 0x0040050a
EOF
EXPECT=<<EOF
| 0x0040050a bfc4054000 mov edi, str.Hello_World ; 0x4005c4 ; "Hello World"
EOF
RUN
NAME=pD -10
FILE=malloc://1024
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
wx 90909090909090909090 ; s 10 ; pD -10
EOF
EXPECT=<<EOF
0x00000000 90 nop
0x00000001 90 nop
0x00000002 90 nop
0x00000003 90 nop
0x00000004 90 nop
0x00000005 90 nop
0x00000006 90 nop
0x00000007 90 nop
0x00000008 90 nop
0x00000009 90 nop
EOF
RUN
NAME=pd -10
FILE=malloc://1024
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
wx 90909090909090909090 ; s 10 ; pd -10
EOF
EXPECT=<<EOF
0x00000000 90 nop
0x00000001 90 nop
0x00000002 90 nop
0x00000003 90 nop
0x00000004 90 nop
0x00000005 90 nop
0x00000006 90 nop
0x00000007 90 nop
0x00000008 90 nop
0x00000009 90 nop
EOF
RUN
NAME=pD -9 @ 0x0040050f
FILE=bins/elf/analysis/main
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
pD -9 @ 0x0040050f
EOF
EXPECT=<<EOF
;-- main:
0x00400506 55 push rbp
0x00400507 4889e5 mov rbp, rsp
0x0040050a bfc4054000 mov edi, str.Hello_World ; 0x4005c4 ; "Hello World"
EOF
RUN
NAME=pd -3 @ 0x0040050f
FILE=bins/elf/analysis/main
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
pd -3 @ 0x0040050f
EOF
EXPECT=<<EOF
;-- main:
0x00400506 55 push rbp
0x00400507 4889e5 mov rbp, rsp
0x0040050a bfc4054000 mov edi, str.Hello_World ; 0x4005c4 ; "Hello World"
EOF
RUN
NAME=pd 10 flags and cmts without offset
FILE=bins/elf/echo-bin
CMDS=<<EOF
e asm.bytes=false
e asm.offset=false
e asm.cmt.right=0
pd 10
EOF
EXPECT=<<EOF
; [13] -r-x section size 2466 named .text
;-- entry0:
;-- section..text:
xor ebp, ebp
mov r9, rdx
pop rsi
mov rdx, rsp
and rsp, 0xfffffffffffffff0
push rax
push rsp
lea r8, [0x000011e0]
lea rcx, [0x00001170]
; 0xd7c
lea rdi, main
EOF
RUN
NAME=pda 10
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 90909090909090909090 ; pda 10
EOF
EXPECT=<<EOF
0x00000000 90 nop
0x00000001 90 nop
0x00000002 90 nop
0x00000003 90 nop
0x00000004 90 nop
0x00000005 90 nop
0x00000006 90 nop
0x00000007 90 nop
0x00000008 90 nop
0x00000009 90 nop
EOF
RUN
NAME=pdj -1
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 56687cd3400090
aaa
s 6
pdj -1
EOF
EXPECT=<<EOF
[{"offset":1,"ptr":4248444,"val":4248444,"esil":"4248444,4,esp,-,=[4],4,esp,-=","refptr":false,"fcn_addr":0,"fcn_last":1020,"size":5,"opcode":"push 0x40d37c","disasm":"push 0x40d37c","bytes":"687cd34000","family":"cpu","type":"push","reloc":false,"type_num":13,"type2_num":0}]
EOF
RUN
NAME=pdj 3 @ main
FILE=bins/elf/analysis/main
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
pdj 3 @ main
EOF
EXPECT=<<EOF
[{"offset":4195590,"esil":"rbp,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":1,"opcode":"push rbp","disasm":"push rbp","bytes":"55","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["main","sym.main"]},{"offset":4195591,"esil":"rsp,rbp,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"mov rbp, rsp","disasm":"mov rbp, rsp","bytes":"4889e5","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":4195594,"ptr":4195780,"val":4195780,"esil":"4195780,rdi,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov edi, 0x4005c4","disasm":"mov edi, str.Hello_World","bytes":"bfc4054000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0}]
EOF
RUN
NAME=pdj -3 @ 0x0040050f
FILE=bins/elf/analysis/main
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
pdj -3 @ 0x0040050f
EOF
EXPECT=<<EOF
[{"offset":4195590,"esil":"rbp,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":1,"opcode":"push rbp","disasm":"push rbp","bytes":"55","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["main","sym.main"]},{"offset":4195591,"esil":"rsp,rbp,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"mov rbp, rsp","disasm":"mov rbp, rsp","bytes":"4889e5","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":4195594,"ptr":4195780,"val":4195780,"esil":"4195780,rdi,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov edi, 0x4005c4","disasm":"mov edi, str.Hello_World","bytes":"bfc4054000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0}]
EOF
RUN
NAME=pdj str in opcode
FILE=bins/java/Hello.class
CMDS=pdj 1 @ 0x000002ae
EXPECT=<<EOF
[{"offset":686,"esil":"","refptr":false,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"ldc constant_pool.11","disasm":"ldc constant_pool.11","bytes":"120b","family":"cpu","type":"load","reloc":false,"type_num":32,"type2_num":0}]
EOF
RUN
NAME=pdfline
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
e analysis.eobjmp=true
wx ff2572962100
af
pdf~jmp[0]
afi~size[1]
EOF
EXPECT=<<EOF
\
6
EOF
RUN
NAME=pdfline 2
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
e analysis.eobjmp=false
wx ff2572962100
af
afi~size[1]
EOF
EXPECT=<<EOF
6
EOF
RUN
NAME=pdfline defaults
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wa "jmp rax"
af
afi~size[1]
EOF
EXPECT=<<EOF
2
EOF
RUN
NAME=pd asm.bytes and asm.lbytes
FILE=malloc://1024
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
wx 488d85c0f9ffff488985b8f9ffff4585f6
e asm.lines.bb=false
e asm.lbytes=true
e asm.nbytes=6
pd 3
e asm.nbytes=10
pd 3
e asm.lbytes=false
pd 3
e asm.nbytes=6
pd 3
EOF
EXPECT=<<EOF
0x00000000 488d85c0f9ff. lea rax, [rbp - 0x640]
0x00000007 488985b8f9ff. mov qword [rbp - 0x648], rax
0x0000000e 4585f6 test r14d, r14d
0x00000000 488d85c0f9ffff lea rax, [rbp - 0x640]
0x00000007 488985b8f9ffff mov qword [rbp - 0x648], rax
0x0000000e 4585f6 test r14d, r14d
0x00000000 488d85c0f9ffff lea rax, [rbp - 0x640]
0x00000007 488985b8f9ffff mov qword [rbp - 0x648], rax
0x0000000e 4585f6 test r14d, r14d
0x00000000 488d85c0f9ff. lea rax, [rbp - 0x640]
0x00000007 488985b8f9ff. mov qword [rbp - 0x648], rax
0x0000000e 4585f6 test r14d, r14d
EOF
RUN
NAME=pd asm.sub.rel
FILE=malloc://1024
ARGS=-m 0x400000
CMDS=<<EOF
e asm.bytes=true
e io.va=true
e asm.sub.rel=false
e asm.arch=x86
e asm.bits=64
wx 488d0502000000
e asm.lines.bb=false
e asm.comments=false
pd 1
e asm.sub.rel=true
pd 1
EOF
EXPECT=<<EOF
0x00400000 488d05020000. lea rax, [rip + 2]
0x00400000 488d05020000. lea rax, [0x00400009]
EOF
RUN
NAME=pd asm.sub.varonly
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
e asm.sub.var=true
e asm.lines.bb=false
e asm.bytes=false
e asm.comments=false
e asm.lines.fcn=false
e asm.offset=false
e scr.color=false
wx 554889e583ec60488b44244089ec5dc3
af
afva
e asm.sub.varonly=true
pd 1 @ 0~var
pd 1 @ 7
e asm.sub.varonly=false
pd 1 @ 0~var
pd 1 @ 7
EOF
EXPECT=<<EOF
; var int64_t var_28h @ stack - 0x28
mov rax, qword [var_28h]
; var int64_t var_28h @ stack - 0x28
mov rax, qword [rsp + var_28h]
EOF
RUN
NAME=pd wide string
FILE=bins/pe/c.exe
CMDS=<<EOF
e io.cache=true
s 0x403000
wx 4d00 5900 5200 4500 5300 0000
s 0x00401334
pd 1~MYRES?
EOF
EXPECT=<<EOF
1
EOF
RUN
NAME=pds change name
FILE=bins/mach0/mac-ls
CMDS=<<EOF
e asm.flags=false
s sym.func.100004401
af
afn newname
s entry0
pds 0x420
EOF
EXPECT=<<EOF
0x100001085 call newname
0x100001093 call sym.imp.setlocale
0x1000010a3 call sym.imp.isatty
0x1000054e0 [10] -rw- section size 40 named 10.__DATA.__data
0x1000010b6 str.COLUMNS
0x1000010bd call sym.imp.getenv
0x1000010cf call sym.imp.atoi
0x1000010e6 call sym.imp.ioctl
0x10000110d str.COLUMNS
0x100001114 call sym.imp.getenv
0x100001121 call sym.imp.atoi
0x10000112c call sym.imp.getuid
0x10000116e call newname
0x100001179 str.1_ABCFGHLOPRSTUWabcdefghiklmnopqrstuvwx
0x100001186 call sym.imp.getopt
0x100001233 str.CLICOLOR
0x100001246 call sym.imp.setenv
0x100001253 str.bin_ls
0x10000125a str.Unix2003
0x100001261 call sym.imp.compat_mode
0x10000128c str.bin_ls
0x100001293 str.Unix2003
0x10000129a call sym.imp.compat_mode
0x1000013a2 str.bin_ls
0x1000013a9 str.Unix2003
0x1000013b0 call sym.imp.compat_mode
0x1000013d3 str.bin_ls
0x1000013da str.Unix2003
0x1000013e1 call sym.imp.compat_mode
0x10000143a str.bin_ls
0x100001441 str.Unix2003
0x100001448 call sym.imp.compat_mode
0x10000145a str.bin_ls
0x100001461 str.Unix2003
0x100001468 call sym.imp.compat_mode
EOF
RUN
NAME=pdf fcnline
FILE=bins/pe/a.exe
CMDS=<<EOF
e asm.bytes=true
e asm.lines.fcn=true
s 0x004017c0
af+ fcn2.0x004017c0 @ 0x004017c0
afb+ 0x4017c0 0x4017c0 13 0x4017dd 0x4017cd
pdf
echo
e asm.lines.fcn=false
pdf
EOF
EXPECT=<<EOF
/ fcn2.0x004017c0();
| 0x004017c0 51 push ecx
| 0x004017c1 89e1 mov ecx, esp
| 0x004017c3 83c108 add ecx, 8
| 0x004017c6 3d00100000 cmp eax, 0x1000
\ ,=< 0x004017cb 7210 jb 0x4017dd
fcn2.0x004017c0();
0x004017c0 51 push ecx
0x004017c1 89e1 mov ecx, esp
0x004017c3 83c108 add ecx, 8
0x004017c6 3d00100000 cmp eax, 0x1000
,=< 0x004017cb 7210 jb 0x4017dd
EOF
RUN
NAME=pdf fcnline with size
FILE=bins/pe/a.exe
CMDS=<<EOF
e asm.bytes=true
e asm.lines.fcn=true
s 0x004017c0
af+ fcn2.0x004017c0 @ 0x004017c0
afb+ 0x4017c0 0x4017c0 13 0x4017dd 0x4017cd
pdf
echo
e asm.lines.fcn=false
e asm.fcn.size=true
pdf
EOF
EXPECT=<<EOF
/ fcn2.0x004017c0();
| 0x004017c0 51 push ecx
| 0x004017c1 89e1 mov ecx, esp
| 0x004017c3 83c108 add ecx, 8
| 0x004017c6 3d00100000 cmp eax, 0x1000
\ ,=< 0x004017cb 7210 jb 0x4017dd
13: fcn2.0x004017c0();
0x004017c0 51 push ecx
0x004017c1 89e1 mov ecx, esp
0x004017c3 83c108 add ecx, 8
0x004017c6 3d00100000 cmp eax, 0x1000
,=< 0x004017cb 7210 jb 0x4017dd
EOF
RUN
NAME=rz_str_escape anal
FILE=bins/pe/a.exe
CMDS=<<EOF
e asm.bytes=true
pd 1 @ 0x00401322
EOF
EXPECT=<<EOF
0x00401322 c70424043040. mov dword [esp], 0x403004 ; [0x403004:4]=0xa7025 ; "%p\n"
EOF
RUN
NAME=rz_str_escape io + no 'u' prefix for single-char strings
FILE=bins/pe/testapp-msvc64.exe
CMDS=<<EOF
e asm.bytes=true
pd 1 @ 0x140001034
pd 1 @ 0x140001070
EOF
EXPECT=<<EOF
0x140001034 488d05495001. lea rax, [0x140016084] ; "\r"
0x140001070 488d053d5001. lea rax, [0x1400160b4] ; "a"
EOF
RUN
NAME=rz_str_escape analysis addr
FILE=bins/pe/cmd_adf_sample0.exe
CMDS=<<EOF
e asm.bytes=true
pd 1 @ 0x0040116a
EOF
EXPECT=<<EOF
0x0040116a 6828304000 push 0x403028 ; '(0@' ; "End\r\n"
EOF
RUN
NAME=no rep flag in cmt with gen str flag (lea)
FILE=bins/elf/analysis/ls-alxchk
CMDS=<<EOF
e asm.bytes=true
e asm.cmt.right=true
pd 1 @ 0x0001145f
e asm.cmt.right=false
pd 1 @ 0x0001145f
EOF
EXPECT=<<EOF
0x0001145f 488d3d72a100. lea rdi, str.A_NULL_argv_0__was_passed_through_an_exec_system_call. ; 0x1b5d8 ; "A NULL argv[0] was passed through an exec system call.\n"
; 0x1b5d8
; "A NULL argv[0] was passed through an exec system call.\n"
0x0001145f 488d3d72a100. lea rdi, str.A_NULL_argv_0__was_passed_through_an_exec_system_call.
EOF
RUN
NAME=flag in cmt with manual flag (lea)
FILE=bins/elf/analysis/ls-alxchk
CMDS=<<EOF
f- @ 0x1b5d8
f NULL_error 56 @ 0x1b5d8
e asm.cmt.right=true
e asm.bytes=true
pd 1 @ 0x0001145f
e asm.cmt.right=false
pd 1 @ 0x0001145f
EOF
EXPECT=<<EOF
0x0001145f 488d3d72a100. lea rdi, [NULL_error] ; 0x1b5d8 ; "A NULL argv[0] was passed through an exec system call.\n"
; 0x1b5d8
; "A NULL argv[0] was passed through an exec system call.\n"
0x0001145f 488d3d72a100. lea rdi, [NULL_error]
EOF
RUN
NAME=no rep flag in cmt with gen str flag (push)
FILE=bins/pe/ConsoleApplication1.exe
CMDS=<<EOF
e asm.bytes=true
e asm.cmt.right=true
pd 1 @ 0x004010f0
e asm.cmt.right=false
pd 1 @ 0x004010f0
EOF
EXPECT=<<EOF
0x004010f0 68b8214000 push str.Number_of_CPU__d ; 0x4021b8 ; u"Number of CPU %d\n"
; 0x4021b8
; u"Number of CPU %d\n"
0x004010f0 68b8214000 push str.Number_of_CPU__d
EOF
RUN
NAME=flag in cmt with manual flag (push)
FILE=bins/pe/ConsoleApplication1.exe
CMDS=<<EOF
e asm.bytes=true
f- @ 0x4021b8
f num_cpu 36 @ 0x4021b8
e asm.cmt.right=true
pd 1 @ 0x004010f0
e asm.cmt.right=false
pd 1 @ 0x004010f0
EOF
EXPECT=<<EOF
0x004010f0 68b8214000 push 0x4021b8 ; num_cpu ; u"Number of CPU %d\n"
; num_cpu
; u"Number of CPU %d\n"
0x004010f0 68b8214000 push 0x4021b8
EOF
RUN
NAME=no rep flag in cmt with gen sym flag (mov)
FILE=bins/pe/ConsoleApplication1.exe
CMDS=<<EOF
e asm.bytes=true
e asm.cmt.right=true
pd 1 @ 0x004010fa
e asm.cmt.right=false
pd 1 @ 0x004010fa
EOF
EXPECT=<<EOF
0x004010fa 8b3500204000 mov esi, dword [sym.imp.KERNEL32.dll_GetLastError] ; [0x402000:4]=0x29f4 reloc.KERNEL32.dll_GetLastError
; [0x402000:4]=0x29f4 reloc.KERNEL32.dll_GetLastError
0x004010fa 8b3500204000 mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
EOF
RUN
NAME=flag in cmt with manual flag (mov)
FILE=bins/pe/ConsoleApplication1.exe
CMDS=<<EOF
e asm.bytes=true
f- @ 0x402000
f ptr_GetLastError 0 @ 0x402000
e asm.cmt.right=true
pd 1 @ 0x004010fa
e asm.cmt.right=false
pd 1 @ 0x004010fa
EOF
EXPECT=<<EOF
0x004010fa 8b3500204000 mov esi, dword [ptr_GetLastError] ; [0x402000:4]=0x29f4 reloc.KERNEL32.dll_GetLastError
; [0x402000:4]=0x29f4 reloc.KERNEL32.dll_GetLastError
0x004010fa 8b3500204000 mov esi, dword [ptr_GetLastError]
EOF
RUN
NAME=pd asm.sub.names color
FILE=bins/elf/analysis/ls-alxchk
CMDS=<<EOF
e asm.bytes=false
e asm.comments=false
e scr.color=1
e asm.sub.names=true
pd 1 @ 0x0001145f
e asm.sub.names=false
pd 1 @ 0x0001145f
EOF
EXPECT=<<EOF
0x0001145f lea rdi, str.A_NULL_argv_0__was_passed_through_an_exec_system_call.
0x0001145f lea rdi, [0x0001b5d8]
EOF
RUN
NAME=ANSI and wide string flag cmts
FILE=bins/pe/testapp-msvc64.exe
CMDS=<<EOF
e asm.bytes=true
e str.escbslash=false
e asm.cmt.right=true
pd 1 @ 0x140001004
pd 1 @ 0x140001010
pd 1 @ 0x14000101c
e asm.cmt.right=false
pd 1 @ 0x140001004
pd 1 @ 0x140001010
pd 1 @ 0x14000101c
EOF
EXPECT=<<EOF
0x140001004 488d05f54f01. lea rax, str.ANSI_esc:___33m ; section..data
; 0x140016000 ; "\tANSI\esc: \e[33m\r\n"
0x140001010 488d05015001. lea rax, str.wide_esc:___0m ; 0x140016018 ; u"\twide\esc: \e[0m\xa1\r\n"
0x14000101c 488d051d5001. lea rax, str.wide__in_Arabic: ; 0x140016040 ; u"\"wide\" in Arabic: \u0648\u0627\u0633\u0639"
; section..data
; 0x140016000
; "\tANSI\esc: \e[33m\r\n"
0x140001004 488d05f54f01. lea rax, str.ANSI_esc:___33m
; 0x140016018
; u"\twide\esc: \e[0m\xa1\r\n"
0x140001010 488d05015001. lea rax, str.wide_esc:___0m
; 0x140016040
; u"\"wide\" in Arabic: \u0648\u0627\u0633\u0639"
0x14000101c 488d051d5001. lea rax, str.wide__in_Arabic:
EOF
RUN
NAME=no ffffff test for issue #7755
FILE=bins/pe/testapp-msvc64.exe
CMDS=<<EOF
e asm.bytes=true
pd 1 @ 0x140001040
EOF
EXPECT=<<EOF
0x140001040 488d05415001. lea rax, [0x140016088] ; u"r2 \u1308\u23f4\u23f4"
EOF
RUN
NAME=asm.asciidot
FILE=bins/elf/strenc
CMDS=<<EOF
e asm.bytes=false
e asm.cmt.off=false
e str.escbslash=true
e str.search.encoding=8bit
e scr.strconv=asciiesc
pd 1 @ 0x0040169d
e scr.strconv=asciidot
pd 1 @ 0x0040169d
e asm.sub.names=false
e asm.noisy=false
pd 1 @ 0x00401693
e str.search.encoding=utf8
pd 1 @ 0x00401693
e str.search.encoding=utf16le
pd 1 @ 0x004016ac
e str.search.encoding=utf32le
pd 1 @ 0x004016ed
pd 1 @ 0x004016f7
EOF
EXPECT=<<EOF
0x0040169d mov esi, str.see ; "see \xdab\xbee\xace\xcaf\n"
0x0040169d mov esi, str.see ; "see .b.e.e.f\n"
0x00401693 mov edi, 0x4021ff ; "utf8> \\u00a2\\u20ac\\U00010348 in yellow:\e[33m ......... \e[0m\n"
0x00401693 mov edi, 0x4021ff ; "utf8> \\u00a2\\u20ac\\U00010348 in yellow:.[33m ... .[0m."
0x004016ac mov edi, 0x40224a ; 'J"@' ; u"utf16le> \\u00a2\\u20ac\\U00010348 in green:.[32m ... .[0m."
0x004016ed mov edi, 0x40258c ; U"utf32le> \\u00a2\\u20ac\\U00010348 in cyan:.[36m ... .[0m."
0x004016f7 mov edi, 0x40266c ; U"Mountain range with embedded quad zeros: .A.A.A."
EOF
RUN
NAME=str.search.encoding utf8
FILE=bins/elf/strenc
CMDS=<<EOF
e asm.bytes=false
e asm.sub.names=false
e asm.noisy=false
e str.escbslash=true
e str.search.encoding=utf8
pd 1 @ 0x00401693
e str.search.encoding=8bit
pd 1 @ 0x00401693
e str.search.encoding=guess
pd 1 @ 0x00401693
EOF
EXPECT=<<EOF
0x00401693 mov edi, 0x4021ff ; "utf8> \\u00a2\\u20ac\\U00010348 in yellow:\e[33m \u00a2\u20ac\U00010348 \e[0m\n"
0x00401693 mov edi, 0x4021ff ; "utf8> \\u00a2\\u20ac\\U00010348 in yellow:\e[33m \xc2\xa2\xe2\x82\xac\xf0\x90\x8d\x88 \e[0m\n"
0x00401693 mov edi, 0x4021ff ; "utf8> \\u00a2\\u20ac\\U00010348 in yellow:\e[33m \u00a2\u20ac\U00010348 \e[0m\n"
EOF
RUN
NAME=str.search.encoding 8bit
FILE=bins/pe/testapp-msvc64.exe
CMDS=<<EOF
e asm.sub.names=false
e asm.bytes=true
e asm.noisy=false
e str.search.encoding=8bit
pd 1 @ 0x140001058
e str.search.encoding=utf8
pd 1 @ 0x140001058
EOF
EXPECT=<<EOF
0x140001058 488d05415001. lea rax, [0x1400160a0] ; "latin1 gate: \xce\xbb\xab\xce"
0x140001058 488d05415001. lea rax, [0x1400160a0] ; "latin1 gate: \u03bb\xab\xce"
EOF
RUN
NAME=str.search.encoding utf16le
FILE=bins/elf/strenc
CMDS=<<EOF
e asm.bytes=false
e asm.sub.names=false
e asm.noisy=false
e str.escbslash=true
e str.search.encoding=guess
pd 1 @ 0x004016ac
e asm.sub.names=true
e asm.cmt.off=false
e str.search.encoding=guess
pd 1 @ 0x004016b6
e str.search.encoding=utf16le
pd 1 @ 0x004016b6
e str.search.encoding=guess
pd 1 @ 0x004016c0
e str.search.encoding=utf16le
pd 1 @ 0x004016c0
pd 1 @ 0x004016ca
pd 1 @ 0x004016d4
EOF
EXPECT=<<EOF
0x004016ac mov edi, 0x40224a ; 'J"@' ; u"utf16le> \\u00a2\\u20ac\\U00010348 in green:\e[32m \xa2\u20ac\U00010348 \e[0m\n"
0x004016b6 mov edi, str.e_e_b ; "_%e%e%b% "
0x004016b6 mov edi, str.e_e_b ; u"\u255f\u2565\u2565\u2562 is a wall with no embedded zeros\n"
0x004016c0 mov edi, 0x40230c
0x004016c0 mov edi, 0x40230c ; u"\u2520\u2542\u2500\u2500\u2542\u2528 is a fence with embedded zeros\n"
0x004016ca mov edi, 0x40235a ; 'Z#@' ; u"\u2520\u2542-\u2500-\u2500\u2542\u2528 is a fence with embedded double zeros\n"
0x004016d4 mov edi, str.e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k_e_e_e_e_e_e_e_e_e_k ; u"\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u256b\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u256b\u2565\u"
EOF
RUN
NAME=str.search.encoding utf32le
FILE=bins/elf/strenc
CMDS=<<EOF
e asm.bytes=false
e asm.cmt.off=false
e str.escbslash=true
e str.search.encoding=utf16le
pd 1 @ 0x004016de
e str.search.encoding=utf32le
pd 1 @ 0x004016de
e asm.sub.names=false
e asm.noisy=false
e str.search.encoding=guess
pd 1 @ 0x004016ed
pd 1 @ 0x004016f7
pd 1 @ 0x00401701
e str.search.encoding=utf32le
pd 1 @ 0x00401701
EOF
EXPECT=<<EOF
0x004016de mov esi, str.Linux_wide_esc:___0m ; u"\t"
0x004016de mov esi, str.Linux_wide_esc:___0m ; U"\tLinux_wide\\esc: \e[0m\xa1\r\n"
0x004016ed mov edi, 0x40258c ; U"utf32le> \\u00a2\\u20ac\\U00010348 in cyan:\e[36m \xa2\u20ac\U00010348 \e[0m\n"
0x004016f7 mov edi, 0x40266c ; U"Mountain range with embedded quad zeros: \U00010300A\U00010300A\U00010300A\n"
0x00401701 mov edi, 0x402730 ; '0'@' ; "e%"
0x00401701 mov edi, 0x402730 ; '0'@' ; U"\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u256b\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u2565\u256b\u2565\u"
EOF
RUN
NAME=str.search.encoding guess utf16le
FILE=bins/pe/testapp-msvc64.exe
CMDS=<<EOF
e asm.bytes=true
e asm.sub.names=false
e asm.noisy=false
e str.search.encoding=guess
pd 1 @ 0x14000104c
e str.search.encoding=utf16le
pd 1 @ 0x14000104c
EOF
EXPECT=<<EOF
0x14000104c 488d05455001. lea rax, [0x140016098] ; "@"
0x14000104c 488d05455001. lea rax, [0x140016098] ; u"@\ufffd\ud801"
EOF
RUN
NAME=str.search.encoding guess utf32le
FILE=bins/elf/strenc-guess-utf32le
CMDS=<<EOF
e asm.cmt.off=false
e asm.bytes=false
e str.search.encoding=guess
pd 1 @ 0x00400463
e str.search.encoding=utf32le
pd 1 @ 0x00400463
EOF
EXPECT=<<EOF
0x00400463 mov edi, str.ABCDEF ; "A"
0x00400463 mov edi, str.ABCDEF ; U"ABCDEF\U0010ffff G\U00110000 H\U7ffdfeff\n"
EOF
RUN
NAME=str.search.encoding alias
FILE=bins/elf/strenc
CMDS=<<EOF
e asm.sub.names=false
e asm.noisy=false
e asm.bytes=false
e asm.cmt.off=false
e str.escbslash=true
(test_str.enc enc; e str.search.encoding=${enc}; e str.search.encoding)
.(test_str.enc guess)
.(test_str.enc utf8)
.(test_str.enc utf16le)
pd 1 @ 0x004016c0
.(test_str.enc utf32le)
pd 1 @ 0x004016ed
echo
.(test_str.enc UTF32BE)
.(test_str.enc UTF16LE)
EOF
EXPECT=<<EOF
guess
utf8
utf16le
0x004016c0 mov edi, 0x40230c ; u"\u2520\u2542\u2500\u2500\u2542\u2528 is a fence with embedded zeros\n"
utf32le
0x004016ed mov edi, 0x40258c ; U"utf32le> \\u00a2\\u20ac\\U00010348 in cyan:\e[36m \xa2\u20ac\U00010348 \e[0m\n"
utf32be
utf16le
EOF
RUN
NAME=str.search.encoding error handling
FILE==
CMDS=<<EOF
(test_str.enc enc; e str.search.encoding=${enc}; e str.search.encoding)
.(test_str.enc UTF32LE)
.(test_str.enc cat_sat_on_keyboard)
.(test_str.enc CAT_SAT_ON_KEYBOARD)
EOF
EXPECT=<<EOF
utf32le
utf32le
utf32le
EOF
EXPECT_ERR=<<EOF
ERROR: Invalid value for str.search.encoding (cat_sat_on_keyboard).
ERROR: Invalid value for str.search.encoding (CAT_SAT_ON_KEYBOARD).
EOF
RUN
NAME=hide flag iff unchanged and string shown
FILE=bins/pe/testapp-msvc64.exe
CMDS=<<EOF
e asm.bytes=true
e asm.sub.names=false
e asm.noisy=false
e str.escbslash=false
e asm.cmt.right=true
pd 1 @ 0x140001010
pd 1 @ 0x140001028
e asm.cmt.right=false
pd 1 @ 0x140001010
pd 1 @ 0x140001028
fr str.wide_esc:___0m str.wide
e asm.cmt.right=true
pd 1 @ 0x140001010
e asm.cmt.right=false
pd 1 @ 0x140001010
EOF
EXPECT=<<EOF
0x140001010 488d05015001. lea rax, [0x140016018] ; u"\twide\esc: \e[0m\xa1\r\n"
0x140001028 488d05415001. lea rax, [0x140016070] ; str.Formfeed_at_start
; u"\twide\esc: \e[0m\xa1\r\n"
0x140001010 488d05015001. lea rax, [0x140016018]
; str.Formfeed_at_start
0x140001028 488d05415001. lea rax, [0x140016070]
0x140001010 488d05015001. lea rax, [0x140016018] ; str.wide ; u"\twide\esc: \e[0m\xa1\r\n"
; str.wide
; u"\twide\esc: \e[0m\xa1\r\n"
0x140001010 488d05015001. lea rax, [0x140016018]
EOF
RUN
NAME=asm.noisy
FILE=bins/pe/testapp-msvc64.exe
CMDS=<<EOF
e asm.sub.names=false
e asm.bytes=true
e asm.noisy=true
e str.escbslash=false
e asm.cmt.right=true
pd 1 @ 0x140001010
e asm.cmt.right=false
pd 1 @ 0x140001010
EOF
EXPECT=<<EOF
0x140001010 488d05015001. lea rax, [0x140016018] ; str.wide_esc:___0m ; u"\twide\esc: \e[0m\xa1\r\n"
; str.wide_esc:___0m
; u"\twide\esc: \e[0m\xa1\r\n"
0x140001010 488d05015001. lea rax, [0x140016018]
EOF
RUN
NAME=fcn name cmt alignment
FILE=bins/pe/ConsoleApplication1.exe
CMDS=<<EOF
e asm.bytes=true
e asm.sub.names=false
af @ main
pd 1 @ 0x00401157
EOF
EXPECT=<<EOF
| 0x00401157 e8b4feffff call fcn.00401010
EOF
RUN
NAME=call asm.sub.names=false flag cmt
FILE=bins/pe/ConsoleApplication1.exe
CMDS=<<EOF
e asm.bytes=true
e asm.sub.names=false
e asm.cmt.right=true
pd 1 @ 0x004010c6
e asm.cmt.right=false
pd 1 @ 0x004010c6
EOF
EXPECT=<<EOF
0x004010c6 ff1508204000 call dword [0x402008] ; sym.imp.KERNEL32.dll_GetProcAddress ; " *" ; FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName)
; sym.imp.KERNEL32.dll_GetProcAddress
; " *"
; FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName)
0x004010c6 ff1508204000 call dword [0x402008]
EOF
RUN
NAME=asm.cmt.off
FILE=bins/pe/testapp-msvc64.exe
CMDS=<<EOF
e asm.noisy=false
e asm.bytes=true
e str.escbslash=false
e asm.sub.names=true
e asm.cmt.off=false
pd 1 @ 0x140001010
e asm.sub.names=false
e asm.cmt.off=true
pd 1 @ 0x140001010
e asm.cmt.off=nodup
pd 1 @ 0x140001010
EOF
EXPECT=<<EOF
0x140001010 488d05015001. lea rax, str.wide_esc:___0m ; u"\twide\esc: \e[0m\xa1\r\n"
0x140001010 488d05015001. lea rax, [0x140016018] ; 0x140016018 ; u"\twide\esc: \e[0m\xa1\r\n"
0x140001010 488d05015001. lea rax, [0x140016018] ; u"\twide\esc: \e[0m\xa1\r\n"
EOF
RUN
NAME=no | highlight with asm.cmt.right=false & call statement
FILE=bins/pe/ConsoleApplication1.exe
CMDS=<<EOF
e asm.bytes=false
e scr.color=1
e asm.cmt.right=false
s main
af
pd 2 @ 0x004010e8
EOF
EXPECT=<<EOF
| 0x004010e8 push esi
| ; 0x402004
| ; DWORD GetCurrentProcessorNumber(void)
| 0x004010e9 call dword [sym.imp.KERNEL32.dll_GetCurrentProcessorNumber]
EOF
RUN
NAME=varsub for rip variable
FILE=bins/elf/varsub_2
CMDS=<<EOF
aa; s main
e asm.syntax=att
e asm.var=0
e asm.lines.bb=0
e asm.bytes=0
e asm.comments=false
pdf
EOF
EXPECT=<<EOF
/ int main(int argc, char **argv, char **envp);
| 0x0000061a pushq %rbp
| 0x0000061b movq %rsp, %rbp
| 0x0000061e movl $1, obj.sa
| 0x00000628 movl $0, %eax
| 0x0000062d popq %rbp
\ 0x0000062e retq
EOF
RUN
NAME=utf16le string with byte order mark
FILE=bins/elf/7786-utf16le
CMDS=<<EOF
e asm.bytes=false
pd 1 @ 0x004004ee
EOF
EXPECT=<<EOF
0x004004ee mov edi, str.S ; 0x4005c0 ; u"\ufeff--> %S\ufeff\n"
EOF
RUN
NAME=show string at src if dst is stack (x86_cs MOV)
FILE=bins/elf/7786-utf16le
CMDS=<<EOF
e asm.bytes=false
pd 1 @ 0x004004df
EOF
EXPECT=<<EOF
0x004004df mov qword [rbp - 8], str.Hello_World ; 0x4005a0 ; u"\ufeffHello World\ufeff\n"
EOF
RUN
NAME=pdJ 2
FILE=malloc://128
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 9090
e asm.bytes=true
e asm.lines.bb=0
pdJ 2
EOF
EXPECT=<<EOF
[{"offset":0,"text":" 0x00000000 90 nop"},{"offset":1,"text":" 0x00000001 90 nop"}]
EOF
RUN
NAME=pdJ comments
FILE=malloc://128
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
wx 90
e asm.lines.bb=0
CCu base64:dGVzdAo=
pdJ 1
CCu base64:dGVzdCAid2l0aCBxdW90ZXMiCg==
pdJ 1
e asm.cmt.right=false
pdJ 1
EOF
EXPECT=<<EOF
[{"offset":0,"text":" 0x00000000 90 nop ; test"}]
[{"offset":0,"text":" 0x00000000 90 nop ; test \"with quotes\""}]
[{"offset":0,"text":" ; test \"with quotes\"\n"},{"offset":0,"text":" 0x00000000 90 nop"}]
EOF
RUN
NAME=pdJ string comment
FILE=bins/elf/analysis/main
CMDS=<<EOF
aa
e asm.bytes=true
pdJ 1 @ 0x0040050a
EOF
EXPECT=<<EOF
[{"offset":4195594,"text":"| 0x0040050a bfc4054000 mov edi, str.Hello_World ; 0x4005c4 ; \"Hello World\""}]
EOF
RUN
NAME=pdJ flags
FILE=bins/elf/analysis/main
CMDS=<<EOF
e asm.bytes=true
s main
pdJ 1 @ 0x00400506
aa
pdJ 1 @ 0x00400506
EOF
EXPECT=<<EOF
[{"offset":4195590,"text":" ;-- main:"},{"offset":4195590,"text":" 0x00400506 55 push rbp"}]
[{"offset":4195590,"text":" ; DATA XREF from entry0 @ 0x40042d"},{"offset":4195590,"text":"/ int main(int argc, char **argv, char **envp);"},{"offset":4195590,"text":"| 0x00400506 55 push rbp"}]
EOF
RUN
NAME=pdJ midflags reloc
FILE=malloc://8
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
fs relocs
f reloc.test @ 0x1
fs *
pdJ 1 @ 0x0
EOF
EXPECT=<<EOF
[{"offset":0,"text":" 0x00000000 0000 add byte [rax], al"}]
EOF
RUN
NAME=pdJ string
FILE=malloc://128
CMDS=<<EOF
w "Snoo\"ping as\" usual,"
Cs 30
pdJ 1
EOF
EXPECT=<<EOF
[{"offset":0,"text":" 0x00000000 .string \"Snoo\\\"ping as\\\" usual,\" ; len=21"}]
EOF
RUN
NAME=pdJ str in opcode
FILE=bins/java/Hello.class
CMDS=<<EOF
e asm.bytes=true
pdJ 1 @ 0x000002ae
EOF
EXPECT=<<EOF
[{"offset":686,"text":" 0x000002ae 120b ldc \"World\""}]
EOF
RUN
NAME=pdJ asm.cmt.right=0 + html
FILE=bins/elf/crackme0x05
CMDS=<<EOF
aaa
e asm.bytes=true
e asm.cmt.right=0
e scr.html=1
e str.escbslash=1
pdJ 1 @ 0x08048532
EOF
EXPECT=<<EOF
[{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;[0x8048679:4]=0x73736150"},{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;\"Password&nbsp;Incorrect!\\n\""},{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x08048532&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c70424798604.&nbsp;&nbsp;mov&nbsp;dword&nbsp;[esp],&nbsp;str.Password_Incorrect"}]
EOF
RUN
NAME=pdJ asm.cmt.right=0 fcn name
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.bytes=true
af @ sym.imp.__libc_start_main
af @ 0x080485a0
e asm.pseudo=1
e asm.cmt.right=0
pdJ 1 @ 0x080485f9
e asm.esil=1
pdJ 1 @ 0x080483ec
e asm.cmt.right=1
pdJ 1 @ 0x080483ec
EOF
EXPECT=<<EOF
[{"offset":134514169,"arrow":134514133,"text":"| `=< 0x080485f9 72da if (((unsigned) var) < 0) goto 0x80485d5"}]
[{"offset":134513644,"text":" ; sym.imp.__libc_start_main"},{"offset":134513644,"text":" ; int __libc_start_main(void *main, int argc, char **ubp_av, void *init, void *fini, void *rtld_fini, void *stack_end)"},{"offset":134513644,"text":" 0x080483ec e873ffffff 134513508,eip,4,esp,-=,esp,=[],eip,="}]
[{"offset":134513644,"text":" 0x080483ec e873ffffff 134513508,eip,4,esp,-=,esp,=[],eip,= ; sym.imp.__libc_start_main ; int __libc_start_main(void *main, int argc, char **ubp_av, void *init, void *fini, void *rtld_fini, void *stack_end)"}]
EOF
RUN
NAME=pdJ asm.emu=1 comment
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.bytes=true
e asm.emu=1
pdJ 1 @ 0x08048566
EOF
EXPECT=<<EOF
[{"offset":134514022,"text":" 0x08048566 e829feffff call sym.imp.printf ; esp=0xfffffffffffffffc ; eip=0x8048394 -> 0xa00c25ff"},{"offset":134514022,"text":" ; int printf(-1)"}]
EOF
RUN
NAME=pdJ asm.emu=1 string
FILE=bins/elf/crackme0x00b
CMDS=<<EOF
e asm.bytes=true
s 0x080484aa
e asm.emu=1
e scr.color=0
pd 1
pdJ 1
e scr.color=1
pd 1
pdJ 1
EOF
EXPECT=<<EOF
0x080484aa b8e1850408 mov eax, 0x80485e1 ; eax=0x80485e1 "%ls"
[{"offset":134513834,"text":" 0x080484aa b8e1850408 mov eax, 0x80485e1 ; eax=0x80485e1 \"%ls\""}]
0x080484aa b8e1850408 mov eax, 0x80485e1 ; eax=0x80485e1 "%ls"
[{"offset":134513834,"text":" \u001b[32m0x080484aa\u001b[0m \u001b[37mb8\u001b[37me1\u001b[37m85\u001b[37m04\u001b[37m08\u001b[0m \u001b[37mmov\u001b[0m\u001b[37m \u001b[0m\u001b[36meax\u001b[0m\u001b[37m, \u001b[0m\u001b[33m0x80485e1\u001b[0m\u001b[0m\u001b[0m\u001b[31m ; eax=0x80485e1 \u001b[7m\"%ls\"\u001b[27m\u001b[0m"}]
EOF
RUN
NAME=pdJ asm.xrefs.fold asm.xrefs.max
FILE==
CMDS=<<EOF
e asm.bytes=true
s 0
e asm.arch=x86
e asm.bits=64
axc 0 @ 1
e asm.xrefs.fold=0
e asm.xrefs.max=5
pdJ 1
e asm.xrefs.fold=5
e asm.xrefs.max=0
pdJ 1
EOF
EXPECT=<<EOF
[{"offset":0,"text":" ; XREFS: CODE 0x00000001 "},{"offset":0,"text":" 0x00000000 0000 add byte [rax], al"}]
[{"offset":0,"text":" ; XREFS(1)"},{"offset":0,"text":" 0x00000000 0000 add byte [rax], al"}]
EOF
RUN
NAME=pdJ escape flagname
FILE=bins/elf/crackme
CMDS=pdJ 1 @ 0x0040082f
EXPECT=<<EOF
[{"offset":4196399,"text":" ;-- str.Password_Correct:"},{"offset":4196399,"text":" 0x0040082f .string \"Password Correct!\" ; len=18"}]
EOF
RUN
NAME=pd0~{} - crash
FILE==
CMDS=<<EOF
e scr.null=true
pd0~{}
EOF
EXPECT=<<EOF
EOF
RUN
NAME=pI - crash
FILE==
CMDS=<<EOF
e scr.null=true
pI 0x200
EOF
EXPECT=<<EOF
EOF
RUN
NAME=pd bin.str.purge
FILE=bins/elf/analysis/ls2
CMDS=<<EOF
e asm.bytes=false
s main
af
s 0x00404886
e bin.str.purge=false
pd 2
echo --1--
e bin.str.purge=true
pd 2
echo --2--
e bin.str.purge=0x4028a0
pd 2
echo --3--
e bin.str.purge=0x412420,0x4028a0
pd 2
echo --4--
e bin.str.purge=true
pd 1 @ 0x004028e0
pd 1 @ 0x00402abd
echo --5--
e bin.str.purge=true,0x414fbf
pd 1 @ 0x004028e0
pd 1 @ 0x00402abd
EOF
EXPECT=<<EOF
0x00404886 mov rcx, 0x412420 ; ' $A' ; "AWAVA\x89\xffAUATL\x8d%\xbe\x99 "
0x0040488d mov rdi, main ; section..text
; 0x4028a0 ; "AWAVAUATUS\x89\xfbH\x89\xf5H\x81\xec\x98\x03"
--1--
0x00404886 mov rcx, 0x412420 ; ' $A'
0x0040488d mov rdi, main ; section..text
; 0x4028a0
--2--
0x00404886 mov rcx, 0x412420 ; ' $A' ; "AWAVA\x89\xffAUATL\x8d%\xbe\x99 "
0x0040488d mov rdi, main ; section..text
; 0x4028a0
--3--
0x00404886 mov rcx, 0x412420 ; ' $A'
0x0040488d mov rdi, main ; section..text
; 0x4028a0
--4--
| 0x004028e0 mov esi, str.usr_share_locale ; 0x414fbf ; "/usr/share/locale"
| 0x00402abd mov edi, str.TABSIZE ; 0x414fe7
--5--
| 0x004028e0 mov esi, str.usr_share_locale ; 0x414fbf
| 0x00402abd mov edi, str.TABSIZE ; 0x414fe7
EOF
RUN
NAME=pd, esil, emu.stroff and bin.str.purge
FILE=bins/elf/analysis/hello-android-mips
CMDS=<<EOF
e asm.bytes=true
e emu.str=true
s 0x0008049c
e bin.str.purge=
e emu.str.off=false
pd 2
echo ----
e emu.str.off=true
pd 2
echo ----
e bin.str.purge=0x80510
pd 2
EOF
EXPECT=<<EOF
0x0008049c 0800023c lui v0, 8 ; segment.ehdr
0x000804a0 10054424 addiu a0, v0, 0x510 ; "Hello World" sym..rodata
----
0x0008049c 0800023c lui v0, 8 ; segment.ehdr
0x000804a0 10054424 addiu a0, v0, 0x510 ; 0x80510 "Hello World" sym..rodata
----
0x0008049c 0800023c lui v0, 8 ; segment.ehdr
0x000804a0 10054424 addiu a0, v0, 0x510 ; sym..rodata
EOF
RUN
NAME=emu.pre and double pd
FILE=bins/elf/analysis/hello-android-mips
CMDS=<<EOF
e asm.bytes=true
e emu.pre=true
e emu.str=true
f start @ 0x0008049c
s 0x000804a0
pd 1
pd 1 # should print the same as above
EOF
EXPECT=<<EOF
0x000804a0 10054424 addiu a0, v0, 0x510 ; "Hello World" sym..rodata
0x000804a0 10054424 addiu a0, v0, 0x510 ; "Hello World" sym..rodata
EOF
RUN
NAME=pd @B
FILE==
CMDS=<<EOF
e asm.bytes=true
e asm.functions=false
e asm.lines.bb=false
e asm.comments=false
e scr.color=0
e asm.arch=x86
e asm.bits=64
wx 83f803740e
af
pd 1 @B:0
pd 1 @B:1
pd 1 @B:-1
pd 1 @B:-2
EOF
EXPECT=<<EOF
0x00000000 83f803 cmp eax, 3
0x00000003 740e je 0x13
0x00000003 740e je 0x13
0x00000000 83f803 cmp eax, 3
EOF
RUN
NAME=asm.bb.line
FILE=bins/elf/analysis/ls2
CMDS=<<EOF
e asm.bytes=true
e scr.utf8=false
e scr.color=0
e asm.bb.line=true
e asm.comments=false
s main
af
s 0x0040294b
pd 10
EOF
EXPECT=<<EOF
| 0x0040294b c6059ea72100. mov byte [0x0061d0f0], 0
| 0x00402952 83f802 cmp eax, 2
| ,=< 0x00402955 0f8483080000 je 0x4031de
| | |
| | 0x0040295b 83f803 cmp eax, 3
| ,==< 0x0040295e 742f je 0x40298f
| || |
| || 0x00402960 83e801 sub eax, 1
| ,===< 0x00402963 7405 je 0x40296a
| ||| |
| ||| 0x00402965 e8b6f8ffff call sym.imp.abort
| ||| |
| `---> 0x0040296a bf01000000 mov edi, 1
| || 0x0040296f e80cf9ffff call sym.imp.isatty
EOF
RUN
NAME=pd @a overwrites analysis hints
FILE=bins/elf/analysis/ls-linux64
CMDS=<<EOF
e asm.bytes=true
e asm.comments=false
e asm.functions=false
e asm.lines.bb=false
e asm.flags=false
e asm.arch=x86
ahb 16
aha arm
pd 1
e analysis.ignbithints=1
pd 1 @b:32
e analysis.ignbithints=0
pd 1 @b:16
pd 1 @b:32
ahl*
pd 1 @a:x86
ahl*
pd 1 @a:x86:64
ahl*
EOF
EXPECT=<<EOF
0x00005c20 31ed4989 ldc p9, c8, [r1, -0x124]!
0x00005c20 31ed4989 stmdbhi sb, {r0, r4, r5, r8, sl, fp, sp, lr, pc} ^
0x00005c20 31ed4989 ldc p9, c8, [r1, -0x124]!
0x00005c20 31ed4989 stmdbhi sb, {r0, r4, r5, r8, sl, fp, sp, lr, pc} ^
aha arm @ 0x5c20
ahb 16 @ 0x5c20
0000:5c20 31ed xor bp, bp
aha arm @ 0x5c20
ahb 16 @ 0x5c20
0x00005c20 31ed xor ebp, ebp
aha arm @ 0x5c20
ahb 16 @ 0x5c20
EOF
BROKEN=1
RUN
NAME=pd bin.str.filter
FILE=bins/elf/analysis/ls2
CMDS=<<EOF
e asm.bytes=false
e asm.cmt.off=false
s 0x004028e0
e bin.str.filter=
pd 1
e bin.str.filter=U
pd 1
EOF
EXPECT=<<EOF
0x004028e0 mov esi, str.usr_share_locale ; "/usr/share/locale"
0x004028e0 mov esi, str.usr_share_locale
EOF
RUN
NAME=emu.str dup str/flag cmt fix
FILE=bins/elf/analysis/ls2
CMDS=<<EOF
e asm.bytes=true
e emu.str=true
e asm.sub.names=true
pd 1 @ 0x00402a5f
e asm.sub.names=false
pd 1 @ 0x00402a5f
EOF
EXPECT=<<EOF
0x00402a5f bfdf4f4100 mov edi, str.COLUMNS ; 0x414fdf ; "COLUMNS"
0x00402a5f bfdf4f4100 mov edi, 0x414fdf ; str.COLUMNS ; "COLUMNS"
EOF
RUN
NAME=emu.strinv
FILE=bins/elf/redpill
CMDS=<<EOF
e scr.color=1
e asm.bytes=false
e emu.pre=true
e emu.str=true
e io.cache=true
wz abcdefghi @ 0x21f7
f abcdefghi @ 0x21f7
axd 0x21f7 @ 0x161d
e asm.cmt.right=true
e emu.str.inv=true
pd 1 @ 0x161d
e emu.str.inv=false
pd 1 @ 0x161d
echo
e asm.cmt.right=false
e emu.str.inv=true
pd 1 @ 0x161d
e emu.str.inv=false
pd 1 @ 0x161d
EOF
EXPECT=<<EOF
0x0000161d lea eax, [esi - abcdefghi] ; 0x21f7 ; "abcdefghi" ; "\n Blue Pill" str.Blue_Pill
0x0000161d lea eax, [esi - abcdefghi] ; 0x21f7 ; "abcdefghi" ; "\n Blue Pill" str.Blue_Pill
; 0x21f7
; "abcdefghi"
 ; "\n Blue Pill" str.Blue_Pill
 0x0000161d lea eax, [esi - abcdefghi]
; 0x21f7
; "abcdefghi"
 ; "\n Blue Pill" str.Blue_Pill
 0x0000161d lea eax, [esi - abcdefghi]
EOF
RUN
NAME=emu.strflag
FILE=bins/elf/redpill
CMDS=<<EOF
e asm.bytes=false
e emu.pre=true
e emu.str=true
e emu.str.flag=true
pd 1 @ 0x161d
e emu.str.flag=false
pd 1 @ 0x161d
pd 1 @ 0x1447
EOF
EXPECT=<<EOF
0x0000161d lea eax, [esi - 0x21f7] ; "\n Blue Pill" str.Blue_Pill
0x0000161d lea eax, [esi - 0x21f7] ; "\n Blue Pill"
0x00001447 add esi, 0x2bb9 ; section..got.plt
EOF
RUN
NAME=ctrl chars
FILE=bins/elf/strenc-ctrlchars
CMDS=<<EOF
e asm.bytes=false
e asm.cmt.off=false
pd 1 @ 0x0040040b
EOF
EXPECT=<<EOF
0x0040040b mov edi, str.Control_chars: ; "Control chars: \b\v\f\n\r\t\a"
EOF
RUN
NAME=data ref with no RzAnalysisOp.ptr (#9610)
FILE=bins/firmware/main.bin
CMDS=<<EOF
e asm.bytes=true
f str.hello 12 @ 0x276
axd str.hello @ 0x260
pd 1 @ 0x260
EOF
EXPECT=<<EOF
0x00000260 80e0 ldi r24, 0x00 ; 0x276 ; "hello world!"
EOF
RUN
NAME=@b and @addr should coexist
FILE=bins/firmware/armthumb.bin
ARGS=-aarm -b32
CMDS=<<EOF
e asm.bytes=true
pd 1 @b:32 @ 0xc
EOF
EXPECT=<<EOF
0x0000000c 01207047 ldrbmi r2, [r0, -r1]!
EOF
RUN
NAME=ahb should not be deleted with @b (#9751)
FILE=bins/firmware/armthumb.bin
ARGS=-aarm -b32
CMDS=<<EOF
e asm.bytes=true
ahb 16 @ 0xc
ahl*
pd 1 @b:32 @ 0xc
ahl*
EOF
EXPECT=<<EOF
ahb 16 @ 0xc
0x0000000c 01207047 ldrbmi r2, [r0, -r1]!
ahb 16 @ 0xc
EOF
RUN
NAME=ahb should not override @b
FILE=bins/firmware/armthumb.bin
ARGS=-aarm -b32
CMDS=<<EOF
e asm.bytes=true
ahb 16 @ 0xc
pd 5 @b:32
EOF
EXPECT=<<EOF
0x00000000 0000a0e1 mov r0, r0
0x00000004 010000eb bl 0x10
@-> 0x00000008 feffffea b 8
0x0000000c 01207047 ldrbmi r2, [r0, -r1]!
0x00000010 00c09fe5 ldr ip, [pc] ; [0x18:4]=13 ; 24
EOF
RUN
NAME=two-operand line highlight; asm.highlight ecHw fix; ec wordhl/linehl
FILE=bins/elf/redpill
CMDS=<<EOF
. scripts/palette.rz
e asm.bytes=true
e scr.color=3
e emu.str=true
e emu.pre=true
e emu.str.inv=false
e emu.str.flag=false
s 0x1457
e asm.highlight=$$
pd 3
e scr.color=1
pd 1
e scr.color=3
ec linehl none
pd 1
ec linehl rgb:002f00
pd 1
ec wordhl rgb:800
ecHw eax
e asm.highlight=0x1457
s 0
pd 1 @ 0x1457
EOF
EXPECT=<<EOF
0x00001457 8d8689ddffff lea eax, [esi - 0x2277] ; " Take the Red Pill!! \n"
0x0000145d 50 push eax
0x0000145e 8b86f0ffffff mov eax, dword [esi - 0x10]
0x00001457 8d8689ddffff lea eax, [esi - 0x2277] ; " Take the Red Pill!! \n"
0x00001457 8d8689ddffff lea eax, [esi - 0x2277] ; " Take the Red Pill!! \n"
0x00001457 8d8689ddffff lea eax, [esi - 0x2277] ; " Take the Red Pill!! \n"
0x00001457 8d8689ddffff lea eax, [esi - 0x2277] ; " Take the Red Pill!! \n"
EOF
RUN
NAME=pdJ with backslashes, quotation marks, str.escbslash and str.search.encoding
FILE==
CMDS=<<EOF
e io.cache=true
e asm.arch=x86
e asm.bits=32
e asm.bytes=false
s 0x1000
wz "path\"C:\\Program\n"
f ansi_str
s 0x2000
wa "mov eax, 0x1000"
e str.escbslash=true
pd 1
pdJ 1
e str.escbslash=false
pd 1
pdJ 1
s 0x3000
ww "path\"C:\\Program\r"
f wide_str
s 0x4000
wa "mov ebx, 0x3000"
e str.search.encoding=guess
pd 1
pdJ 1
e str.search.encoding=8bit
pd 1
pdJ 1
e str.search.encoding=utf16le
e str.escbslash=true
pd 1
pdJ 1
e str.escbslash=false
pd 1
pdJ 1
EOF
EXPECT=<<EOF
0x00002000 mov eax, 0x1000 ; ansi_str ; "path\"C:\\Program\n"
[{"offset":8192,"text":" 0x00002000 mov eax, 0x1000 ; ansi_str ; \"path\\\"C:\\\\Program\\n\""}]
0x00002000 mov eax, 0x1000 ; ansi_str ; "path\"C:\Program\n"
[{"offset":8192,"text":" 0x00002000 mov eax, 0x1000 ; ansi_str ; \"path\\\"C:\\Program\\n\""}]
0x00004000 mov ebx, 0x3000 ; wide_str ; u"path\"C:\Program\r"
[{"offset":16384,"text":" 0x00004000 mov ebx, 0x3000 ; wide_str ; u\"path\\\"C:\\Program\\r\""}]
0x00004000 mov ebx, 0x3000 ; wide_str ; "p"
[{"offset":16384,"text":" 0x00004000 mov ebx, 0x3000 ; wide_str ; \"p\""}]
0x00004000 mov ebx, 0x3000 ; wide_str ; u"path\"C:\\Program\r"
[{"offset":16384,"text":" 0x00004000 mov ebx, 0x3000 ; wide_str ; u\"path\\\"C:\\\\Program\\r\""}]
0x00004000 mov ebx, 0x3000 ; wide_str ; u"path\"C:\Program\r"
[{"offset":16384,"text":" 0x00004000 mov ebx, 0x3000 ; wide_str ; u\"path\\\"C:\\Program\\r\""}]
EOF
RUN
NAME=arm asm.sub.var, asm.ucase and asm.pseudo (fp)
FILE=bins/elf/analysis/armcall
CMDS=<<EOF
e asm.bytes=false
e asm.comments=false
e io.cache=true
wv4 0xe59b0008 @ 0x00010464
wv4 0xe59b100c @ 0x00010468
af @ main
e asm.pseudo=false
e asm.sub.var=true
e asm.ucase=true
pd 4 @ 0x0001045c
echo
e asm.sub.var=false
e asm.ucase=false
pd 4 @ 0x0001045c
echo
e asm.pseudo=true
e asm.sub.var=true
e asm.sub.varonly=false
pd 4 @ 0x0001045c
echo
e asm.sub.varonly=true
s main
afvn local2 var_10h
afvn arg1 arg_4h
pd 4 @ 0x0001045c
EOF
EXPECT=<<EOF
| 0x0001045c STR R0, [var_ch]
| 0x00010460 STR R1, [var_10h]
| 0x00010464 LDR R0, [arg_4h]
| 0x00010468 LDR R1, [arg_8h]
| 0x0001045c str r0, [fp, -8]
| 0x00010460 str r1, [fp, -0xc]
| 0x00010464 ldr r0, [fp, 8]
| 0x00010468 ldr r1, [fp, 0xc]
| 0x0001045c [fp - var_ch] = r0
| 0x00010460 [fp - var_10h] = r1
| 0x00010464 r0 = [fp + arg_4h]
| 0x00010468 r1 = [fp + arg_8h]
| 0x0001045c [var_ch] = r0
| 0x00010460 [local2] = r1
| 0x00010464 r0 = [arg1]
| 0x00010468 r1 = [arg_8h]
EOF
RUN
NAME=pdfj with padding
FILE=bins/elf/padding_in_func
CMDS=<<EOF
s main
af
pdfj~{} | grep opcode
EOF
EXPECT=<<EOF
"opcode": "push rbp",
"opcode": "push rbx",
"opcode": "push rax",
"opcode": "mov ebx, edi",
"opcode": "cmp ebx, 2",
"opcode": "mov eax, 0x5758554a",
"opcode": "mov ebp, 0x10c2377a",
"opcode": "cmovl ebp, eax",
"opcode": "mov eax, 0xbaad0c8f",
"opcode": "cmp eax, 0xccdab13a",
"opcode": "jg 0x40058a",
"opcode": "jmp 0x4005ae",
"opcode": "mov edi, 0x400664",
"opcode": "xor eax, eax",
"opcode": "mov esi, ebx",
"opcode": "call 0x400440",
"opcode": "mov eax, 0xccdab13b",
"opcode": "cmp eax, 0xccdab13a",
"opcode": "jle 0x4005ae",
"opcode": "cmp eax, 0x10c2377a",
"opcode": "je 0x400570",
"opcode": "cmp eax, 0x5758554a",
"opcode": "jne 0x4005b9",
"opcode": "mov edi, 0x40066d",
"opcode": "call 0x400430",
"opcode": "mov eax, 0xccdab13b",
"opcode": "cmp eax, 0xccdab13a",
"opcode": "jg 0x40058a",
"opcode": "cmp eax, 0xbaad0c8f",
"opcode": "mov eax, ebp",
"opcode": "je 0x400583",
"opcode": "jmp 0x4005d0",
"opcode": "cmp eax, 0xccdab13b",
"opcode": "jne 0x4005d0",
"opcode": "xor eax, eax",
"opcode": "add rsp, 8",
"opcode": "pop rbx",
"opcode": "pop rbp",
"opcode": "ret",
"opcode": "jmp 0x4005d0",
EOF
RUN
NAME=asm.imm.str, mov and movabs (#10473)
FILE=bins/elf/echo-bin
CMDS=<<EOF
e asm.bytes=false
e asm.imm.str=true
pd 1 @ 0x9a2
pd 1 @ 0x9a9
pd 1 @ 0x9b3
EOF
EXPECT=<<EOF
0x000009a2 mov dword [rbp - 0x30], 0x3c3c2b3e ; '>+<<'
0x000009a9 mov word [rbp - 0x2c], 0x3e5d ; ']>'
0x000009b3 movabs rax, 0x3c2b3c3c5b3e3e3e ; '>>>[<<+<'
EOF
RUN
NAME=asm.imm.str, asm.cmd.right=false, pd and pdJ
FILE=bins/elf/echo-bin
CMDS=<<EOF
e asm.bytes=true
e asm.imm.str=true
e asm.cmt.right=false
pd 1 @ 0x9b3
echo
pdJ 1 @ 0x9b3
EOF
EXPECT=<<EOF
; '>>>[<<+<'
0x000009b3 48b83e3e3e5b. movabs rax, 0x3c2b3c3c5b3e3e3e
[{"offset":2483,"text":" ; '>>>[<<+<'"},{"offset":2483,"text":" 0x000009b3 48b83e3e3e5b. movabs rax, 0x3c2b3c3c5b3e3e3e"}]
EOF
RUN
NAME=asm.imm.str short false positive
FILE=bins/elf/analysis/fast
CMDS=<<EOF
e asm.bytes=false
e asm.imm.str=true
f- @ 0x08048574
pd 1 @ 0x08048444
EOF
EXPECT=<<EOF
0x08048444 push 0x8048574
EOF
RUN
NAME=asm.imm.str and flag
FILE=bins/elf/strenc
CMDS=<<EOF
e asm.bytes=false
e asm.imm.str=true
e str.search.encoding=utf16le
pd 1 @ 0x004016ca
f str.fence @ 0x40235a
e asm.cmt.off=false
pd 1 @ 0x004016ca
EOF
EXPECT=<<EOF
0x004016ca mov edi, 0x40235a ; 'Z#@' ; u"\u2520\u2542-\u2500-\u2500\u2542\u2528 is a fence with embedded double zeros\n"
0x004016ca mov edi, str.fence ; u"\u2520\u2542-\u2500-\u2500\u2542\u2528 is a fence with embedded double zeros\n"
EOF
RUN
NAME=#10989 double pre-disasm
FILE=bins/elf/echo-bin
CMDS=<<EOF
e asm.bytes=false
e asm.cmt.right=false
pd 1 @ 0xe78
EOF
EXPECT=<<EOF
; 'f'
0x00000e78 mov byte [rbp - 0x274e], 0x66
EOF
RUN
NAME=pdf show entry0 disasm instead of main
FILE=bins/elf/ls
CMDS=<<EOF
e asm.bytes=true
aa
pdf
EOF
EXPECT=<<EOF
/ entry0(int64_t arg3);
| ; arg int64_t arg3 @ rdx
| 0x00005ae0 f30f1efa endbr64
| 0x00005ae4 31ed xor ebp, ebp
| 0x00005ae6 4989d1 mov r9, rdx ; arg3
| 0x00005ae9 5e pop rsi
| 0x00005aea 4889e2 mov rdx, rsp
| 0x00005aed 4883e4f0 and rsp, 0xfffffffffffffff0
| 0x00005af1 50 push rax
| 0x00005af2 54 push rsp
| 0x00005af3 4c8d05660c01. lea r8, [0x00016760]
| 0x00005afa 488d0def0b01. lea rcx, [0x000166f0]
| 0x00005b01 488d3d68e5ff. lea rdi, [main] ; 0x4070 ; "AWAVAUATU\x89\xfdSH\x89\xf3H\x83\xecXH\x8b>dH\x8b\x04%("
\ 0x00005b08 ff150ac30100 call qword [reloc.__libc_start_main] ; [reloc.__libc_start_main:8]=0x23708 reloc.target.__libc_start_main
EOF
RUN
NAME=asm.lines.ret, pd and pdJ
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.bytes=true
e asm.lines.ret=1
s 0x08048414
pd 2
echo
pdJ 2
EOF
EXPECT=<<EOF
0x08048414 c3 ret
; --------------------------------------
0x08048415 90 nop
[{"offset":134513684,"text":" 0x08048414 c3 ret"},{"offset":134513684,"text":" ; --------------------------------------"},{"offset":134513685,"text":" 0x08048415 90 nop"}]
EOF
RUN
NAME=disassemble PE with asm.flags.real enabled
FILE=bins/pe/ConsoleApplication1.exe
CMDS=<<EOF
e asm.flags.real=true
pi 10
EOF
EXPECT=<<EOF
call 0x401836
jmp 0x401322
push ebp
mov ebp, esp
push 0
call dword [SetUnhandledExceptionFilter]
push dword [ebp + 8]
call dword [UnhandledExceptionFilter]
push 0xc0000409
call dword [GetCurrentProcess]
EOF
RUN
NAME=direct call without fcn + asm.flags.real
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.bytes=true
e asm.flags.real=false
pd 1 @ 0x8048566
e asm.flags.real=true
pd 1 @ 0x8048566
aaa
afl~printf
e asm.flags.real=false
pd 1 @ 0x8048566
e asm.flags.real=true
pd 1 @ 0x8048566
EOF
EXPECT=<<EOF
0x08048566 e829feffff call sym.imp.printf
0x08048566 e829feffff call printf ; sym.imp.printf
0x08048394 1 6 sym.imp.printf
| 0x08048566 e829feffff call sym.imp.printf ; int printf(const char *format)
| 0x08048566 e829feffff call printf ; sym.imp.printf ; int printf(const char *format)
EOF
RUN
NAME=pd grep chain
FILE=malloc://8
CMDS=<<EOF
e asm.bytes=true
e asm.arch=x86
e asm.bits=64
wx 90905152539090 ; pd 7 ~&5,push
EOF
EXPECT=<<EOF
0x00000002 51 push rcx
0x00000003 52 push rdx
0x00000004 53 push rbx
EOF
RUN
NAME=pd grep chain fail
FILE=malloc://8
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 90905152539090 ; pd 7 ~ 5 ~ push
EOF
EXPECT=<<EOF
EOF
RUN
NAME=print fcn header without asm.flags.real
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.flags.real=false
e asm.lines.fcn=false
aaa
pdf @ 0x08048484~:1
EOF
EXPECT=<<EOF
sym.parell(const char *s);
EOF
RUN
NAME=print fcn header with asm.flags.real
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.flags.real=true
e asm.lines.fcn=false
aaa
pdf @ 0x08048484~:1
EOF
EXPECT=<<EOF
parell(const char *s);
EOF
RUN
NAME=asm.imm.trim
FILE=bins/elf/crackme0x05
CMDS=<<EOF
s 0x080483d5
pi 1 @e:asm.imm.trim=false
pi 1 @e:asm.imm.trim=true
EOF
EXPECT=<<EOF
and esp, 0xfffffff0
and esp,
EOF
RUN
NAME=asm.size and meta string
FILE=bins/elf/ls
CMDS=<<EOF
pd 1 @ 0x0001bbe8
pd 1 @ 0x0001bbe8 @e:asm.size=true
EOF
EXPECT=<<EOF
;-- str.Written_by__s___s___s___s___s___s___s___s__and__s.:
0x0001bbe8 .string "Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n" ; len=52
;-- str.Written_by__s___s___s___s___s___s___s___s__and__s.:
0x0001bbe8 .string "Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n" ; len=52
EOF
RUN
NAME=print section perm
FILE=bins/elf/crackme0x05
CMDS=<<EOF
pd 1 @ 0x080483d2
pd 1 @ 0x08049f24
pd 1 @ 0x080483d2 @e:asm.section=true,asm.section.perm=true
pd 1 @ 0x08049f24 @e:asm.section=true,asm.section.perm=true
EOF
EXPECT=<<EOF
0x080483d2 pop esi
0x08049f24 .dword 0x00000010
r-x .text 0x080483d2 pop esi
rw- .dynamic 0x08049f24 .dword 0x00000010
EOF
RUN
NAME=parse hexadecimal integer literals (trailing-h notation)
FILE=bins/pe/hello_world_stripped.exe
ARGS=
CMDS=<<EOF
aaa
s 0x00401533
e asm.lines=false
e asm.syntax=masm
e asm.ucase=false
pd 1
e asm.ucase=true
pd 1
EOF
EXPECT=<<EOF
0x00401533 and esp, 0fffffff0h
0x00401533 AND ESP, 0FFFFFFF0H
EOF
RUN
NAME=variable name substitution (x86 MASM syntax)
FILE=bins/elf/hello_world
ARGS=
CMDS=<<EOF
aaa
s 0x000007e3
e asm.lines=false
e asm.syntax=masm
e asm.ucase=false
pd 1
e asm.ucase=true
pd 1
EOF
EXPECT=<<EOF
0x000007e3 mov dword [size], eax
0x000007e3 MOV DWORD [size], EAX
EOF
RUN
NAME=function name substitution (x86 MASM syntax)
FILE=bins/elf/hello_world
ARGS=
CMDS=<<EOF
aaa
s 0x000007cf
e asm.lines=false
e asm.calls=false
e asm.syntax=masm
e asm.ucase=false
pd 1
e asm.ucase=true
pd 1
EOF
EXPECT=<<EOF
0x000007cf call sym.imp.strlen
0x000007cf CALL sym.imp.strlen
EOF
RUN
NAME=rip-relative addr substitution (x86 MASM syntax)
FILE=bins/mach0/mac-ls
ARGS=
CMDS=<<EOF
s 0x10000108a
e asm.lines.bb=0
e asm.bytes=0
e asm.comments=false
e asm.syntax=masm
e asm.ucase=false
pd 1
e asm.ucase=true
pd 1
EOF
EXPECT=<<EOF
0x10000108a lea rsi, section.4.__TEXT.__cstring
0x10000108a LEA RSI, section.4.__TEXT.__cstring
EOF
RUN
NAME=asm.cmt.il
FILE=bins/prg/t01.prg
ARGS=-F prg
CMDS=<<EOF
e asm.cmt.il=1
e asm.cmt.right=0
pd 3 @ 0x80e
echo --
e asm.cmt.right=1
pd 3 @ 0x80e
EOF
EXPECT=<<EOF
; (seq (set a (bv 8 0x41)) (set Z (is_zero (var a))) (set N (msb (var a))))
0x0000080e lda #0x41
; (seq (set x (bv 8 0xff)) (set Z (is_zero (var x))) (set N (msb (var x))))
0x00000810 ldx #0xff
; (store 0 (+ (bv 16 0x3ff) (cast 16 false (var x))) (var a))
0x00000812 sta 0x03ff,x
--
0x0000080e lda #0x41 ; (seq (set a (bv 8 0x41)) (set Z (is_zero (var a))) (set N (msb (var a))))
0x00000810 ldx #0xff ; (seq (set x (bv 8 0xff)) (set Z (is_zero (var x))) (set N (msb (var x))))
0x00000812 sta 0x03ff,x ; (store 0 (+ (bv 16 0x3ff) (cast 16 false (var x))) (var a))
EOF
RUN
NAME=asm.cmt.esil
FILE=bins/prg/t01.prg
ARGS=-F prg
CMDS=<<EOF
e asm.cmt.esil=1
e asm.cmt.right=0
pd 3 @ 0x80e
echo --
e asm.cmt.right=1
pd 3 @ 0x80e
EOF
EXPECT=<<EOF
; 0x41,a,=,$z,Z,:=,7,$s,N,:=
0x0000080e lda #0x41
; 0xff,x,=,$z,Z,:=,7,$s,N,:=
0x00000810 ldx #0xff
; a,x,0x03ff,+,=[1]
0x00000812 sta 0x03ff,x
--
0x0000080e lda #0x41 ; 0x41,a,=,$z,Z,:=,7,$s,N,:=
0x00000810 ldx #0xff ; 0xff,x,=,$z,Z,:=,7,$s,N,:=
0x00000812 sta 0x03ff,x ; a,x,0x03ff,+,=[1]
EOF
RUN
NAME=remove analysis hint
FILE==
CMDS=<<EOF
e asm.functions=false
e asm.offset=false
e asm.lines=false
e asm.lines.bb=false
e asm.marks=false
e asm.bytes=false
e asm.comments=false
e asm.flags=false
e asm.arch=x86
e asm.bits=64
wx 31ed4989d1
pd 1
aha ppc
pd 1
aha-
pd 1
aha ppc
aha 0
pd 1
EOF
EXPECT=<<EOF
xor ebp, ebp
lbz r10, -0x12cf(r9)
xor ebp, ebp
xor ebp, ebp
EOF
RUN
NAME=pd is not limited by blocksize
FILE==
CMDS=<<EOF
b 10
pd 10~?
pd 3~?
pd 20~?
EOF
EXPECT=<<EOF
10
3
20
EOF
RUN
NAME=mips varsub
FILE=bins/elf/vars-mips-bp
ARGS=-e bin.dbginfo=0
CMDS=<<EOF
s sym.varfunc
af
e asm.flags=false
e asm.bytes=0
e asm.comments=false
e asm.sub.var=1
e asm.sub.varonly=1
pdf
e asm.sub.varonly=0
pdf
e asm.pseudo=1
e asm.sub.varonly=1
pdf
e asm.sub.varonly=0
pdf
EOF
EXPECT=<<EOF
/ sym.varfunc();
| ; var int32_t var_20h @ stack - 0x20
| ; var int32_t var_18h @ stack - 0x18
| ; var int32_t var_14h @ stack - 0x14
| ; var int32_t var_10h @ stack - 0x10
| ; var int32_t var_ch @ stack - 0xc
| ; var int32_t var_8h @ stack - 0x8
| ; var int32_t var_4h @ stack - 0x4
| 0x00000794 lui gp, 2
| 0x00000798 addiu gp, gp, -0x7db4
| 0x0000079c addu gp, gp, t9
| 0x000007a0 addiu sp, sp, -0x30
| 0x000007a4 sw ra, (var_4h)
| 0x000007a8 sw fp, (var_8h)
| 0x000007ac move fp, sp
| 0x000007b0 sw gp, (var_20h)
| 0x000007b4 addiu v0, zero, 1
| 0x000007b8 sw v0, (var_18h)
| 0x000007bc addiu v0, zero, 2
| 0x000007c0 sw v0, (var_14h)
| 0x000007c4 addiu v0, zero, 3
| 0x000007c8 sw v0, (var_10h)
| 0x000007cc addiu v0, zero, 4
| 0x000007d0 sw v0, (var_ch)
| 0x000007d4 lw v0, -sym.leaffunc(gp)
| 0x000007d8 move t9, v0
| 0x000007dc bal sym.leaffunc
| 0x000007e0 nop
| 0x000007e4 lw gp, (var_20h)
| 0x000007e8 lw v0, (var_ch)
| 0x000007ec sw v0, (var_14h)
| 0x000007f0 lw v0, (var_18h)
| 0x000007f4 move sp, fp
| 0x000007f8 lw ra, (var_4h)
| 0x000007fc lw fp, (var_8h)
| 0x00000800 addiu sp, sp, 0x30
| 0x00000804 jr ra
\ 0x00000808 nop
/ sym.varfunc();
| ; var int32_t var_20h @ stack - 0x20
| ; var int32_t var_18h @ stack - 0x18
| ; var int32_t var_14h @ stack - 0x14
| ; var int32_t var_10h @ stack - 0x10
| ; var int32_t var_ch @ stack - 0xc
| ; var int32_t var_8h @ stack - 0x8
| ; var int32_t var_4h @ stack - 0x4
| 0x00000794 lui gp, 2
| 0x00000798 addiu gp, gp, -0x7db4
| 0x0000079c addu gp, gp, t9
| 0x000007a0 addiu sp, sp, -0x30
| 0x000007a4 sw ra, var_4h(sp)
| 0x000007a8 sw fp, var_8h(sp)
| 0x000007ac move fp, sp
| 0x000007b0 sw gp, var_20h(sp)
| 0x000007b4 addiu v0, zero, 1
| 0x000007b8 sw v0, var_18h(fp)
| 0x000007bc addiu v0, zero, 2
| 0x000007c0 sw v0, var_14h(fp)
| 0x000007c4 addiu v0, zero, 3
| 0x000007c8 sw v0, var_10h(fp)
| 0x000007cc addiu v0, zero, 4
| 0x000007d0 sw v0, var_ch(fp)
| 0x000007d4 lw v0, -sym.leaffunc(gp)
| 0x000007d8 move t9, v0
| 0x000007dc bal sym.leaffunc
| 0x000007e0 nop
| 0x000007e4 lw gp, var_20h(fp)
| 0x000007e8 lw v0, var_ch(fp)
| 0x000007ec sw v0, var_14h(fp)
| 0x000007f0 lw v0, var_18h(fp)
| 0x000007f4 move sp, fp
| 0x000007f8 lw ra, var_4h(sp)
| 0x000007fc lw fp, var_8h(sp)
| 0x00000800 addiu sp, sp, 0x30
| 0x00000804 jr ra
\ 0x00000808 nop
/ sym.varfunc();
| ; var int32_t var_20h @ stack - 0x20
| ; var int32_t var_18h @ stack - 0x18
| ; var int32_t var_14h @ stack - 0x14
| ; var int32_t var_10h @ stack - 0x10
| ; var int32_t var_ch @ stack - 0xc
| ; var int32_t var_8h @ stack - 0x8
| ; var int32_t var_4h @ stack - 0x4
| 0x00000794 gp = 2 << 16
| 0x00000798 gp = gp - 0x7db4
| 0x0000079c gp = gp + t9
| 0x000007a0 sp = sp - 0x30
| 0x000007a4 word [var_4h] = ra
| 0x000007a8 word [var_8h] = fp
| 0x000007ac fp = sp
| 0x000007b0 word [var_20h] = gp
| 0x000007b4 v0 = 0 + 1
| 0x000007b8 word [var_18h] = v0
| 0x000007bc v0 = 0 + 2
| 0x000007c0 word [var_14h] = v0
| 0x000007c4 v0 = 0 + 3
| 0x000007c8 word [var_10h] = v0
| 0x000007cc v0 = 0 + 4
| 0x000007d0 word [var_ch] = v0
| 0x000007d4 v0 = word [gp - sym.leaffunc]
| 0x000007d8 t9 = v0
| 0x000007dc call sym.leaffunc
| 0x000007e0
| 0x000007e4 gp = word [var_20h]
| 0x000007e8 v0 = word [var_ch]
| 0x000007ec word [var_14h] = v0
| 0x000007f0 v0 = word [var_18h]
| 0x000007f4 sp = fp
| 0x000007f8 ra = word [var_4h]
| 0x000007fc fp = word [var_8h]
| 0x00000800 sp = var_4h + 0x4
| 0x00000804 return
\ 0x00000808
/ sym.varfunc();
| ; var int32_t var_20h @ stack - 0x20
| ; var int32_t var_18h @ stack - 0x18
| ; var int32_t var_14h @ stack - 0x14
| ; var int32_t var_10h @ stack - 0x10
| ; var int32_t var_ch @ stack - 0xc
| ; var int32_t var_8h @ stack - 0x8
| ; var int32_t var_4h @ stack - 0x4
| 0x00000794 gp = 2 << 16
| 0x00000798 gp = gp - 0x7db4
| 0x0000079c gp = gp + t9
| 0x000007a0 sp = sp - 0x30
| 0x000007a4 word [sp + var_4h] = ra
| 0x000007a8 word [sp + var_8h] = fp
| 0x000007ac fp = sp
| 0x000007b0 word [sp + var_20h] = gp
| 0x000007b4 v0 = 0 + 1
| 0x000007b8 word [fp + var_18h] = v0
| 0x000007bc v0 = 0 + 2
| 0x000007c0 word [fp + var_14h] = v0
| 0x000007c4 v0 = 0 + 3
| 0x000007c8 word [fp + var_10h] = v0
| 0x000007cc v0 = 0 + 4
| 0x000007d0 word [fp + var_ch] = v0
| 0x000007d4 v0 = word [gp - sym.leaffunc]
| 0x000007d8 t9 = v0
| 0x000007dc call sym.leaffunc
| 0x000007e0
| 0x000007e4 gp = word [fp + var_20h]
| 0x000007e8 v0 = word [fp + var_ch]
| 0x000007ec word [fp + var_14h] = v0
| 0x000007f0 v0 = word [fp + var_18h]
| 0x000007f4 sp = fp
| 0x000007f8 ra = word [sp + var_4h]
| 0x000007fc fp = word [sp + var_8h]
| 0x00000800 sp = sp + var_4h + 0x4
| 0x00000804 return
\ 0x00000808
EOF
BROKEN=1
RUN
NAME=Check output pdr and pdrj to be the same
FILE=bins/elf/crackme0x05
CMDS=<<EOF
aaa
s main
pdr
pdrj~{}
EOF
EXPECT=<<EOF
; DATA XREF from entry0 @ 0x80483e7
/ int main(int argc, char **argv, char **envp);
| ; var int32_t var_88h @ stack - 0x88
| ; var int32_t var_7ch @ stack - 0x7c
| 0x08048540 push ebp
| 0x08048541 mov ebp, esp
| 0x08048543 sub esp, 0x88
| 0x08048549 and esp, 0xfffffff0
| 0x0804854c mov eax, 0
| 0x08048551 add eax, 0xf ; 15
| 0x08048554 add eax, 0xf ; 15
| 0x08048557 shr eax, 4
| 0x0804855a shl eax, 4
| 0x0804855d sub esp, eax
| 0x0804855f mov dword [esp], str.IOLI_Crackme_Level_0x05 ; [0x804868e:4]=0x494c4f49 ; "IOLI Crackme Level 0x05\n" ; const char *format
| 0x08048566 call sym.imp.printf ; int printf(const char *format)
| 0x0804856b mov dword [esp], str.Password: ; [0x80486a7:4]=0x73736150 ; "Password: " ; const char *format
| 0x08048572 call sym.imp.printf ; int printf(const char *format)
| 0x08048577 lea eax, [var_7ch]
| 0x0804857a mov dword [var_88h], eax
| 0x0804857e mov dword [esp], data.080486b2 ; [0x80486b2:4]=0x7325 ; "%s" ; const char *format
| 0x08048585 call sym.imp.scanf ; int scanf(const char *format)
| 0x0804858a lea eax, [var_7ch]
| 0x0804858d mov dword [esp], eax ; int32_t arg_4h
| 0x08048590 call sym.check
| 0x08048595 mov eax, 0
| 0x0804859a leave
\ 0x0804859b ret
[
{
"offset": 134513984,
"esil": "ebp,4,esp,-,=[4],4,esp,-=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514075,
"size": 1,
"opcode": "push ebp",
"disasm": "push ebp",
"bytes": "55",
"family": "cpu",
"type": "rpush",
"reloc": false,
"type_num": 268435468,
"type2_num": 0,
"flags": [
"main",
"sym.main"
],
"xrefs_to": [
{
"addr": 134513639,
"type": "DATA"
}
]
},
{
"offset": 134513985,
"esil": "esp,ebp,=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514074,
"size": 2,
"opcode": "mov ebp, esp",
"disasm": "mov ebp, esp",
"bytes": "89e5",
"family": "cpu",
"type": "mov",
"reloc": false,
"type_num": 9,
"type2_num": 0
},
{
"offset": 134513987,
"val": 136,
"esil": "136,esp,-=,136,0x80000000,-,!,31,$o,^,of,:=,31,$s,sf,:=,$z,zf,:=,$p,pf,:=,32,$b,cf,:=,3,$b,af,:=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514070,
"size": 6,
"opcode": "sub esp, 0x88",
"disasm": "sub esp, 0x88",
"bytes": "81ec88000000",
"family": "cpu",
"type": "sub",
"reloc": false,
"type_num": 18,
"type2_num": 0
},
{
"offset": 134513993,
"val": 4294967280,
"esil": "4294967280,esp,&=,$z,zf,:=,$p,pf,:=,31,$s,sf,:=,0,cf,:=,0,of,:=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514073,
"size": 3,
"opcode": "and esp, 0xfffffff0",
"disasm": "and esp, 0xfffffff0",
"bytes": "83e4f0",
"family": "cpu",
"type": "and",
"reloc": false,
"type_num": 27,
"type2_num": 0
},
{
"offset": 134513996,
"val": 0,
"esil": "0,eax,=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514071,
"size": 5,
"opcode": "mov eax, 0",
"disasm": "mov eax, 0",
"bytes": "b800000000",
"family": "cpu",
"type": "mov",
"reloc": false,
"type_num": 9,
"type2_num": 0
},
{
"offset": 134514001,
"ptr": 15,
"val": 15,
"esil": "15,eax,+=,31,$o,of,:=,31,$s,sf,:=,$z,zf,:=,31,$c,cf,:=,$p,pf,:=,3,$c,af,:=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514073,
"size": 3,
"opcode": "add eax, 0xf",
"disasm": "add eax, 0xf",
"bytes": "83c00f",
"family": "cpu",
"type": "add",
"reloc": false,
"type_num": 17,
"type2_num": 0
},
{
"offset": 134514004,
"ptr": 15,
"val": 15,
"esil": "15,eax,+=,31,$o,of,:=,31,$s,sf,:=,$z,zf,:=,31,$c,cf,:=,$p,pf,:=,3,$c,af,:=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514073,
"size": 3,
"opcode": "add eax, 0xf",
"disasm": "add eax, 0xf",
"bytes": "83c00f",
"family": "cpu",
"type": "add",
"reloc": false,
"type_num": 17,
"type2_num": 0
},
{
"offset": 134514007,
"val": 4,
"esil": "0,cf,:=,1,4,-,1,<<,eax,&,?{,1,cf,:=,},4,eax,>>,eax,=,$z,zf,:=,$p,pf,:=,31,$s,sf,:=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514073,
"size": 3,
"opcode": "shr eax, 4",
"disasm": "shr eax, 4",
"bytes": "c1e804",
"family": "cpu",
"type": "shr",
"reloc": false,
"type_num": 22,
"type2_num": 0
},
{
"offset": 134514010,
"esil": "0,4,!,!,?{,1,4,-,eax,<<,0x80000000,&,!,!,^,},4,eax,<<=,$z,zf,:=,$p,pf,:=,31,$s,sf,:=,cf,=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514073,
"size": 3,
"opcode": "shl eax, 4",
"disasm": "shl eax, 4",
"bytes": "c1e004",
"family": "cpu",
"type": "shl",
"reloc": false,
"type_num": 23,
"type2_num": 0
},
{
"offset": 134514013,
"esil": "eax,esp,-=,eax,0x80000000,-,!,31,$o,^,of,:=,31,$s,sf,:=,$z,zf,:=,$p,pf,:=,32,$b,cf,:=,3,$b,af,:=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514074,
"size": 2,
"opcode": "sub esp, eax",
"disasm": "sub esp, eax",
"bytes": "29c4",
"family": "cpu",
"type": "sub",
"reloc": false,
"type_num": 18,
"type2_num": 0
},
{
"offset": 134514015,
"ptr": 134514318,
"val": 134514318,
"esil": "134514318,esp,=[4]",
"refptr": true,
"fcn_addr": 134513984,
"fcn_last": 134514069,
"size": 7,
"opcode": "mov dword [esp], 0x804868e",
"disasm": "mov dword [esp], str.IOLI_Crackme_Level_0x05",
"bytes": "c704248e860408",
"family": "cpu",
"type": "mov",
"reloc": false,
"type_num": 9,
"type2_num": 0,
"xrefs_from": [
{
"addr": 134514318,
"type": "DATA"
}
]
},
{
"offset": 134514022,
"esil": "134513556,eip,4,esp,-=,esp,=[],eip,=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514071,
"size": 5,
"opcode": "call 0x8048394",
"disasm": "call sym.imp.printf",
"bytes": "e829feffff",
"family": "cpu",
"type": "call",
"reloc": false,
"type_num": 3,
"type2_num": 0,
"jump": 134513556,
"fail": 134514027,
"xrefs_from": [
{
"addr": 134513556,
"type": "CALL"
}
]
},
{
"offset": 134514027,
"ptr": 134514343,
"val": 134514343,
"esil": "134514343,esp,=[4]",
"refptr": true,
"fcn_addr": 134513984,
"fcn_last": 134514069,
"size": 7,
"opcode": "mov dword [esp], 0x80486a7",
"disasm": "mov dword [esp], str.Password:",
"bytes": "c70424a7860408",
"family": "cpu",
"type": "mov",
"reloc": false,
"type_num": 9,
"type2_num": 0,
"xrefs_from": [
{
"addr": 134514343,
"type": "DATA"
}
]
},
{
"offset": 134514034,
"esil": "134513556,eip,4,esp,-=,esp,=[],eip,=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514071,
"size": 5,
"opcode": "call 0x8048394",
"disasm": "call sym.imp.printf",
"bytes": "e81dfeffff",
"family": "cpu",
"type": "call",
"reloc": false,
"type_num": 3,
"type2_num": 0,
"jump": 134513556,
"fail": 134514039,
"xrefs_from": [
{
"addr": 134513556,
"type": "CALL"
}
]
},
{
"offset": 134514039,
"esil": "0x78,ebp,-,eax,=",
"refptr": true,
"fcn_addr": 134513984,
"fcn_last": 134514073,
"size": 3,
"opcode": "lea eax, [ebp - 0x78]",
"disasm": "lea eax, [var_7ch]",
"bytes": "8d4588",
"family": "cpu",
"type": "lea",
"reloc": false,
"type_num": 33,
"type2_num": 0
},
{
"offset": 134514042,
"esil": "eax,0x4,esp,+,=[4]",
"refptr": true,
"fcn_addr": 134513984,
"fcn_last": 134514072,
"size": 4,
"opcode": "mov dword [esp + 4], eax",
"disasm": "mov dword [var_88h], eax",
"bytes": "89442404",
"family": "cpu",
"type": "mov",
"reloc": false,
"type_num": 9,
"type2_num": 0
},
{
"offset": 134514046,
"ptr": 134514354,
"val": 134514354,
"esil": "134514354,esp,=[4]",
"refptr": true,
"fcn_addr": 134513984,
"fcn_last": 134514069,
"size": 7,
"opcode": "mov dword [esp], 0x80486b2",
"disasm": "mov dword [esp], data.080486b2",
"bytes": "c70424b2860408",
"family": "cpu",
"type": "mov",
"reloc": false,
"type_num": 9,
"type2_num": 0,
"xrefs_from": [
{
"addr": 134514354,
"type": "DATA"
}
]
},
{
"offset": 134514053,
"esil": "134513524,eip,4,esp,-=,esp,=[],eip,=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514071,
"size": 5,
"opcode": "call 0x8048374",
"disasm": "call sym.imp.scanf",
"bytes": "e8eafdffff",
"family": "cpu",
"type": "call",
"reloc": false,
"type_num": 3,
"type2_num": 0,
"jump": 134513524,
"fail": 134514058,
"xrefs_from": [
{
"addr": 134513524,
"type": "CALL"
}
]
},
{
"offset": 134514058,
"esil": "0x78,ebp,-,eax,=",
"refptr": true,
"fcn_addr": 134513984,
"fcn_last": 134514073,
"size": 3,
"opcode": "lea eax, [ebp - 0x78]",
"disasm": "lea eax, [var_7ch]",
"bytes": "8d4588",
"family": "cpu",
"type": "lea",
"reloc": false,
"type_num": 33,
"type2_num": 0
},
{
"offset": 134514061,
"esil": "eax,esp,=[4]",
"refptr": true,
"fcn_addr": 134513984,
"fcn_last": 134514073,
"size": 3,
"opcode": "mov dword [esp], eax",
"disasm": "mov dword [esp], eax",
"bytes": "890424",
"family": "cpu",
"type": "mov",
"reloc": false,
"type_num": 9,
"type2_num": 0
},
{
"offset": 134514064,
"esil": "134513864,eip,4,esp,-=,esp,=[],eip,=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514071,
"size": 5,
"opcode": "call 0x80484c8",
"disasm": "call sym.check",
"bytes": "e833ffffff",
"family": "cpu",
"type": "call",
"reloc": false,
"type_num": 3,
"type2_num": 0,
"jump": 134513864,
"fail": 134514069,
"xrefs_from": [
{
"addr": 134513864,
"type": "CALL"
}
]
},
{
"offset": 134514069,
"val": 0,
"esil": "0,eax,=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514071,
"size": 5,
"opcode": "mov eax, 0",
"disasm": "mov eax, 0",
"bytes": "b800000000",
"family": "cpu",
"type": "mov",
"reloc": false,
"type_num": 9,
"type2_num": 0
},
{
"offset": 134514074,
"esil": "ebp,esp,=,esp,[4],ebp,=,4,esp,+=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514075,
"size": 1,
"opcode": "leave",
"disasm": "leave",
"bytes": "c9",
"family": "cpu",
"type": "pop",
"reloc": false,
"type_num": 14,
"type2_num": 0
},
{
"offset": 134514075,
"esil": "esp,[4],eip,=,4,esp,+=",
"refptr": false,
"fcn_addr": 134513984,
"fcn_last": 134514075,
"size": 1,
"opcode": "ret",
"disasm": "ret",
"bytes": "c3",
"family": "cpu",
"type": "ret",
"reloc": false,
"type_num": 5,
"type2_num": 0
}
]
EOF
RUN