radare2/test/db/cmd/cmd_pc

325 lines
15 KiB
Plaintext

NAME=pc hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pc
EXPECT=<<EOF
#define _BUFFER_SIZE 256
const uint8_t buffer[_BUFFER_SIZE] = {
0x31, 0xed, 0x49, 0x89, 0xd1, 0x5e, 0x48, 0x89, 0xe2, 0x48,
0x83, 0xe4, 0xf0, 0x50, 0x54, 0x49, 0xc7, 0xc0, 0xb0, 0x05,
0x40, 0x00, 0x48, 0xc7, 0xc1, 0x20, 0x05, 0x40, 0x00, 0x48,
0xc7, 0xc7, 0xfc, 0x04, 0x40, 0x00, 0xe8, 0xb7, 0xff, 0xff,
0xff, 0xf4, 0x66, 0x90, 0x0f, 0x1f, 0x40, 0x00, 0xb8, 0x17,
0x09, 0x60, 0x00, 0x55, 0x48, 0x2d, 0x10, 0x09, 0x60, 0x00,
0x48, 0x83, 0xf8, 0x0e, 0x48, 0x89, 0xe5, 0x77, 0x02, 0x5d,
0xc3, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74,
0xf4, 0x5d, 0xbf, 0x10, 0x09, 0x60, 0x00, 0xff, 0xe0, 0x0f,
0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x10, 0x09, 0x60,
0x00, 0x55, 0x48, 0x2d, 0x10, 0x09, 0x60, 0x00, 0x48, 0xc1,
0xf8, 0x03, 0x48, 0x89, 0xe5, 0x48, 0x89, 0xc2, 0x48, 0xc1,
0xea, 0x3f, 0x48, 0x01, 0xd0, 0x48, 0x89, 0xc6, 0x48, 0xd1,
0xfe, 0x75, 0x02, 0x5d, 0xc3, 0xba, 0x00, 0x00, 0x00, 0x00,
0x48, 0x85, 0xd2, 0x74, 0xf4, 0x5d, 0xbf, 0x10, 0x09, 0x60,
0x00, 0xff, 0xe2, 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00,
0x80, 0x3d, 0x59, 0x04, 0x20, 0x00, 0x00, 0x75, 0x11, 0x55,
0x48, 0x89, 0xe5, 0xe8, 0x7e, 0xff, 0xff, 0xff, 0x5d, 0xc6,
0x05, 0x46, 0x04, 0x20, 0x00, 0x01, 0xf3, 0xc3, 0x0f, 0x1f,
0x40, 0x00, 0x48, 0x83, 0x3d, 0x18, 0x02, 0x20, 0x00, 0x00,
0x74, 0x1b, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0,
0x74, 0x11, 0x55, 0xbf, 0xf0, 0x06, 0x60, 0x00, 0x48, 0x89,
0xe5, 0xff, 0xd0, 0x5d, 0xe9, 0x7b, 0xff, 0xff, 0xff, 0xe9,
0x76, 0xff, 0xff, 0xff, 0x66, 0x90, 0x55, 0x48, 0x89, 0xe5,
0xbf, 0xc4, 0x05, 0x40, 0x00, 0xe8, 0xd6, 0xfe, 0xff, 0xff,
0xb8, 0x00, 0x00, 0x00, 0x00, 0x5d
};
EOF
RUN
NAME=pc* hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pc*
EXPECT=<<EOF
wx 31ed4989d15e4889e24883e4f0505449;s+16
wx c7c0b005400048c7c12005400048c7c7;s+16
wx fc044000e8b7fffffff466900f1f4000;s+16
wx b81709600055482d100960004883f80e;s+16
wx 4889e577025dc3b8000000004885c074;s+16
wx f45dbf10096000ffe00f1f8000000000;s+16
wx b81009600055482d1009600048c1f803;s+16
wx 4889e54889c248c1ea3f4801d04889c6;s+16
wx 48d1fe75025dc3ba000000004885d274;s+16
wx f45dbf10096000ffe20f1f8000000000;s+16
wx 803d59042000007511554889e5e87eff;s+16
wx ffff5dc6054604200001f3c30f1f4000;s+16
wx 48833d1802200000741bb80000000048;s+16
wx 85c0741155bff00660004889e5ffd05d;s+16
wx e97bffffffe976ffffff6690554889e5;s+16
wx bfc4054000e8d6feffffb8000000005d;s+16
s-256
EOF
RUN
NAME=pch hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pch
EXPECT=<<EOF
#define _BUFFER_SIZE 128
const uint16_t buffer[_BUFFER_SIZE] = {
0xed31, 0x8949, 0x5ed1, 0x8948, 0x48e2, 0xe483, 0x50f0, 0x4954,
0xc0c7, 0x05b0, 0x0040, 0xc748, 0x20c1, 0x4005, 0x4800, 0xc7c7,
0x04fc, 0x0040, 0xb7e8, 0xffff, 0xf4ff, 0x9066, 0x1f0f, 0x0040,
0x17b8, 0x6009, 0x5500, 0x2d48, 0x0910, 0x0060, 0x8348, 0x0ef8,
0x8948, 0x77e5, 0x5d02, 0xb8c3, 0x0000, 0x0000, 0x8548, 0x74c0,
0x5df4, 0x10bf, 0x6009, 0xff00, 0x0fe0, 0x801f, 0x0000, 0x0000,
0x10b8, 0x6009, 0x5500, 0x2d48, 0x0910, 0x0060, 0xc148, 0x03f8,
0x8948, 0x48e5, 0xc289, 0xc148, 0x3fea, 0x0148, 0x48d0, 0xc689,
0xd148, 0x75fe, 0x5d02, 0xbac3, 0x0000, 0x0000, 0x8548, 0x74d2,
0x5df4, 0x10bf, 0x6009, 0xff00, 0x0fe2, 0x801f, 0x0000, 0x0000,
0x3d80, 0x0459, 0x0020, 0x7500, 0x5511, 0x8948, 0xe8e5, 0xff7e,
0xffff, 0xc65d, 0x4605, 0x2004, 0x0100, 0xc3f3, 0x1f0f, 0x0040,
0x8348, 0x183d, 0x2002, 0x0000, 0x1b74, 0x00b8, 0x0000, 0x4800,
0xc085, 0x1174, 0xbf55, 0x06f0, 0x0060, 0x8948, 0xffe5, 0x5dd0,
0x7be9, 0xffff, 0xe9ff, 0xff76, 0xffff, 0x9066, 0x4855, 0xe589,
0xc4bf, 0x4005, 0xe800, 0xfed6, 0xffff, 0x00b8, 0x0000, 0x5d00
};
EOF
RUN
NAME=pcw hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pcw
EXPECT=<<EOF
#define _BUFFER_SIZE 64
const uint32_t buffer[_BUFFER_SIZE] = {
0x8949ed31U, 0x89485ed1U, 0xe48348e2U, 0x495450f0U, 0x05b0c0c7U,
0xc7480040U, 0x400520c1U, 0xc7c74800U, 0x004004fcU, 0xffffb7e8U,
0x9066f4ffU, 0x00401f0fU, 0x600917b8U, 0x2d485500U, 0x00600910U,
0x0ef88348U, 0x77e58948U, 0xb8c35d02U, 0x00000000U, 0x74c08548U,
0x10bf5df4U, 0xff006009U, 0x801f0fe0U, 0x00000000U, 0x600910b8U,
0x2d485500U, 0x00600910U, 0x03f8c148U, 0x48e58948U, 0xc148c289U,
0x01483feaU, 0xc68948d0U, 0x75fed148U, 0xbac35d02U, 0x00000000U,
0x74d28548U, 0x10bf5df4U, 0xff006009U, 0x801f0fe2U, 0x00000000U,
0x04593d80U, 0x75000020U, 0x89485511U, 0xff7ee8e5U, 0xc65dffffU,
0x20044605U, 0xc3f30100U, 0x00401f0fU, 0x183d8348U, 0x00002002U,
0x00b81b74U, 0x48000000U, 0x1174c085U, 0x06f0bf55U, 0x89480060U,
0x5dd0ffe5U, 0xffff7be9U, 0xff76e9ffU, 0x9066ffffU, 0xe5894855U,
0x4005c4bfU, 0xfed6e800U, 0x00b8ffffU, 0x5d000000U
};
EOF
RUN
NAME=pcd hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pcd
EXPECT=<<EOF
#define _BUFFER_SIZE 32
const uint64_t buffer[_BUFFER_SIZE] = {
0x89485ed18949ed31ULL, 0x495450f0e48348e2ULL, 0xc748004005b0c0c7ULL,
0xc7c74800400520c1ULL, 0xffffb7e8004004fcULL, 0x00401f0f9066f4ffULL,
0x2d485500600917b8ULL, 0x0ef8834800600910ULL, 0xb8c35d0277e58948ULL,
0x74c0854800000000ULL, 0xff00600910bf5df4ULL, 0x00000000801f0fe0ULL,
0x2d485500600910b8ULL, 0x03f8c14800600910ULL, 0xc148c28948e58948ULL,
0xc68948d001483feaULL, 0xbac35d0275fed148ULL, 0x74d2854800000000ULL,
0xff00600910bf5df4ULL, 0x00000000801f0fe2ULL, 0x7500002004593d80ULL,
0xff7ee8e589485511ULL, 0x20044605c65dffffULL, 0x00401f0fc3f30100ULL,
0x00002002183d8348ULL, 0x4800000000b81b74ULL, 0x06f0bf551174c085ULL,
0x5dd0ffe589480060ULL, 0xff76e9ffffff7be9ULL, 0xe58948559066ffffULL,
0xfed6e8004005c4bfULL, 0x5d00000000b8ffffULL
};
EOF
RUN
NAME=pca hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pca
EXPECT=<<EOF
shellcode:
.byte 0x31, 0xed, 0x49, 0x89, 0xd1, 0x5e, 0x48, 0x89
.byte 0xe2, 0x48, 0x83, 0xe4, 0xf0, 0x50, 0x54, 0x49
.byte 0xc7, 0xc0, 0xb0, 0x05, 0x40, 0x00, 0x48, 0xc7
.byte 0xc1, 0x20, 0x05, 0x40, 0x00, 0x48, 0xc7, 0xc7
.byte 0xfc, 0x04, 0x40, 0x00, 0xe8, 0xb7, 0xff, 0xff
.byte 0xff, 0xf4, 0x66, 0x90, 0x0f, 0x1f, 0x40, 0x00
.byte 0xb8, 0x17, 0x09, 0x60, 0x00, 0x55, 0x48, 0x2d
.byte 0x10, 0x09, 0x60, 0x00, 0x48, 0x83, 0xf8, 0x0e
.byte 0x48, 0x89, 0xe5, 0x77, 0x02, 0x5d, 0xc3, 0xb8
.byte 0x00, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74
.byte 0xf4, 0x5d, 0xbf, 0x10, 0x09, 0x60, 0x00, 0xff
.byte 0xe0, 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00
.byte 0xb8, 0x10, 0x09, 0x60, 0x00, 0x55, 0x48, 0x2d
.byte 0x10, 0x09, 0x60, 0x00, 0x48, 0xc1, 0xf8, 0x03
.byte 0x48, 0x89, 0xe5, 0x48, 0x89, 0xc2, 0x48, 0xc1
.byte 0xea, 0x3f, 0x48, 0x01, 0xd0, 0x48, 0x89, 0xc6
.byte 0x48, 0xd1, 0xfe, 0x75, 0x02, 0x5d, 0xc3, 0xba
.byte 0x00, 0x00, 0x00, 0x00, 0x48, 0x85, 0xd2, 0x74
.byte 0xf4, 0x5d, 0xbf, 0x10, 0x09, 0x60, 0x00, 0xff
.byte 0xe2, 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00
.byte 0x80, 0x3d, 0x59, 0x04, 0x20, 0x00, 0x00, 0x75
.byte 0x11, 0x55, 0x48, 0x89, 0xe5, 0xe8, 0x7e, 0xff
.byte 0xff, 0xff, 0x5d, 0xc6, 0x05, 0x46, 0x04, 0x20
.byte 0x00, 0x01, 0xf3, 0xc3, 0x0f, 0x1f, 0x40, 0x00
.byte 0x48, 0x83, 0x3d, 0x18, 0x02, 0x20, 0x00, 0x00
.byte 0x74, 0x1b, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x48
.byte 0x85, 0xc0, 0x74, 0x11, 0x55, 0xbf, 0xf0, 0x06
.byte 0x60, 0x00, 0x48, 0x89, 0xe5, 0xff, 0xd0, 0x5d
.byte 0xe9, 0x7b, 0xff, 0xff, 0xff, 0xe9, 0x76, 0xff
.byte 0xff, 0xff, 0x66, 0x90, 0x55, 0x48, 0x89, 0xe5
.byte 0xbf, 0xc4, 0x05, 0x40, 0x00, 0xe8, 0xd6, 0xfe
.byte 0xff, 0xff, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x5d
.equ shellcode_len, 256
EOF
RUN
NAME=pcs hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pcs
EXPECT=<<EOF
"\x31\xed\x49\x89\xd1\x5e\x48\x89\xe2\x48\x83\xe4\xf0\x50\x54\x49\xc7\xc0\xb0\x05\x40\x00\x48\xc7\xc1\x20\x05\x40\x00\x48\xc7\xc7\xfc\x04\x40\x00\xe8\xb7\xff\xff\xff\xf4\x66\x90\x0f\x1f\x40\x00\xb8\x17\x09\x60\x00\x55\x48\x2d\x10\x09\x60\x00\x48\x83\xf8\x0e\x48\x89\xe5\x77\x02\x5d\xc3\xb8\x00\x00\x00\x00\x48\x85\xc0\x74\xf4\x5d\xbf\x10\x09\x60\x00\xff\xe0\x0f\x1f\x80\x00\x00\x00\x00\xb8\x10\x09\x60\x00\x55\x48\x2d\x10\x09\x60\x00\x48\xc1\xf8\x03\x48\x89\xe5\x48\x89\xc2\x48\xc1\xea\x3f\x48\x01\xd0\x48\x89\xc6\x48\xd1\xfe\x75\x02\x5d\xc3\xba\x00\x00\x00\x00\x48\x85\xd2\x74\xf4\x5d\xbf\x10\x09\x60\x00\xff\xe2\x0f\x1f\x80\x00\x00\x00\x00\x80\x3d\x59\x04\x20\x00\x00\x75\x11\x55\x48\x89\xe5\xe8\x7e\xff\xff\xff\x5d\xc6\x05\x46\x04\x20\x00\x01\xf3\xc3\x0f\x1f\x40\x00\x48\x83\x3d\x18\x02\x20\x00\x00\x74\x1b\xb8\x00\x00\x00\x00\x48\x85\xc0\x74\x11\x55\xbf\xf0\x06\x60\x00\x48\x89\xe5\xff\xd0\x5d\xe9\x7b\xff\xff\xff\xe9\x76\xff\xff\xff\x66\x90\x55\x48\x89\xe5\xbf\xc4\x05\x40\x00\xe8\xd6\xfe\xff\xff\xb8\x00\x00\x00\x00\x5d"
EOF
RUN
NAME=pcS hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pcS
EXPECT=<<EOF
printf "\061\355\111\211\321\136\110\211\342\110\203\344\360\120\124\111" > bin
printf "\307\300\260\005\100\000\110\307\301\040\005\100\000\110\307\307" >> bin
printf "\374\004\100\000\350\267\377\377\377\364\146\220\017\037\100\000" >> bin
printf "\270\027\011\140\000\125\110\055\020\011\140\000\110\203\370\016" >> bin
printf "\110\211\345\167\002\135\303\270\000\000\000\000\110\205\300\164" >> bin
printf "\364\135\277\020\011\140\000\377\340\017\037\200\000\000\000\000" >> bin
printf "\270\020\011\140\000\125\110\055\020\011\140\000\110\301\370\003" >> bin
printf "\110\211\345\110\211\302\110\301\352\077\110\001\320\110\211\306" >> bin
printf "\110\321\376\165\002\135\303\272\000\000\000\000\110\205\322\164" >> bin
printf "\364\135\277\020\011\140\000\377\342\017\037\200\000\000\000\000" >> bin
printf "\200\075\131\004\040\000\000\165\021\125\110\211\345\350\176\377" >> bin
printf "\377\377\135\306\005\106\004\040\000\001\363\303\017\037\100\000" >> bin
printf "\110\203\075\030\002\040\000\000\164\033\270\000\000\000\000\110" >> bin
printf "\205\300\164\021\125\277\360\006\140\000\110\211\345\377\320\135" >> bin
printf "\351\173\377\377\377\351\166\377\377\377\146\220\125\110\211\345" >> bin
printf "\277\304\005\100\000\350\326\376\377\377\270\000\000\000\000\135" >> bin
EOF
RUN
NAME=pcJ hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pcJ
EXPECT=<<EOF
var buffer = new Buffer("Me1JidFeSIniSIPk8FBUScfAsAVAAEjHwSAFQABIx8f8BEAA6Lf////0ZpAPH0AAuBcJYABVSC0QCWAASIP4DkiJ5XcCXcO4AAAAAEiFwHT0Xb8QCWAA/+APH4AAAAAAuBAJYABVSC0QCWAASMH4A0iJ5UiJwkjB6j9IAdBIicZI0f51Al3DugAAAABIhdJ09F2/EAlgAP/iDx+AAAAAAIA9WQQgAAB1EVVIieXofv///13GBUYEIAAB88MPH0AASIM9GAIgAAB0G7gAAAAASIXAdBFVv/AGYABIieX/0F3pe////+l2////ZpBVSInlv8QFQADo1v7//7gAAAAAXQ==", 'base64');
EOF
RUN
NAME=pcj hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pcj
EXPECT=<<EOF
[49,237,73,137,209,94,72,137,226,72,131,228,240,80,84,73,199,192,176,5,64,0,72,199,193,32,5,64,0,72,199,199,252,4,64,0,232,183,255,255,255,244,102,144,15,31,64,0,184,23,9,96,0,85,72,45,16,9,96,0,72,131,248,14,72,137,229,119,2,93,195,184,0,0,0,0,72,133,192,116,244,93,191,16,9,96,0,255,224,15,31,128,0,0,0,0,184,16,9,96,0,85,72,45,16,9,96,0,72,193,248,3,72,137,229,72,137,194,72,193,234,63,72,1,208,72,137,198,72,209,254,117,2,93,195,186,0,0,0,0,72,133,210,116,244,93,191,16,9,96,0,255,226,15,31,128,0,0,0,0,128,61,89,4,32,0,0,117,17,85,72,137,229,232,126,255,255,255,93,198,5,70,4,32,0,1,243,195,15,31,64,0,72,131,61,24,2,32,0,0,116,27,184,0,0,0,0,72,133,192,116,17,85,191,240,6,96,0,72,137,229,255,208,93,233,123,255,255,255,233,118,255,255,255,102,144,85,72,137,229,191,196,5,64,0,232,214,254,255,255,184,0,0,0,0,93]
EOF
RUN
NAME=pcp hello-linux-x86_64
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=pcp
EXPECT=<<EOF
import struct
buf = struct.pack ("256B", *[
0x31,0xed,0x49,0x89,0xd1,0x5e,0x48,0x89,0xe2,0x48,0x83,
0xe4,0xf0,0x50,0x54,0x49,0xc7,0xc0,0xb0,0x05,0x40,0x00,
0x48,0xc7,0xc1,0x20,0x05,0x40,0x00,0x48,0xc7,0xc7,0xfc,
0x04,0x40,0x00,0xe8,0xb7,0xff,0xff,0xff,0xf4,0x66,0x90,
0x0f,0x1f,0x40,0x00,0xb8,0x17,0x09,0x60,0x00,0x55,0x48,
0x2d,0x10,0x09,0x60,0x00,0x48,0x83,0xf8,0x0e,0x48,0x89,
0xe5,0x77,0x02,0x5d,0xc3,0xb8,0x00,0x00,0x00,0x00,0x48,
0x85,0xc0,0x74,0xf4,0x5d,0xbf,0x10,0x09,0x60,0x00,0xff,
0xe0,0x0f,0x1f,0x80,0x00,0x00,0x00,0x00,0xb8,0x10,0x09,
0x60,0x00,0x55,0x48,0x2d,0x10,0x09,0x60,0x00,0x48,0xc1,
0xf8,0x03,0x48,0x89,0xe5,0x48,0x89,0xc2,0x48,0xc1,0xea,
0x3f,0x48,0x01,0xd0,0x48,0x89,0xc6,0x48,0xd1,0xfe,0x75,
0x02,0x5d,0xc3,0xba,0x00,0x00,0x00,0x00,0x48,0x85,0xd2,
0x74,0xf4,0x5d,0xbf,0x10,0x09,0x60,0x00,0xff,0xe2,0x0f,
0x1f,0x80,0x00,0x00,0x00,0x00,0x80,0x3d,0x59,0x04,0x20,
0x00,0x00,0x75,0x11,0x55,0x48,0x89,0xe5,0xe8,0x7e,0xff,
0xff,0xff,0x5d,0xc6,0x05,0x46,0x04,0x20,0x00,0x01,0xf3,
0xc3,0x0f,0x1f,0x40,0x00,0x48,0x83,0x3d,0x18,0x02,0x20,
0x00,0x00,0x74,0x1b,0xb8,0x00,0x00,0x00,0x00,0x48,0x85,
0xc0,0x74,0x11,0x55,0xbf,0xf0,0x06,0x60,0x00,0x48,0x89,
0xe5,0xff,0xd0,0x5d,0xe9,0x7b,0xff,0xff,0xff,0xe9,0x76,
0xff,0xff,0xff,0x66,0x90,0x55,0x48,0x89,0xe5,0xbf,0xc4,
0x05,0x40,0x00,0xe8,0xd6,0xfe,0xff,0xff,0xb8,0x00,0x00,
0x00,0x00,0x5d])
EOF
RUN
NAME=pc -10
FILE=malloc://1024
CMDS=wx 90909090909090909090 ; s 10 ; pc - 10
EXPECT=<<EOF
#define _BUFFER_SIZE 10
const uint8_t buffer[_BUFFER_SIZE] = {
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90
};
EOF
RUN
NAME=pci1
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wa nop
pci 1
EOF
EXPECT=<<EOF
#define _BUFFER_SIZE 1
const uint8_t buffer[_BUFFER_SIZE] = {
0x90, /* nop */
};
EOF
RUN
NAME=pci
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=<<EOF
pci 29
pci -10
EOF
EXPECT=<<EOF
#define _BUFFER_SIZE 29
const uint8_t buffer[_BUFFER_SIZE] = {
0x31, 0xed, /* xor ebp, ebp */
0x49, 0x89, 0xd1, /* mov r9, rdx */
0x5e, /* pop rsi */
0x48, 0x89, 0xe2, /* mov rdx, rsp */
0x48, 0x83, 0xe4, 0xf0, /* and rsp, 0xfffffffffffffff0 */
0x50, /* push rax */
0x54, /* push rsp */
0x49, 0xc7, 0xc0, 0xb0, 0x05, 0x40, 0x00, /* mov r8, sym.__libc_csu_fini */
0x48, 0xc7, 0xc1, 0x20, 0x05, 0x40, 0x00, /* mov rcx, sym.__libc_csu_init */
};
#define _BUFFER_SIZE 10
const uint8_t buffer[_BUFFER_SIZE] = {
0x68, 0x02, 0x00, 0x00, 0x00, /* push 2 */
0xe9, 0xc0, 0xff, 0xff, 0xff, /* jmp sym..plt */
};
EOF
RUN
NAME=pci invalid
CMDS=pci 32
FILE=bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
#define _BUFFER_SIZE 32
const uint8_t buffer[_BUFFER_SIZE] = {
0x31, 0xed, /* xor ebp, ebp */
0x49, 0x89, 0xd1, /* mov r9, rdx */
0x5e, /* pop rsi */
0x48, 0x89, 0xe2, /* mov rdx, rsp */
0x48, 0x83, 0xe4, 0xf0, /* and rsp, 0xfffffffffffffff0 */
0x50, /* push rax */
0x54, /* push rsp */
0x49, 0xc7, 0xc0, 0xb0, 0x05, 0x40, 0x00, /* mov r8, sym.__libc_csu_fini */
0x48, 0xc7, 0xc1, 0x20, 0x05, 0x40, 0x00, /* mov rcx, sym.__libc_csu_init */
0x48, 0xc7, 0xc7, /* invalid */
};
EOF
RUN