# PwnTools {{#include ../../../banners/hacktricks-training.md}} ``` pip3 install pwntools ``` ## Pwn asm 라인이나 파일에서 **opcodes**를 가져옵니다. ``` pwn asm "jmp esp" pwn asm -i ``` **선택할 수 있는 항목:** - 출력 유형 (raw, hex, string, elf) - 출력 파일 컨텍스트 (16, 32, 64, linux, windows...) - 피할 바이트 (새 줄, null, 목록) - gdb를 사용하여 디버그 셸코드를 선택하고 출력을 실행 ## **Pwn checksec** Checksec 스크립트 ``` pwn checksec ``` ## Pwn constgrep ## Pwn cyclic 패턴 가져오기 ``` pwn cyclic 3000 pwn cyclic -l faad ``` **선택할 수 있는 항목:** - 사용된 알파벳(기본적으로 소문자 문자) - 고유 패턴의 길이(기본값 4) - 컨텍스트(16,32,64,linux,windows...) - 오프셋 가져오기(-l) ## Pwn 디버그 프로세스에 GDB 연결 ``` pwn debug --exec /bin/bash pwn debug --pid 1234 pwn debug --process bash ``` **선택할 수 있습니다:** - 실행 파일, 이름 또는 pid 컨텍스트(16,32,64,linux,windows...) - 실행할 gdbscript - sysrootpath ## Pwn disablenx 바이너리의 nx 비활성화 ``` pwn disablenx ``` ## Pwn disasm Hex opcode를 디스어셈블합니다. ``` pwn disasm ffe4 ``` **선택할 수 있습니다:** - 컨텍스트 (16,32,64,linux,windows...) - 기본 주소 - 색상(기본)/무색 ## Pwn elfdiff 두 파일 간의 차이를 출력합니다. ``` pwn elfdiff ``` ## Pwn hex 16진수 표현 얻기 ```bash pwn hex hola #Get hex of "hola" ascii ``` ## Pwn phd hexdump 가져오기 ``` pwn phd ``` **선택할 수 있습니다:** - 표시할 바이트 수 - 하이라이트 바이트당 바이트 수 - 시작 부분의 바이트 건너뛰기 ## Pwn pwnstrip ## Pwn scrable ## Pwn shellcraft 쉘코드 가져오기 ``` pwn shellcraft -l #List shellcodes pwn shellcraft -l amd #Shellcode with amd in the name pwn shellcraft -f hex amd64.linux.sh #Create in C and run pwn shellcraft -r amd64.linux.sh #Run to test. Get shell pwn shellcraft .r amd64.linux.bindsh 9095 #Bind SH to port ``` **선택할 수 있는 항목:** - 쉘코드 및 쉘코드에 대한 인수 - 출력 파일 - 출력 형식 - 디버그 (쉘코드에 dbg 연결) - 이전 (코드 이전에 디버그 트랩) - 이후 - opcodes 사용 피하기 (기본값: null 및 새 줄 아님) - 쉘코드 실행 - 색상/무색상 - 시스템 호출 목록 - 가능한 쉘코드 목록 - ELF를 공유 라이브러리로 생성 ## Pwn 템플릿 파이썬 템플릿 가져오기 ``` pwn template ``` **선택할 수 있는 항목:** 호스트, 포트, 사용자, 비밀번호, 경로 및 조용함 ## Pwn unhex 16진수에서 문자열로 ``` pwn unhex 686f6c61 ``` ## Pwn 업데이트 pwntools를 업데이트하려면 ``` pwn update ``` {{#include ../../../banners/hacktricks-training.md}}