pwntools

pwntoolsの使い方

以下のファイルをコンパイルする

#include <iostream>
#include <string>

int main(){
  std::string input;
  std::cin >> input;

  if(input == "\x01\x02\x03\x04\x05"){
    std::cout << "success" << std::endl;
  } else {
    std::cout << "fail" << std::endl;
  }

  return 0;
}

pwntoolsで印字不可能文字を渡す

from pwn import *

p = process('./a.out')
p.sendline('\x01\x02\x03\x04\x05')
print(p.recvline())

以下の出力が得られる

[+] Starting local process './a.out': pid 28875
success

[*] Process './a.out' stopped with exit code 0 (pid 28875)