radare2
radare2 copied to clipboard
pe64/pe32+ executable creation not implemented in rabin2
Environment
$ r2 -v
radare2 5.7.7 28621 @ linux-x86-64 git.2.0.1-12325-gff4f83a93
commit: ff4f83a93a1e7b468db25c9bfa1aee17cfe7da0d build: 2022-08-09__19:53:43
$ uname -ms
Linux x86_64
Description
The generation of small pe64/pe32+ binaries not implemented. r_bin_plugin_pe64 does not have .create in it.
455 RBinPlugin r_bin_plugin_pe64 = {
456 .name = "pe64",
457 .desc = "PE64 (PE32+) bin plugin",
458 .license = "LGPL3",
459 .get_sdb = &get_sdb,
460 .load_buffer = &load_buffer,
461 .destroy = &destroy,
462 .check_buffer = &check_buffer,
463 .baddr = &baddr,
464 .binsym = &binsym,
465 .entries = &entries,
466 .sections = §ions,
467 .symbols = &symbols,
468 .imports = &imports,
469 .info = &info,
470 .header = &header,
471 .fields = &fields,
472 .libs = &libs,
473 .relocs = &relocs,
474 .get_vaddr = &get_vaddr,
475 .trycatch = &trycatch,
476 .write = &r_bin_write_pe64,
477 .hashes = &compute_hashes
478 };
Test
ragg2 can be used to check this.
$ ragg2 -o code1.pe64 -f pe -b 64 ./code1.c
'clang' -fPIC -fPIE -pie -fpic -m64 -fno-stack-protector -nostdinc -include '/usr/local/include/libr/sflib'/'linux-x86-64'/sflib.h -z execstack -fomit-frame-pointer -finline-functions -fno-zero-initialized-in-bss -o './code1.c.tmp' -S './code1.c'
clang: warning: -z execstack: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
In file included from <built-in>:1:
/usr/local/include/libr/sflib/linux-x86-64/sflib.h:93:89: warning: declaration of 'struct rusage' will not be visible outside of this function [-Wvisibility]
static inline _sfsyscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, struct rusage *, rusage)
^
/usr/local/include/libr/sflib/linux-x86-64/sflib.h:97:58: warning: declaration of 'struct sembuf' will not be visible outside of this function [-Wvisibility]
static inline _sfsyscall3(int, semop, int, semid, struct sembuf *, sops, unsigned, nsops)
^
2 warnings generated.
'clang' -fPIC -fPIE -pie -fpic -m64 -nostdlib -o './code1.c.o' './code1.c.s'
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 00000000000001f0
**rabin2 -o './code1.c.text' -O d/S/'.text' './code1.c.o'
Cannot create binary for this format 'pe64'.**
Adwaith
@trufae sir any particular reason this is not implemented? Or am I missing something?
no specific reason. just not implemented i guess
i think this is fixed now