mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
149 lines
2.7 KiB
Markdown
149 lines
2.7 KiB
Markdown
# PwnTools
|
|
|
|
{{#include ../../../banners/hacktricks-training.md}}
|
|
```
|
|
pip3 install pwntools
|
|
```
|
|
## Pwn asm
|
|
|
|
Obtenha **opcodes** de linha ou arquivo.
|
|
```
|
|
pwn asm "jmp esp"
|
|
pwn asm -i <filepath>
|
|
```
|
|
**Pode selecionar:**
|
|
|
|
- tipo de saída (raw, hex, string, elf)
|
|
- contexto do arquivo de saída (16, 32, 64, linux, windows...)
|
|
- evitar bytes (novas linhas, nulo, uma lista)
|
|
- selecionar codificador de shellcode de depuração usando gdb para executar a saída
|
|
|
|
## **Verificação de Pwn**
|
|
|
|
Script de checksec
|
|
```
|
|
pwn checksec <executable>
|
|
```
|
|
## Pwn constgrep
|
|
|
|
## Pwn cyclic
|
|
|
|
Obtenha um padrão
|
|
```
|
|
pwn cyclic 3000
|
|
pwn cyclic -l faad
|
|
```
|
|
**Pode selecionar:**
|
|
|
|
- O alfabeto usado (caracteres minúsculos por padrão)
|
|
- Comprimento do padrão único (padrão 4)
|
|
- contexto (16,32,64,linux,windows...)
|
|
- Pegue o deslocamento (-l)
|
|
|
|
## Pwn debug
|
|
|
|
Anexe o GDB a um processo
|
|
```
|
|
pwn debug --exec /bin/bash
|
|
pwn debug --pid 1234
|
|
pwn debug --process bash
|
|
```
|
|
**Pode selecionar:**
|
|
|
|
- Por executável, por nome ou por contexto de pid (16,32,64,linux,windows...)
|
|
- gdbscript para executar
|
|
- sysrootpath
|
|
|
|
## Pwn disablenx
|
|
|
|
Desativar nx de um binário
|
|
```
|
|
pwn disablenx <filepath>
|
|
```
|
|
## Pwn disasm
|
|
|
|
Desassemble opcodes hex
|
|
```
|
|
pwn disasm ffe4
|
|
```
|
|
**Pode selecionar:**
|
|
|
|
- contexto (16,32,64,linux,windows...)
|
|
- endereço base
|
|
- cor(padrão)/sem cor
|
|
|
|
## Pwn elfdiff
|
|
|
|
Imprime as diferenças entre 2 arquivos
|
|
```
|
|
pwn elfdiff <file1> <file2>
|
|
```
|
|
## Pwn hex
|
|
|
|
Obter representação hexadecimal
|
|
```bash
|
|
pwn hex hola #Get hex of "hola" ascii
|
|
```
|
|
## Pwn phd
|
|
|
|
Obter hexdump
|
|
```
|
|
pwn phd <file>
|
|
```
|
|
**Pode selecionar:**
|
|
|
|
- Número de bytes a mostrar
|
|
- Número de bytes por linha para destacar byte
|
|
- Ignorar bytes no início
|
|
|
|
## Pwn pwnstrip
|
|
|
|
## Pwn scrable
|
|
|
|
## Pwn shellcraft
|
|
|
|
Obter shellcodes
|
|
```
|
|
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
|
|
```
|
|
**Pode selecionar:**
|
|
|
|
- shellcode e argumentos para o shellcode
|
|
- Arquivo de saída
|
|
- formato de saída
|
|
- depuração (anexar dbg ao shellcode)
|
|
- antes (trap de depuração antes do código)
|
|
- depois
|
|
- evitar usar opcodes (padrão: não nulo e nova linha)
|
|
- Executar o shellcode
|
|
- Cor/sem cor
|
|
- listar syscalls
|
|
- listar possíveis shellcodes
|
|
- Gerar ELF como uma biblioteca compartilhada
|
|
|
|
## Modelo Pwn
|
|
|
|
Obtenha um modelo em python
|
|
```
|
|
pwn template
|
|
```
|
|
**Pode selecionar:** host, porta, usuário, senha, caminho e silencioso
|
|
|
|
## Pwn unhex
|
|
|
|
De hex para string
|
|
```
|
|
pwn unhex 686f6c61
|
|
```
|
|
## Atualização do Pwn
|
|
|
|
Para atualizar o pwntools
|
|
```
|
|
pwn update
|
|
```
|
|
{{#include ../../../banners/hacktricks-training.md}}
|