2022-05-01 16:32:23 +00:00
2022-04-28 16:01:33 +00:00
< details >
2023-04-25 18:35:28 +00:00
< summary > < a href = "https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology" > < strong > ☁️ HackTricks Cloud ☁️< / strong > < / a > -< a href = "https://twitter.com/hacktricks_live" > < strong > 🐦 Twitter 🐦< / strong > < / a > - < a href = "https://www.twitch.tv/hacktricks_live/schedule" > < strong > 🎙️ Twitch 🎙️< / strong > < / a > - < a href = "https://www.youtube.com/@hacktricks_LIVE" > < strong > 🎥 Youtube 🎥< / strong > < / a > < / summary >
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Do you work in a **cybersecurity company** ? Do you want to see your **company advertised in HackTricks** ? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF** ? Check the [**SUBSCRIPTION PLANS** ](https://github.com/sponsors/carlospolop )!
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Discover [**The PEASS Family** ](https://opensea.io/collection/the-peass-family ), our collection of exclusive [**NFTs** ](https://opensea.io/collection/the-peass-family )
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Get the [**official PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2022-04-28 16:01:33 +00:00
2023-04-25 18:35:28 +00:00
- **Join the** [**💬** ](https://emojipedia.org/speech-balloon/ ) [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** me on **Twitter** [**🐦** ](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md )[**@carlospolopm** ](https://twitter.com/hacktricks_live )**.**
2022-04-28 16:01:33 +00:00
2022-12-05 22:29:21 +00:00
- **Share your hacking tricks by submitting PRs to the [hacktricks repo ](https://github.com/carlospolop/hacktricks ) and [hacktricks-cloud repo ](https://github.com/carlospolop/hacktricks-cloud )**.
2022-04-28 16:01:33 +00:00
< / details >
2022-05-01 16:32:23 +00:00
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
2022-04-05 22:24:52 +00:00
Get opcodes from line or file.
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn asm "jmp esp"
pwn asm -i < filepath >
```
2022-04-05 22:24:52 +00:00
**Can select:**
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
* output type (raw,hex,string,elf)
* output file context (16,32,64,linux,windows...)
2022-04-05 22:24:52 +00:00
* avoid bytes (new lines, null, a list)
2020-07-15 15:43:14 +00:00
* select encoder debug shellcode using gdb run the output
2022-05-01 16:32:23 +00:00
# **Pwn checksec**
2020-07-15 15:43:14 +00:00
2022-04-05 22:24:52 +00:00
Checksec script
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn checksec < executable >
```
2022-05-01 16:32:23 +00:00
# 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
Get a pattern
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn cyclic 3000
pwn cyclic -l faad
```
2022-05-01 16:32:23 +00:00
**Can select:**
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
* The used alphabet (lowercase chars by default)
* Length of uniq pattern (default 4)
* context (16,32,64,linux,windows...)
* Take the offset (-l)
2020-07-15 15:43:14 +00:00
2022-05-01 16:32:23 +00:00
# Pwn debug
2020-07-15 15:43:14 +00:00
Attach GDB to a process
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
```
2022-04-05 22:24:52 +00:00
**Can select:**
2020-07-15 15:43:14 +00:00
2022-04-05 22:24:52 +00:00
* By executable, by name or by pid context (16,32,64,linux,windows...)
* gdbscript to execute
2020-07-15 15:43:14 +00:00
* sysrootpath
2022-05-01 16:32:23 +00:00
# Pwn disablenx
2020-07-15 15:43:14 +00:00
2022-05-01 16:32:23 +00:00
Disable nx of a binary
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn disablenx < filepath >
```
2022-05-01 16:32:23 +00:00
# Pwn disasm
2020-07-15 15:43:14 +00:00
Disas hex opcodes
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn disasm ffe4
```
2022-04-05 22:24:52 +00:00
**Can select:**
2020-07-15 15:43:14 +00:00
2022-04-05 22:24:52 +00:00
* context (16,32,64,linux,windows...)
* base addres
2021-10-18 11:21:18 +00:00
* color(default)/no color
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
Print differences between 2 fiels
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn elfdiff < file1 > < file2 >
```
2022-05-01 16:32:23 +00:00
# Pwn hex
2020-07-15 15:43:14 +00:00
Get hexadecimal representation
```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
2022-04-05 22:24:52 +00:00
Get hexdump
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn phd < file >
```
2022-04-05 22:24:52 +00:00
**Can select:**
2020-07-15 15:43:14 +00:00
2022-04-05 22:24:52 +00:00
* Number of bytes to show
* Number of bytes per line highlight byte
2020-07-15 15:43:14 +00:00
* Skip bytes at beginning
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
Get shellcodes
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
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
```
**Can select:**
* shellcode and arguments for the shellcode
* Out file
* output format
2021-10-18 11:21:18 +00:00
* debug (attach dbg to shellcode)
2022-04-05 22:24:52 +00:00
* before (debug trap before code)
2020-07-15 15:43:14 +00:00
* after
2021-10-18 11:21:18 +00:00
* avoid using opcodes (default: not null and new line)
2020-07-15 15:43:14 +00:00
* Run the shellcode
* Color/no color
2022-04-05 22:24:52 +00:00
* list syscalls
* list possible shellcodes
2020-07-15 15:43:14 +00:00
* Generate ELF as a shared library
2022-05-01 16:32:23 +00:00
# Pwn template
2020-07-15 15:43:14 +00:00
2022-04-05 22:24:52 +00:00
Get a python template
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn template
```
**Can select:** host, port, user, pass, path and quiet
2022-05-01 16:32:23 +00:00
# Pwn unhex
2020-07-15 15:43:14 +00:00
2022-04-05 22:24:52 +00:00
From hex to string
2020-07-15 15:43:14 +00:00
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn unhex 686f6c61
```
2022-05-01 16:32:23 +00:00
# Pwn update
2020-07-15 15:43:14 +00:00
To update pwntools
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
pwn update
```
2022-04-28 16:01:33 +00:00
2022-05-01 16:32:23 +00:00
2022-04-28 16:01:33 +00:00
< details >
2023-04-25 18:35:28 +00:00
< summary > < a href = "https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology" > < strong > ☁️ HackTricks Cloud ☁️< / strong > < / a > -< a href = "https://twitter.com/hacktricks_live" > < strong > 🐦 Twitter 🐦< / strong > < / a > - < a href = "https://www.twitch.tv/hacktricks_live/schedule" > < strong > 🎙️ Twitch 🎙️< / strong > < / a > - < a href = "https://www.youtube.com/@hacktricks_LIVE" > < strong > 🎥 Youtube 🎥< / strong > < / a > < / summary >
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Do you work in a **cybersecurity company** ? Do you want to see your **company advertised in HackTricks** ? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF** ? Check the [**SUBSCRIPTION PLANS** ](https://github.com/sponsors/carlospolop )!
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Discover [**The PEASS Family** ](https://opensea.io/collection/the-peass-family ), our collection of exclusive [**NFTs** ](https://opensea.io/collection/the-peass-family )
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Get the [**official PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2022-04-28 16:01:33 +00:00
2023-04-25 18:35:28 +00:00
- **Join the** [**💬** ](https://emojipedia.org/speech-balloon/ ) [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** me on **Twitter** [**🐦** ](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md )[**@carlospolopm** ](https://twitter.com/hacktricks_live )**.**
2022-04-28 16:01:33 +00:00
2022-12-05 22:29:21 +00:00
- **Share your hacking tricks by submitting PRs to the [hacktricks repo ](https://github.com/carlospolop/hacktricks ) and [hacktricks-cloud repo ](https://github.com/carlospolop/hacktricks-cloud )**.
2022-04-28 16:01:33 +00:00
< / details >
2022-05-01 16:32:23 +00:00