Cross-Compiler & Remote Debugging with gdb on Linux
1. Installing Cross-Compiler for MIPS, ARM, PPC, etc...
1 2 3 4 5 6 7 8 9 10 | sudo apt-get install -y gcc-multilib-arm-linux-gnueabi sudo apt-get install -y gcc-multilib-arm-linux-gnueabihf sudo apt-get install -y gcc-multilib-mips-linux-gnu sudo apt-get install -y gcc-multilib-mips64-linux-gnuabi64 sudo apt-get install -y gcc-multilib-mips64el-linux-gnuabi64 sudo apt-get install -y gcc-multilib-mipsel-linux-gnu sudo apt-get install -y gcc-multilib-powerpc-linux-gnu sudo apt-get install -y gcc-multilib-powerpc64-linux-gnu sudo apt-get install -y gcc-multilib-s390x-linux-gnu sudo apt-get install -y gcc-multilib-sparc64-linux-gnu | cs |
- Installing echo architectures' gcc
After installing all of them, u can compile like below.
ARM : arm-linux-gnueabi-gcc
MIPS : mips-linux-gnu-gcc
2. Setup remote debugging for debugging other architecture binary.
1 2 | sudo apt-get install gdb-multiarch sudo apt-get install qemu-user-static | cs |
- Installing gdb for multi-arch and qemu emulator for running other arch binary
1 2 3 4 5 6 7 8 9 10 11 | - Terminal 1 zero@ubuntu:~/Desktop/pwn/ARM$ qemu-arm-static -L /usr/arm-linux-gnueabi -g 7777 ./a - Terminal 2 zero@ubuntu:~/Desktop/pwn/ARM$ gdb-multiarch -q gdb-peda$ target remote localhost:7777 Remote debugging using localhost:7777 warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. Warning: not running or target is remote 0x00008054 in ?? () | cs |
MIPS is also similar. qemu-mips-static -L /usr/mips-linux-gnu -g 7777 ./a
'Security > Reverse Engineering' 카테고리의 다른 글
[Reversing] ASLR 기능 제거하기 (0) | 2014.04.26 |
---|---|
[Reversing] Basic Knowlodge about IA-32 Registry (0) | 2014.04.26 |
[Reversing] About Reversing?? (0) | 2014.04.26 |