System Hacking - GDB basic commands
pwndbg 명령어
entry: 진입점에 중단점을 설정한 후 실행
break(b): 중단점 설정
continue(c): 계속 실행
disassemble: 디스어셈블 결과 출력
u, nearpc, pd: 디스어셈블 결과 가독성 좋게 출력
x: 메모리 조회
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal), t(binary), f(float), a(address), i(instruction), c(char), s(string) and z(hex, zero padded on the left). Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes). ex ) x/10gx $esp -> g(8byte), x(hex) 10개
run(r): 프로그램 처음부터 실행
context: 레지스터, 코드, 스택, 백트레이스의 상태 출력
nexti(ni): 명령어 실행, 함수 내부로는 들어가지 않음
stepi(si): 명령어 실행, 함수 내부로 들어감
finish: 함수 종료
telescope(tele): 메모리 조회, 메모리값이 포인터일 경우 재귀적으로 따라가며 모든 메모리값 출력
vmmap: 메모리 레이아웃 출력
start: main() 심볼이 존재하면 main()에 중단점을 설정한 후 실행. main() 심볼이 없으면 진입점에 중단점을 설정한 후 실행
main: start 명령어와 동일
gdb / python
$()와 함께 파이썬 코드를 입력하면 값을 전달 또는 입력 할 수 있음.
<<<를 사용하면 gdb의 인풋으로 사용 가능
ex ) r $(python3 -c “print(‘\xff’ * 100)”) «< $(python3 -c “print(‘He.llo world’)”)