2024-07-18 18:16:41 +00:00
{% hint style="success" %}
Aprenda e pratique AWS Hacking: < img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks Treinamento AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
Aprenda e pratique GCP Hacking: < img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks Treinamento GCP Red Team Expert (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-18 18:16:41 +00:00
< details >
2022-04-28 16:01:33 +00:00
2024-07-18 18:16:41 +00:00
< summary > Suporte ao HackTricks< / summary >
2022-04-28 16:01:33 +00:00
2024-07-18 18:16:41 +00:00
* Verifique os [**planos de assinatura** ](https://github.com/sponsors/carlospolop )!
* **Junte-se ao** 💬 [**grupo Discord** ](https://discord.gg/hRep4RUj7f ) ou ao [**grupo telegram** ](https://t.me/peass ) ou **siga-nos** no **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **Compartilhe truques de hacking enviando PRs para os repositórios** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) e [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ).
2022-04-28 16:01:33 +00:00
< / details >
2024-07-18 18:16:41 +00:00
{% endhint %}
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pip3 install pwntools
```
2022-05-01 16:32:23 +00:00
# Pwn asm
2020-07-15 15:43:14 +00:00
2024-02-05 03:11:06 +00:00
Obtenha os opcodes de uma linha ou arquivo.
2021-10-18 11:21:18 +00:00
```
2024-02-05 03:11:06 +00:00
pwn asm "jmp esp"
2020-07-15 15:43:14 +00:00
pwn asm -i < filepath >
```
2023-06-06 18:56:34 +00:00
**Pode selecionar:**
2020-07-15 15:43:14 +00:00
2024-02-05 03:11:06 +00:00
* tipo de saída (bruto, hex, string, elf)
* contexto do arquivo de saída (16,32,64,linux,windows...)
* evitar bytes (quebras de linha, nulo, uma lista)
* selecionar codificador de depuração de shellcode usando gdb para executar a saída
2020-07-15 15:43:14 +00:00
2023-06-06 18:56:34 +00:00
# **Pwn checksec**
2024-02-05 03:11:06 +00:00
Script checksec
2023-06-06 18:56:34 +00:00
```
pwn checksec < executable >
```
# Pwn constgrep
2020-07-15 15:43:14 +00:00
2022-05-01 16:32:23 +00:00
# Pwn cyclic
2020-07-15 15:43:14 +00:00
2024-02-05 03:11:06 +00:00
Obtenha um padrão
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn cyclic 3000
pwn cyclic -l faad
```
2023-06-06 18:56:34 +00:00
**Pode selecionar:**
2020-07-15 15:43:14 +00:00
2024-02-05 03:11:06 +00:00
* O alfabeto utilizado (caracteres minúsculos por padrão)
2024-07-18 18:16:41 +00:00
* Comprimento do padrão único (padrão 4 por padrão)
2023-06-06 18:56:34 +00:00
* Contexto (16,32,64,linux,windows...)
2024-02-05 03:11:06 +00:00
* Obter o deslocamento (-l)
2020-07-15 15:43:14 +00:00
2024-02-05 03:11:06 +00:00
# Depuração Pwn
2020-07-15 15:43:14 +00:00
2023-06-06 18:56:34 +00:00
Anexar o GDB a um processo
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn debug --exec /bin/bash
pwn debug --pid 1234
pwn debug --process bash
```
2023-06-06 18:56:34 +00:00
**Pode selecionar:**
2020-07-15 15:43:14 +00:00
2024-07-18 18:16:41 +00:00
* Por executável, por nome ou por contexto de pid (16,32,64,linux,windows...)
* script gdb a ser executado
* caminho do sysroot
2020-07-15 15:43:14 +00:00
2024-07-18 18:16:41 +00:00
# Desabilitar nx
2020-07-15 15:43:14 +00:00
2024-07-18 18:16:41 +00:00
Desabilitar nx de um binário
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn disablenx < filepath >
```
2024-07-18 18:16:41 +00:00
# Desmontar hex opcodes
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn disasm ffe4
```
2023-06-06 18:56:34 +00:00
**Pode selecionar:**
2020-07-15 15:43:14 +00:00
2023-06-06 18:56:34 +00:00
* contexto (16,32,64,linux,windows...)
* endereço base
* cor (padrão)/sem cor
2020-07-15 15:43:14 +00:00
2022-05-01 16:32:23 +00:00
# Pwn elfdiff
2020-07-15 15:43:14 +00:00
2024-02-05 03:11:06 +00:00
Imprime as diferenças entre 2 arquivos
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn elfdiff < file1 > < file2 >
```
2024-07-18 18:16:41 +00:00
# Obter representação hexadecimal
2020-07-15 15:43:14 +00:00
```bash
pwn hex hola #Get hex of "hola" ascii
```
2022-05-01 16:32:23 +00:00
# Pwn phd
2020-07-15 15:43:14 +00:00
2024-07-18 18:16:41 +00:00
Obter despejo hexadecimal
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn phd < file >
```
2023-06-06 18:56:34 +00:00
**Pode selecionar:**
2020-07-15 15:43:14 +00:00
2024-07-18 18:16:41 +00:00
* Número de bytes a mostrar
2024-02-05 03:11:06 +00:00
* Número de bytes por linha para destacar o byte
* Pular bytes no início
2020-07-15 15:43:14 +00:00
2022-05-01 16:32:23 +00:00
# Pwn pwnstrip
2020-07-15 15:43:14 +00:00
2022-05-01 16:32:23 +00:00
# Pwn scrable
2020-07-15 15:43:14 +00:00
2022-05-01 16:32:23 +00:00
# Pwn shellcraft
2020-07-15 15:43:14 +00:00
2024-07-18 18:16:41 +00:00
Obter códigos shell
2021-10-18 11:21:18 +00:00
```
2024-02-05 03:11:06 +00:00
pwn shellcraft -l #List shellcodes
2020-07-15 15:43:14 +00:00
pwn shellcraft -l amd #Shellcode with amd in the name
pwn shellcraft -f hex amd64.linux.sh #Create in C and run
2024-02-05 03:11:06 +00:00
pwn shellcraft -r amd64.linux.sh #Run to test. Get shell
2020-07-15 15:43:14 +00:00
pwn shellcraft .r amd64.linux.bindsh 9095 #Bind SH to port
```
2023-06-06 18:56:34 +00:00
**Pode selecionar:**
2020-07-15 15:43:14 +00:00
2023-06-06 18:56:34 +00:00
* shellcode e argumentos para o shellcode
2024-07-18 18:16:41 +00:00
* Ficheiro de saída
2024-02-05 03:11:06 +00:00
* formato de saída
2024-07-18 18:16:41 +00:00
* debug (anexar dbg ao shellcode)
* antes (armadilha de debug antes do código)
2023-06-06 18:56:34 +00:00
* depois
2024-07-18 18:16:41 +00:00
* evitar o uso de opcodes (predefinição: não nulo e nova linha)
2023-06-06 18:56:34 +00:00
* Executar o shellcode
2024-02-05 03:11:06 +00:00
* Cor/sem cor
2023-06-06 18:56:34 +00:00
* listar syscalls
* listar possíveis shellcodes
2024-07-18 18:16:41 +00:00
* Gerar ELF como uma biblioteca partilhada
2020-07-15 15:43:14 +00:00
2023-06-06 18:56:34 +00:00
# Modelo Pwn
2020-07-15 15:43:14 +00:00
2024-07-18 18:16:41 +00:00
Obter um modelo em Python
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn template
```
2024-02-05 03:11:06 +00:00
**Pode selecionar:** host, porta, usuário, senha, caminho e silencioso
2022-05-01 16:32:23 +00:00
# Pwn unhex
2020-07-15 15:43:14 +00:00
2023-06-06 18:56:34 +00:00
De hexadecimal para string
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn unhex 686f6c61
```
2023-06-06 18:56:34 +00:00
# Atualização do Pwn
2020-07-15 15:43:14 +00:00
2023-06-06 18:56:34 +00:00
Para atualizar o pwntools
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn update
```
2024-07-18 18:16:41 +00:00
{% hint style="success" %}
Aprenda e pratique AWS Hacking: < img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
Aprenda e pratique GCP Hacking: < img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks Training GCP Red Team Expert (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-18 18:16:41 +00:00
< details >
2022-04-28 16:01:33 +00:00
2024-07-18 18:16:41 +00:00
< summary > Suporte o HackTricks< / summary >
2022-04-28 16:01:33 +00:00
2024-07-18 18:16:41 +00:00
* Verifique os [**planos de assinatura** ](https://github.com/sponsors/carlospolop )!
* **Junte-se ao** 💬 [**grupo Discord** ](https://discord.gg/hRep4RUj7f ) ou ao [**grupo telegram** ](https://t.me/peass ) ou **siga-nos** no **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **Compartilhe truques de hacking enviando PRs para os repositórios** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) e [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ).
2022-04-28 16:01:33 +00:00
< / details >
2024-07-18 18:16:41 +00:00
{% endhint %}