mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-09 15:00:42 +00:00
1236 lines
31 KiB
Plaintext
1236 lines
31 KiB
Plaintext
NAME=baddr ==
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=!rabin2 -qe ${R2_FILE};!rabin2 -B 0x400000 -qe ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
0x00400410
|
||
0x00400410
|
||
EOF
|
||
RUN
|
||
|
||
NAME=qpe
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=<<EOF
|
||
!!rabin2 -qe ${R2_FILE}
|
||
!!rabin2 -qpe ${R2_FILE}
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x00400410
|
||
0x00000410
|
||
EOF
|
||
RUN
|
||
|
||
NAME=qps
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=<<EOF
|
||
!!rabin2 -qs ${R2_FILE}~main
|
||
!!rabin2 -qps ${R2_FILE}~main
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x004004fc 21 main
|
||
0x004003f0 16 imp.__libc_start_main
|
||
0x000004fc 21 main
|
||
0x000003f0 16 imp.__libc_start_main
|
||
EOF
|
||
RUN
|
||
|
||
NAME=baddr > 0
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=!rabin2 -qe ${R2_FILE};!rabin2 -B 0x800000 -qe ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
0x00400410
|
||
0x00800410
|
||
EOF
|
||
RUN
|
||
|
||
NAME=baddr 0
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=!rabin2 -qe ${R2_FILE};!rabin2 -B 0 -qe ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
0x00400410
|
||
0x00000410
|
||
EOF
|
||
RUN
|
||
|
||
NAME=laddr 0
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=!rabin2 -G 0 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Entrypoints]
|
||
vaddr=0x00400410 paddr=0x00000410 haddr=0x00000018 hvaddr=0x00400018 type=program
|
||
|
||
1 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=laddr 0 && baddr 0
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=!rabin2 -G 0 -B 0 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Entrypoints]
|
||
vaddr=0x00000410 paddr=0x00000410 haddr=0x00000018 hvaddr=0x00000018 type=program
|
||
|
||
1 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin -k file
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=!rabin2 -k ${R2_FILE}
|
||
EXPECT=
|
||
EXPECT_ERR=<<EOF
|
||
[31mERROR: [0mMissing file
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -K md5 -S file
|
||
FILE=bins/pe/a.exe
|
||
CMDS=!rabin2 -K md5 -S ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Sections]
|
||
|
||
nth paddr size vaddr vsize perm md5 name
|
||
-----------------------------------------------------------------------------------
|
||
0 0x00000400 0xa00 0x00401000 0x1000 -r-x 3d6a5b8dc5e41b09659638ad5735e5b5 .text
|
||
1 0x00000e00 0x200 0x00402000 0x1000 -rw- b3c542ba67f2d1a949fa1a25ce22f7e3 .data
|
||
2 0x00001000 0x200 0x00403000 0x1000 -r-- c9a877a4e945b087b8323830442c88d6 .rdata
|
||
3 0x00000000 0x0 0x00404000 0x1000 -rw- .bss
|
||
4 0x00001200 0x400 0x00405000 0x1000 -rw- 963212dc58a74f32e0f6ffce84dcf7ea .idata
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -s file pe
|
||
FILE=bins/pe/a.exe
|
||
CMDS=!!rabin2 -s ${R2_FILE}~?
|
||
EXPECT=<<EOF
|
||
23
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -s file elf
|
||
FILE=bins/elf/analysis/x86-helloworld-gcc
|
||
CMDS=!!rabin2 -s ${R2_FILE}~?
|
||
EXPECT=<<EOF
|
||
68
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -S, -SS, -rS and -rSS file elf
|
||
FILE=bins/elf/analysis/x86-helloworld-gcc
|
||
CMDS=<<EOF
|
||
!!rabin2 -S ${R2_FILE}~?
|
||
!!rabin2 -SS ${R2_FILE}~?
|
||
!env RABIN2_PREFIX=prixfixe rabin2 -S ${R2_FILE}
|
||
!env RABIN2_PREFIX=prixfixe rabin2 -SS ${R2_FILE}
|
||
EOF
|
||
EXPECT=<<EOF
|
||
33
|
||
12
|
||
[Sections]
|
||
|
||
nth paddr size vaddr vsize perm name
|
||
-------------------------------------------------
|
||
0 0x00000000 0x0 0x00000000 0x0 ---- prixfixe.
|
||
1 0x00000134 0x13 0x08048134 0x13 -r-- prixfixe..interp
|
||
2 0x00000148 0x20 0x08048148 0x20 -r-- prixfixe..note.ABI-tag
|
||
3 0x00000168 0x24 0x08048168 0x24 -r-- prixfixe..note.gnu.build-id
|
||
4 0x0000018c 0x20 0x0804818c 0x20 -r-- prixfixe..gnu.hash
|
||
5 0x000001ac 0x50 0x080481ac 0x50 -r-- prixfixe..dynsym
|
||
6 0x000001fc 0x4a 0x080481fc 0x4a -r-- prixfixe..dynstr
|
||
7 0x00000246 0xa 0x08048246 0xa -r-- prixfixe..gnu.version
|
||
8 0x00000250 0x20 0x08048250 0x20 -r-- prixfixe..gnu.version_r
|
||
9 0x00000270 0x8 0x08048270 0x8 -r-- prixfixe..rel.dyn
|
||
10 0x00000278 0x18 0x08048278 0x18 -r-- prixfixe..rel.plt
|
||
11 0x00000290 0x23 0x08048290 0x23 -r-x prixfixe..init
|
||
12 0x000002c0 0x40 0x080482c0 0x40 -r-x prixfixe..plt
|
||
13 0x00000300 0x194 0x08048300 0x194 -r-x prixfixe..text
|
||
14 0x00000494 0x14 0x08048494 0x14 -r-x prixfixe..fini
|
||
15 0x000004a8 0x15 0x080484a8 0x15 -r-- prixfixe..rodata
|
||
16 0x000004c0 0x2c 0x080484c0 0x2c -r-- prixfixe..eh_frame_hdr
|
||
17 0x000004ec 0xb0 0x080484ec 0xb0 -r-- prixfixe..eh_frame
|
||
18 0x0000059c 0x4 0x0804959c 0x4 -rw- prixfixe..init_array
|
||
19 0x000005a0 0x4 0x080495a0 0x4 -rw- prixfixe..fini_array
|
||
20 0x000005a4 0x4 0x080495a4 0x4 -rw- prixfixe..jcr
|
||
21 0x000005a8 0xe8 0x080495a8 0xe8 -rw- prixfixe..dynamic
|
||
22 0x00000690 0x4 0x08049690 0x4 -rw- prixfixe..got
|
||
23 0x00000694 0x18 0x08049694 0x18 -rw- prixfixe..got.plt
|
||
24 0x000006ac 0x8 0x080496ac 0x8 -rw- prixfixe..data
|
||
25 0x000006b4 0x0 0x080496b4 0x4 -rw- prixfixe..bss
|
||
26 0x000006b4 0x11 0x00000000 0x11 ---- prixfixe..comment
|
||
27 0x000006c5 0x106 0x00000000 0x106 ---- prixfixe..shstrtab
|
||
28 0x00000c7c 0x450 0x00000000 0x450 ---- prixfixe..symtab
|
||
29 0x000010cc 0x257 0x00000000 0x257 ---- prixfixe..strtab
|
||
|
||
[Segments]
|
||
|
||
nth paddr size vaddr vsize perm name
|
||
-------------------------------------------------
|
||
0 0x00000034 0x100 0x08048034 0x100 -r-x prixfixe.PHDR
|
||
1 0x00000134 0x13 0x08048134 0x13 -r-- prixfixe.INTERP
|
||
2 0x00000000 0x59c 0x08048000 0x59c -r-x prixfixe.LOAD0
|
||
3 0x0000059c 0x118 0x0804959c 0x11c -rw- prixfixe.LOAD1
|
||
4 0x000005a8 0xe8 0x080495a8 0xe8 -rw- prixfixe.DYNAMIC
|
||
5 0x00000148 0x44 0x08048148 0x44 -r-- prixfixe.NOTE
|
||
6 0x000004c0 0x2c 0x080484c0 0x2c -r-- prixfixe.GNU_EH_FRAME
|
||
7 0x00000000 0x0 0x00000000 0x0 -rw- prixfixe.GNU_STACK
|
||
8 0x00000000 0x34 0x08048000 0x34 -rw- prixfixe.ehdr
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -SSS
|
||
FILE=bins/elf/analysis/x86-helloworld-gcc
|
||
CMDS=!!rabin2 -SSS ${R2_FILE}~?
|
||
EXPECT=<<EOF
|
||
12
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -z pe
|
||
FILE=bins/pe/a.exe
|
||
CMDS=!!rabin2 -z ${R2_FILE}~?
|
||
EXPECT=<<EOF
|
||
7
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -zz pe
|
||
FILE=bins/pe/ioli/w32/crackme0x00.exe
|
||
CMDS=!rabin2 -zz ${R2_FILE} | grep "Password:"
|
||
EXPECT=<<EOF
|
||
86 0x00002619 0x00404019 10 11 .rdata ascii Password:
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -zzz pe
|
||
FILE=bins/pe/ioli/w32/crackme0x00.exe
|
||
CMDS=!rabin2 -zzz ${R2_FILE} | grep "Password:"
|
||
EXPECT=<<EOF
|
||
086 0x00002619 0x00404019 10 11 (.rdata) ascii Password:
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -zzq pe
|
||
FILE=bins/pe/ioli/w32/crackme0x00.exe
|
||
CMDS=!rabin2 -zzq ${R2_FILE} | grep "Password:"
|
||
EXPECT=<<EOF
|
||
0x404019 11 10 Password:
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -zzzq pe
|
||
FILE=bins/pe/ioli/w32/crackme0x00.exe
|
||
CMDS=!rabin2 -zzzq ${R2_FILE} | grep "Password:"
|
||
EXPECT=<<EOF
|
||
0x00404019 Password:
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -zzqq pe
|
||
FILE=bins/pe/ioli/w32/crackme0x00.exe
|
||
CMDS=!rabin2 -zzqq ${R2_FILE} | grep "Password:"
|
||
EXPECT=<<EOF
|
||
Password:
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -zzzqq pe
|
||
FILE=bins/pe/ioli/w32/crackme0x00.exe
|
||
CMDS=!rabin2 -zzzqq ${R2_FILE} | grep "Password:"
|
||
EXPECT=<<EOF
|
||
Password:
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -z elf
|
||
FILE=bins/elf/analysis/x86-helloworld-gcc
|
||
CMDS=!!rabin2 -z ${R2_FILE}~?
|
||
EXPECT=<<EOF
|
||
4
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -G 0x1000 -rs fatmach0
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!!rabin2 -G 0x1000 -rs ${R2_FILE}~f ~?
|
||
EXPECT=<<EOF
|
||
3
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -G 0x1300 -rs fatmach0
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!!rabin2 -G 0x1300 -rs ${R2_FILE}~?
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -G 0x1000 -e fatmach0
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!rabin2 -G 0x1000 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Entrypoints]
|
||
vaddr=0x100000ef8 paddr=0x00001ef8 haddr=0x00000570 type=program
|
||
|
||
1 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -e fatmach0
|
||
BROKEN=1
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!rabin2 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Entrypoints]
|
||
vaddr=0x100000ef8 paddr=0x00001ef8 baddr=0x100000000 laddr=0x00001000 haddr=0x00000570 type=program
|
||
|
||
1 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -G 0x5000 -e fatmach0
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!rabin2 -G 0x5000 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Entrypoints]
|
||
vaddr=0x00001f44 paddr=0x00005f44 haddr=0x00000420 type=program
|
||
|
||
1 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -a x86 -b 32 -e fatmach0
|
||
BROKEN=1
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!rabin2 -a x86 -b 32 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Entrypoints]
|
||
vaddr=0x00001f44 paddr=0x00005f44 baddr=0x00001000 laddr=0x00005000 haddr=0x00000420 type=program
|
||
|
||
1 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -B 0x2000000 -G 0x1000 -e fatmach0
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!rabin2 -B 0x2000000 -G 0x1000 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Entrypoints]
|
||
vaddr=0x02000ef8 paddr=0x00001ef8 haddr=0x00000570 type=program
|
||
|
||
1 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=TODO: test on pie fatmach0
|
||
BROKEN=1
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!rabin2 -B 0x2000000 -G 0x1000 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
???
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -B 0x2000000 -e arm64
|
||
FILE=bins/mach0/hello-ios-arm64
|
||
CMDS=!rabin2 -B 0x2000000 -e ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Entrypoints]
|
||
vaddr=0x02007f34 paddr=0x00007f34 haddr=0x00000468 type=program
|
||
|
||
1 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -a x86 -b 32 -i fatmach0
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!rabin2 -a x86 -b 32 -i ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Imports]
|
||
nth vaddr bind type lib name
|
||
---------------------------------
|
||
0 0x00001f94 NONE FUNC exit
|
||
1 0x00000000 NONE FUNC dyld_stub_binder
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -G 0x5000 -i fatmach0
|
||
FILE=bins/mach0/fatmach0-3true
|
||
CMDS=!rabin2 -G 0x5000 -i ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Imports]
|
||
nth vaddr bind type lib name
|
||
---------------------------------
|
||
0 0x00001f94 NONE FUNC exit
|
||
1 0x00000000 NONE FUNC dyld_stub_binder
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -qqz
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=!rabin2 -qqz ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
Hello World
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -qqzz
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=<<EOF
|
||
!!rabin2 -qqzz ${R2_FILE}~do_global_dtors_aux_fini_array_entry
|
||
!!rabin2 -qqzz ${R2_FILE}~?
|
||
EOF
|
||
EXPECT=<<EOF
|
||
__do_global_dtors_aux_fini_array_entry
|
||
82
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -qqzzz
|
||
FILE=bins/elf/analysis/hello-linux-x86_64
|
||
CMDS=<<EOF
|
||
!!rabin2 -qqzzz ${R2_FILE}~do_global_dtors_aux_fini_array_entry
|
||
!!rabin2 -qqzzz ${R2_FILE}~?
|
||
EOF
|
||
EXPECT=<<EOF
|
||
__do_global_dtors_aux_fini_array_entry
|
||
82
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -qOr
|
||
FILE=bins/elf/analysis/ls-linux-x86_64-zlul
|
||
CMDS=<<EOF
|
||
!rabin2 -qOr/.data/-1 ${FILE}
|
||
!rabin2 -qOr/.data/-1 ${FILE}
|
||
EOF
|
||
EXPECT=<<EOF
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -qOp/.data/rwx on PE32
|
||
FILE=bins/pe/test.exe
|
||
CMDS=<<EOF
|
||
mkdir .tmp
|
||
rm .tmp/rabin2testpe1.exe
|
||
!rabin2 -qOp/.data/rwx -o.tmp/rabin2testpe1.exe ${R2_FILE}
|
||
!rabin2 -S .tmp/rabin2testpe1.exe
|
||
rm .tmp/rabin2testpe1.exe
|
||
EOF
|
||
EXPECT=<<EOF
|
||
wx e0000040 @ 0x244
|
||
[Sections]
|
||
|
||
nth paddr size vaddr vsize perm name
|
||
---------------------------------------------------
|
||
0 0x00000400 0x8a00 0x00401000 0x9000 -r-x .text
|
||
1 0x00008e00 0x2400 0x0040a000 0x3000 -r-- .rdata
|
||
2 0x0000b200 0x1000 0x0040d000 0x3000 -rwx .data
|
||
3 0x0000c200 0x200 0x00410000 0x1000 -r-- .rsrc
|
||
4 0x0000c400 0xe00 0x00411000 0x1000 -r-- .reloc
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -qOp//8 on PE32+
|
||
FILE=bins/pe/normal64.exe
|
||
CMDS=<<EOF
|
||
mkdir .tmp
|
||
rm .tmp/rabin2testpe2.exe
|
||
!rabin2 -qOp//8 -o.tmp/rabin2testpe2.exe ${R2_FILE}
|
||
!rabin2 -S .tmp/rabin2testpe2.exe
|
||
rm .tmp/rabin2testpe2.exe
|
||
EOF
|
||
EXPECT=<<EOF
|
||
wx 10000000 @ 0x16c
|
||
[Sections]
|
||
|
||
nth paddr size vaddr vsize perm name
|
||
--------------------------------------------------
|
||
0 0x00000200 0x200 0x00401000 0x1000 s--- sect_0
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -ee -j
|
||
FILE=bins/elf/analysis/x86-helloworld-gcc
|
||
CMDS=!!rabin2 -ee -j ${R2_FILE}~{}
|
||
EXPECT=<<EOF
|
||
{
|
||
"initfini": [
|
||
{
|
||
"vaddr": 134513616,
|
||
"paddr": 976,
|
||
"baddr": 134512640,
|
||
"laddr": 0,
|
||
"hvaddr": 134518172,
|
||
"hpaddr": 1436,
|
||
"type": "init"
|
||
},
|
||
{
|
||
"vaddr": 134513584,
|
||
"paddr": 944,
|
||
"baddr": 134512640,
|
||
"laddr": 0,
|
||
"hvaddr": 134518176,
|
||
"hpaddr": 1440,
|
||
"type": "fini"
|
||
}
|
||
]
|
||
}
|
||
EOF
|
||
RUN
|
||
|
||
NAME=-ee baddr 0
|
||
FILE=bins/elf/analysis/x86-helloworld-gcc
|
||
CMDS=!rabin2 -ee -B 0 ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Constructors]
|
||
vaddr=0x000003d0 paddr=0x000003d0 hvaddr=0x0000159c hpaddr=0x0000059c type=init
|
||
vaddr=0x000003b0 paddr=0x000003b0 hvaddr=0x000015a0 hpaddr=0x000005a0 type=fini
|
||
|
||
2 entrypoints
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -g
|
||
FILE=bins/elf/analysis/x86-helloworld-gcc
|
||
CMDS=!rabin2 -g ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Sections]
|
||
|
||
nth paddr size vaddr vsize perm name
|
||
-------------------------------------------------
|
||
0 0x00000000 0x0 0x00000000 0x0 ----
|
||
1 0x00000134 0x13 0x08048134 0x13 -r-- .interp
|
||
2 0x00000148 0x20 0x08048148 0x20 -r-- .note.ABI-tag
|
||
3 0x00000168 0x24 0x08048168 0x24 -r-- .note.gnu.build-id
|
||
4 0x0000018c 0x20 0x0804818c 0x20 -r-- .gnu.hash
|
||
5 0x000001ac 0x50 0x080481ac 0x50 -r-- .dynsym
|
||
6 0x000001fc 0x4a 0x080481fc 0x4a -r-- .dynstr
|
||
7 0x00000246 0xa 0x08048246 0xa -r-- .gnu.version
|
||
8 0x00000250 0x20 0x08048250 0x20 -r-- .gnu.version_r
|
||
9 0x00000270 0x8 0x08048270 0x8 -r-- .rel.dyn
|
||
10 0x00000278 0x18 0x08048278 0x18 -r-- .rel.plt
|
||
11 0x00000290 0x23 0x08048290 0x23 -r-x .init
|
||
12 0x000002c0 0x40 0x080482c0 0x40 -r-x .plt
|
||
13 0x00000300 0x194 0x08048300 0x194 -r-x .text
|
||
14 0x00000494 0x14 0x08048494 0x14 -r-x .fini
|
||
15 0x000004a8 0x15 0x080484a8 0x15 -r-- .rodata
|
||
16 0x000004c0 0x2c 0x080484c0 0x2c -r-- .eh_frame_hdr
|
||
17 0x000004ec 0xb0 0x080484ec 0xb0 -r-- .eh_frame
|
||
18 0x0000059c 0x4 0x0804959c 0x4 -rw- .init_array
|
||
19 0x000005a0 0x4 0x080495a0 0x4 -rw- .fini_array
|
||
20 0x000005a4 0x4 0x080495a4 0x4 -rw- .jcr
|
||
21 0x000005a8 0xe8 0x080495a8 0xe8 -rw- .dynamic
|
||
22 0x00000690 0x4 0x08049690 0x4 -rw- .got
|
||
23 0x00000694 0x18 0x08049694 0x18 -rw- .got.plt
|
||
24 0x000006ac 0x8 0x080496ac 0x8 -rw- .data
|
||
25 0x000006b4 0x0 0x080496b4 0x4 -rw- .bss
|
||
26 0x000006b4 0x11 0x00000000 0x11 ---- .comment
|
||
27 0x000006c5 0x106 0x00000000 0x106 ---- .shstrtab
|
||
28 0x00000c7c 0x450 0x00000000 0x450 ---- .symtab
|
||
29 0x000010cc 0x257 0x00000000 0x257 ---- .strtab
|
||
|
||
[Segments]
|
||
|
||
nth paddr size vaddr vsize perm name
|
||
-------------------------------------------------
|
||
0 0x00000034 0x100 0x08048034 0x100 -r-x PHDR
|
||
1 0x00000134 0x13 0x08048134 0x13 -r-- INTERP
|
||
2 0x00000000 0x59c 0x08048000 0x59c -r-x LOAD0
|
||
3 0x0000059c 0x118 0x0804959c 0x11c -rw- LOAD1
|
||
4 0x000005a8 0xe8 0x080495a8 0xe8 -rw- DYNAMIC
|
||
5 0x00000148 0x44 0x08048148 0x44 -r-- NOTE
|
||
6 0x000004c0 0x2c 0x080484c0 0x2c -r-- GNU_EH_FRAME
|
||
7 0x00000000 0x0 0x00000000 0x0 -rw- GNU_STACK
|
||
8 0x00000000 0x34 0x08048000 0x34 -rw- ehdr
|
||
|
||
[Entrypoints]
|
||
vaddr=0x08048300 paddr=0x00000300 haddr=0x00000018 hvaddr=0x08048018 type=program
|
||
|
||
1 entrypoints
|
||
[Constructors]
|
||
vaddr=0x080483d0 paddr=0x000003d0 hvaddr=0x0804959c hpaddr=0x0000059c type=init
|
||
vaddr=0x080483b0 paddr=0x000003b0 hvaddr=0x080495a0 hpaddr=0x000005a0 type=fini
|
||
|
||
2 entrypoints
|
||
[Main]
|
||
vaddr=0x08048400 paddr=0x00000400
|
||
[Imports]
|
||
nth vaddr bind type lib name
|
||
-------------------------------------
|
||
1 0x080482d0 GLOBAL FUNC puts
|
||
2 0x080482e0 WEAK NOTYPE __gmon_start__
|
||
3 0x080482f0 GLOBAL FUNC __libc_start_main
|
||
|
||
[Symbols]
|
||
|
||
nth paddr vaddr bind type size lib name
|
||
-----------------------------------------------------
|
||
4 0x000004ac 0x080484ac GLOBAL OBJ 4 _IO_stdin_used
|
||
1 0x00000134 0x08048134 LOCAL SECT 0 .interp
|
||
2 0x00000148 0x08048148 LOCAL SECT 0 .note.ABI-tag
|
||
3 0x00000168 0x08048168 LOCAL SECT 0 .note.gnu.build-id
|
||
4 0x0000018c 0x0804818c LOCAL SECT 0 .gnu.hash
|
||
5 0x000001ac 0x080481ac LOCAL SECT 0 .dynsym
|
||
6 0x000001fc 0x080481fc LOCAL SECT 0 .dynstr
|
||
7 0x00000246 0x08048246 LOCAL SECT 0 .gnu.version
|
||
8 0x00000250 0x08048250 LOCAL SECT 0 .gnu.version_r
|
||
9 0x00000270 0x08048270 LOCAL SECT 0 .rel.dyn
|
||
10 0x00000278 0x08048278 LOCAL SECT 0 .rel.plt
|
||
11 0x00000290 0x08048290 LOCAL SECT 0 .init
|
||
12 0x000002c0 0x080482c0 LOCAL SECT 0 .plt
|
||
13 0x00000300 0x08048300 LOCAL SECT 0 .text
|
||
14 0x00000494 0x08048494 LOCAL SECT 0 .fini
|
||
15 0x000004a8 0x080484a8 LOCAL SECT 0 .rodata
|
||
16 0x000004c0 0x080484c0 LOCAL SECT 0 .eh_frame_hdr
|
||
17 0x000004ec 0x080484ec LOCAL SECT 0 .eh_frame
|
||
18 0x0000059c 0x0804959c LOCAL SECT 0 .init_array
|
||
19 0x000005a0 0x080495a0 LOCAL SECT 0 .fini_array
|
||
20 0x000005a4 0x080495a4 LOCAL SECT 0 .jcr
|
||
21 0x000005a8 0x080495a8 LOCAL SECT 0 .dynamic
|
||
22 0x00000690 0x08049690 LOCAL SECT 0 .got
|
||
23 0x00000694 0x08049694 LOCAL SECT 0 .got.plt
|
||
24 0x000006ac 0x080496ac LOCAL SECT 0 .data
|
||
25 ---------- 0x080496b4 LOCAL SECT 0 .bss
|
||
26 ---------- 0x00000000 LOCAL SECT 0 .comment
|
||
27 ---------- 0x00000000 LOCAL FILE 0 init.c
|
||
28 ---------- 0x00000000 LOCAL FILE 0
|
||
29 ---------- 0x00000000 LOCAL FILE 0 crtstuff.c
|
||
30 0x000005a4 0x080495a4 LOCAL OBJ 0 __JCR_LIST__
|
||
31 0x00000340 0x08048340 LOCAL FUNC 0 deregister_tm_clones
|
||
32 0x00000370 0x08048370 LOCAL FUNC 0 register_tm_clones
|
||
33 0x000003b0 0x080483b0 LOCAL FUNC 0 __do_global_dtors_aux
|
||
34 ---------- 0x080496b4 LOCAL OBJ 1 completed.5979
|
||
35 0x000005a0 0x080495a0 LOCAL OBJ 0 __do_global_dtors_aux_fini_array_entry
|
||
36 0x000003d0 0x080483d0 LOCAL FUNC 0 frame_dummy
|
||
37 0x0000059c 0x0804959c LOCAL OBJ 0 __frame_dummy_init_array_entry
|
||
38 ---------- 0x00000000 LOCAL FILE 0 hello.c
|
||
39 ---------- 0x00000000 LOCAL FILE 0 crtstuff.c
|
||
40 0x00000598 0x08048598 LOCAL OBJ 0 __FRAME_END__
|
||
41 0x000005a4 0x080495a4 LOCAL OBJ 0 __JCR_END__
|
||
42 ---------- 0x00000000 LOCAL FILE 0
|
||
43 0x000005a0 0x080495a0 LOCAL NOTYPE 0 __init_array_end
|
||
44 0x000005a8 0x080495a8 LOCAL OBJ 0 _DYNAMIC
|
||
45 0x0000059c 0x0804959c LOCAL NOTYPE 0 __init_array_start
|
||
46 0x00000694 0x08049694 LOCAL OBJ 0 _GLOBAL_OFFSET_TABLE_
|
||
47 0x00000490 0x08048490 GLOBAL FUNC 2 __libc_csu_fini
|
||
49 0x00000330 0x08048330 GLOBAL FUNC 4 __x86.get_pc_thunk.bx
|
||
50 0x000006ac 0x080496ac WEAK NOTYPE 0 data_start
|
||
51 ---------- 0x080496b4 GLOBAL NOTYPE 0 _edata
|
||
52 0x00000494 0x08048494 GLOBAL FUNC 0 _fini
|
||
53 0x000006ac 0x080496ac GLOBAL NOTYPE 0 __data_start
|
||
56 0x000006b0 0x080496b0 GLOBAL OBJ 0 __dso_handle
|
||
59 0x00000420 0x08048420 GLOBAL FUNC 97 __libc_csu_init
|
||
60 ---------- 0x080496b8 GLOBAL NOTYPE 0 _end
|
||
61 0x00000300 0x08048300 GLOBAL FUNC 0 _start
|
||
62 0x000004a8 0x080484a8 GLOBAL OBJ 4 _fp_hw
|
||
63 ---------- 0x080496b4 GLOBAL NOTYPE 0 __bss_start
|
||
64 0x00000400 0x08048400 GLOBAL FUNC 28 main
|
||
66 ---------- 0x080496b4 GLOBAL OBJ 0 __TMC_END__
|
||
68 0x00000290 0x08048290 GLOBAL FUNC 0 _init
|
||
1 0x000002d0 0x080482d0 GLOBAL FUNC 16 imp.puts
|
||
2 0x000002e0 0x080482e0 WEAK NOTYPE 16 imp.__gmon_start__
|
||
3 0x000002f0 0x080482f0 GLOBAL FUNC 16 imp.__libc_start_main
|
||
[Strings]
|
||
nth paddr vaddr len size section type string
|
||
-------------------------------------------------------
|
||
0 0x000004b0 0x080484b0 12 13 .rodata ascii Hello world!
|
||
arch x86
|
||
baddr 0x8048000
|
||
binsz 4899
|
||
bintype elf
|
||
bits 32
|
||
canary false
|
||
class ELF32
|
||
compiler GCC: (GNU) 4.8.2
|
||
crypto false
|
||
endian little
|
||
havecode true
|
||
intrp /lib/ld-linux.so.2
|
||
laddr 0x0
|
||
lang c
|
||
linenum true
|
||
lsyms true
|
||
machine Intel 80386
|
||
nx true
|
||
os linux
|
||
pic false
|
||
relocs true
|
||
relro no
|
||
rpath NONE
|
||
sanitize false
|
||
static false
|
||
stripped false
|
||
subsys linux
|
||
va true
|
||
0x00000000 ELF MAGIC 0x464c457f
|
||
0x00000010 Type 0x0002
|
||
0x00000012 Machine 0x0003
|
||
0x00000014 Version 0x00000001
|
||
0x00000018 Entrypoint 0x08048300
|
||
0x0000001c PhOff 0x00000034
|
||
0x00000020 ShOff 0x000007cc
|
||
0x00000024 Flags 0x00000000
|
||
0x00000028 EhSize 52
|
||
0x0000002a PhentSize 32
|
||
0x0000002c PhNum 8
|
||
0x0000002e ShentSize 40
|
||
0x00000030 ShNum 30
|
||
0x00000032 ShrStrndx 27
|
||
[Linked libraries]
|
||
libc.so.6
|
||
|
||
1 library
|
||
[Relocations]
|
||
|
||
vaddr paddr type name
|
||
---------------------------------
|
||
0x08049690 0x00000690 SET_32 __gmon_start__
|
||
0x080496a0 0x000006a0 SET_32 puts
|
||
0x080496a4 0x000006a4 SET_32 __gmon_start__
|
||
0x080496a8 0x000006a8 SET_32 __libc_start_main
|
||
|
||
|
||
4 relocations
|
||
4899
|
||
Version symbols section '.gnu.version' contains 5 entries:
|
||
Addr: 0x08048246 Offset: 0x00000246 Link: 5 (.dynsym)
|
||
0x00000000: 0 (*local*)
|
||
0x00000001: 2 (GLIBC_2.0)
|
||
0x00000002: 0 (*local*)
|
||
0x00000003: 2 (GLIBC_2.0)
|
||
0x00000004: 1 (*global*)
|
||
|
||
|
||
Version need section '.gnu.version_r' contains 1 entries:
|
||
Addr: 0x08048250 Offset: 0x00000250 Link to section: 6 (.dynstr)
|
||
0x00000000: Version: 1 File: libc.so.6 Cnt: 1
|
||
0x00000010: Name: GLIBC_2.0 Flags: none Version: 2
|
||
Section to Segment mapping:
|
||
Segment Section
|
||
--------------------
|
||
PHDR
|
||
INTERP .interp
|
||
LOAD0 .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
|
||
LOAD1 .init_array .fini_array .jcr .dynamic .got .got.plt .data .bss
|
||
DYNAMIC .dynamic
|
||
NOTE .note.ABI-tag .note.gnu.build-id
|
||
GNU_EH_FRAME .eh_frame_hdr
|
||
GNU_STACK
|
||
ehdr
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -x pemixed.exe
|
||
BROKEN=1
|
||
FILE=bins/pe/pemixed.exe
|
||
CMDS=<<EOF
|
||
!rabin2 -x bins/pe/pemixed.exe
|
||
!rm -r pemixed.exe.fat
|
||
EOF
|
||
EXPECT=<<EOF
|
||
pemixed.exe.fat/pemixed.exe.unknown_0.0 created (248)
|
||
pemixed.exe.fat/pemixed.exe.unknown_0.1 created (35328)
|
||
pemixed.exe.fat/pemixed.exe.unknown_0.2 created (35328)
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -I elf_cpp
|
||
FILE=bins/elf/analysis/a.out.cpp
|
||
CMDS=!rabin2 -I ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
arch x86
|
||
baddr 0x0
|
||
binsz 7051
|
||
bintype elf
|
||
bits 64
|
||
canary false
|
||
class ELF64
|
||
compiler GCC: (Ubuntu 7.3.0-16ubuntu3) 7.3.0
|
||
crypto false
|
||
endian little
|
||
havecode true
|
||
intrp /lib64/ld-linux-x86-64.so.2
|
||
laddr 0x0
|
||
lang c++
|
||
linenum true
|
||
lsyms true
|
||
machine AMD x86-64 architecture
|
||
nx true
|
||
os linux
|
||
pic true
|
||
relocs true
|
||
relro full
|
||
rpath NONE
|
||
sanitize false
|
||
static false
|
||
stripped false
|
||
subsys linux
|
||
va true
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -I asan
|
||
FILE=bins/elf/analysis/a.out.asan
|
||
CMDS=!rabin2 -I ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
arch x86
|
||
baddr 0x400000
|
||
binsz 1603255
|
||
bintype elf
|
||
bits 64
|
||
canary false
|
||
class ELF64
|
||
compiler GCC: (Debian 8.2.0-5) 8.2.0 clang version 6.0.1-6 (tags/RELEASE_601/final)
|
||
crypto false
|
||
endian little
|
||
havecode true
|
||
intrp /lib64/ld-linux-x86-64.so.2
|
||
laddr 0x0
|
||
lang c++
|
||
linenum true
|
||
lsyms true
|
||
machine AMD x86-64 architecture
|
||
nx true
|
||
os linux
|
||
pic false
|
||
relocs true
|
||
relro partial
|
||
rpath NONE
|
||
sanitize true
|
||
static false
|
||
stripped false
|
||
subsys linux
|
||
va true
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -I apple-blocks-ext
|
||
FILE=bins/mach0/mach0-blocks-ext
|
||
CMDS=!rabin2 -I ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
arch x86
|
||
baddr 0x100000000
|
||
binsz 9828
|
||
bintype mach0
|
||
bits 64
|
||
canary false
|
||
class MACH064
|
||
compiler clang
|
||
crypto false
|
||
endian little
|
||
havecode true
|
||
intrp /usr/lib/dyld
|
||
laddr 0x0
|
||
lang c++ with blocks
|
||
linenum false
|
||
lsyms false
|
||
machine x86 64 all
|
||
nx false
|
||
os darwin
|
||
pic true
|
||
relocs true
|
||
sanitize false
|
||
static false
|
||
stripped false
|
||
subsys darwin
|
||
va true
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -s right symbols
|
||
FILE=bins/elf/libc.so.0
|
||
CMDS=!rabin2 -s ${R2_FILE} | grep 0002edb0
|
||
EXPECT=<<EOF
|
||
149 0x0002edb0 0x0002edb0 GLOBAL FUNC 356 getc_unlocked
|
||
402 0x0002edb0 0x0002edb0 GLOBAL FUNC 356 __fgetc_unlocked
|
||
980 0x0002edb0 0x0002edb0 GLOBAL FUNC 356 fgetc_unlocked
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -V
|
||
FILE=bins/pe/version_cust.exe
|
||
CMDS=!rabin2 -V ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
=== VS_VERSIONINFO ===
|
||
|
||
# VS_FIXEDFILEINFO
|
||
|
||
Signature: 0xfeef04bd
|
||
StrucVersion: 0x0
|
||
FileVersion: 0.0.0.0
|
||
ProductVersion: 0.0.0.0
|
||
FileFlagsMask: 0x0
|
||
FileFlags: 0x0
|
||
FileOS: 0x0
|
||
FileType: 0x0
|
||
FileSubType: 0x0
|
||
|
||
# StringTable
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -c
|
||
FILE=bins/java/test.class
|
||
CMDS=!rabin2 -c ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
0x00000000 [0x000008f9 - 0x00000b99] 672 class 0 test :: groovy/lang/Script
|
||
0x000008f9 method 0 <init>
|
||
0x0000092e method 1 <init>
|
||
0x0000096e method 2 main
|
||
0x000009ae method 3 run
|
||
0x00000aba method 4 $getStaticMetaClass
|
||
0x00000afb method 5 $createCallSiteArray_1
|
||
0x00000b6a method 6 $createCallSiteArray
|
||
0x00000b99 method 7 $getCallSiteArray
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -cq
|
||
FILE=bins/java/test.class
|
||
CMDS=!rabin2 -cq ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
0x00000000 [0x000008f9 - 0x00000b99] test groovy/lang/Script
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -D swift
|
||
FILE=bins/elf/libc.so.0
|
||
CMDS=!rabin2 -D swift _TFSSCfT21_builtinStringLiteralBp8byteSizeBw7isASCIIBi1__SS
|
||
EXPECT=<<EOF
|
||
Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, byteSize: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -D Unsupported
|
||
FILE=--
|
||
CMDS=!rabin2 -D XXX LOLILOL
|
||
EXPECT_ERR=<<EOF
|
||
[31mERROR: [0mUnsupported demangler
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -h
|
||
FILE=bins/elf/libc.so.0
|
||
CMDS=!rabin2 -h | grep -c Usage
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -O help
|
||
FILE=bins/elf/libc.so.0
|
||
CMDS=!rabin2 -O help | grep -c Usage
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -O h
|
||
FILE=bins/elf/libc.so.0
|
||
CMDS=!rabin2 -O h | grep -c Usage
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -O ?
|
||
FILE=bins/elf/libc.so.0
|
||
CMDS=!rabin2 -O "?" | grep -c Usage
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -O bad op
|
||
FILE=-
|
||
CMDS=!rabin2 -O bad_op -
|
||
EXPECT_ERR=<<EOF
|
||
[31mERROR: [0mUnknown operation. use -O help
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -v
|
||
FILE=-
|
||
CMDS=!rabin2 -v | grep -c build
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -L
|
||
FILE=-
|
||
CMDS=!rabin2 -L | grep -c any
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -Lq
|
||
FILE=-
|
||
CMDS=!rabin2 -Lq | grep -c any
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -Lj
|
||
FILE=-
|
||
CMDS=!rabin2 -Lj | grep -c any
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -Lj any
|
||
FILE=-
|
||
CMDS=!rabin2 -Lj Dummy | grep -c Dummy
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -U
|
||
FILE=bins/pe/resource.exe
|
||
CMDS=!rabin2 -U ${R2_FILE} | grep -c Resource
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -E
|
||
FILE=bins/pe/dll.dll
|
||
CMDS=!rabin2 -E ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
[Exports]
|
||
|
||
nth paddr vaddr bind type size lib name
|
||
-------------------------------------------------------
|
||
0 0x00000224 0x01001024 GLOBAL FUNC 0 dll.dll export
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -l
|
||
FILE=bins/pe/ioli/w32/crackme0x00.exe
|
||
CMDS=!rabin2 -l ${R2_FILE} | grep -c kernel32.dll
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -R
|
||
FILE=bins/pe/base.exe
|
||
CMDS=!rabin2 -R ${R2_FILE} | grep -c msvcrt.dll___set_app_type
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -Z
|
||
FILE=bins/pe/base.exe
|
||
CMDS=!rabin2 -Z ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
216569
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -Zj
|
||
FILE=bins/pe/base.exe
|
||
CMDS=!rabin2 -Zj ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
{"size":216569}
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -H
|
||
FILE=bins/pe/base.exe
|
||
CMDS=!rabin2 -H ${R2_FILE} | grep -c "Machine : 0x14c"
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -d
|
||
FILE=bins/elf/analysis/dwarftest
|
||
CMDS=!rabin2 -d ${R2_FILE} | grep -c "0x00400535 /tmp/r2-regressions/.//dwarftest.c"
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -dj
|
||
FILE=bins/elf/analysis/dwarftest
|
||
CMDS=!rabin2 -dj ${R2_FILE}
|
||
EXPECT=<<EOF
|
||
{"dwarf":[[{"name":"CC","file":"dwarftest.c","line_num":7,"addr":4195637},{"name":"CL","file":"dwarftest.c","line_num":7,"line":"","addr":4195637}],[{"name":"CC","file":"dwarftest.c","line_num":4,"addr":4195629},{"name":"CL","file":"dwarftest.c","line_num":4,"line":"","addr":4195629}],[{"name":"CC","file":"dwarftest.c","line_num":12,"addr":4195673},{"name":"CL","file":"dwarftest.c","line_num":12,"line":"","addr":4195673}],[{"name":"CC","file":"dwarftest.c","line_num":8,"addr":4195646},{"name":"CL","file":"dwarftest.c","line_num":8,"line":"","addr":4195646}],[{"name":"CC","file":"dwarftest.c","line_num":7,"addr":4195660},{"name":"CL","file":"dwarftest.c","line_num":7,"line":"","addr":4195660}],[{"name":"CC","file":"dwarftest.c","line_num":7,"addr":4195656},{"name":"CL","file":"dwarftest.c","line_num":7,"line":"","addr":4195656}],[{"name":"CC","file":"dwarftest.c","line_num":11,"addr":4195666},{"name":"CL","file":"dwarftest.c","line_num":11,"line":"","addr":4195666}],[{"name":"CC","file":"dwarftest.c","line_num":12,"addr":4195671},{"name":"CL","file":"dwarftest.c","line_num":12,"line":"","addr":4195671}]]}
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -P
|
||
FILE=bins/pdb/Project1.pdb
|
||
CMDS=!rabin2 -P ${R2_FILE} | grep -c R2_TEST_UNION
|
||
EXPECT=<<EOF
|
||
1
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -Pj
|
||
FILE=bins/pdb/minimal.pdb
|
||
CMDS=!!rabin2 -B0 -Pj ${R2_FILE}~{}
|
||
EXPECT=<<EOF
|
||
{
|
||
"pdb": {
|
||
"types": [
|
||
{
|
||
"type": "structure",
|
||
"name": "struct_typedef",
|
||
"size": 7,
|
||
"members": [
|
||
{
|
||
"member_type": "char",
|
||
"member_name": "a",
|
||
"offset": 0
|
||
},
|
||
{
|
||
"member_type": "uint16_t",
|
||
"member_name": "b",
|
||
"offset": 1
|
||
},
|
||
{
|
||
"member_type": "int32_t",
|
||
"member_name": "c",
|
||
"offset": 3
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "structure",
|
||
"name": "<unnamed-tag>",
|
||
"size": 4,
|
||
"members": [
|
||
{
|
||
"member_type": "char[4]",
|
||
"member_name": "a",
|
||
"offset": 0
|
||
},
|
||
{
|
||
"member_type": "int32_t",
|
||
"member_name": "b",
|
||
"offset": 0
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "structure",
|
||
"name": "unnamed_member_types_typedef",
|
||
"size": 8,
|
||
"members": [
|
||
{
|
||
"member_type": "union <unnamed-tag>",
|
||
"member_name": "a",
|
||
"offset": 0
|
||
},
|
||
{
|
||
"member_type": "int32_t",
|
||
"member_name": "b",
|
||
"offset": 4
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "structure",
|
||
"name": "bitfield_typedef",
|
||
"size": 1,
|
||
"members": [
|
||
{
|
||
"member_type": "bitfield uint8_t : 1",
|
||
"member_name": "a",
|
||
"offset": 0
|
||
},
|
||
{
|
||
"member_type": "bitfield uint8_t : 2",
|
||
"member_name": "b",
|
||
"offset": 0
|
||
},
|
||
{
|
||
"member_type": "bitfield uint8_t : 3",
|
||
"member_name": "c",
|
||
"offset": 0
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "structure",
|
||
"name": "union_typedef",
|
||
"size": 4,
|
||
"members": [
|
||
{
|
||
"member_type": "char",
|
||
"member_name": "a",
|
||
"offset": 0
|
||
},
|
||
{
|
||
"member_type": "uint16_t",
|
||
"member_name": "b",
|
||
"offset": 0
|
||
},
|
||
{
|
||
"member_type": "int32_t",
|
||
"member_name": "c",
|
||
"offset": 0
|
||
}
|
||
]
|
||
}
|
||
],
|
||
"gvars": [
|
||
{
|
||
"address": 12292,
|
||
"symtype": 0,
|
||
"section_name": ".data",
|
||
"gdata_name": "_uninitialized_global"
|
||
},
|
||
{
|
||
"address": 12288,
|
||
"symtype": 0,
|
||
"section_name": ".data",
|
||
"gdata_name": "_initialized_global"
|
||
},
|
||
{
|
||
"address": 4096,
|
||
"symtype": 2,
|
||
"section_name": ".text",
|
||
"gdata_name": "_function"
|
||
},
|
||
{
|
||
"address": 4182,
|
||
"symtype": 2,
|
||
"section_name": ".text",
|
||
"gdata_name": "_mainCRTStartup"
|
||
},
|
||
{
|
||
"address": 4120,
|
||
"symtype": 2,
|
||
"section_name": ".text",
|
||
"gdata_name": "_main"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
EOF
|
||
RUN
|
||
|
||
NAME=rabin2 -S ""
|
||
FILE=-
|
||
CMDS=!rabin2 -S ""
|
||
EXPECT_ERR=<<EOF
|
||
[31mERROR: [0mCannot open empty path
|
||
EOF
|
||
RUN
|