# PwnTools

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS Red Team Expert）</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想在HackTricks中看到您的**公司广告**或**下载PDF版本的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或 **关注**我们的**Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>

\`\`\` pip3 install pwntools \`\`\` ## Pwn asm

从行或文件获取**操作码**。

```
pwn asm "jmp esp"
pwn asm -i <filepath>
```

**可选项:**

* 输出类型 (原始,十六进制,字符串,elf)
* 输出文件内容 (16,32,64,linux,windows...)
* 避免字节 (换行符,空字符,列表)
* 选择使用gdb运行输出的编码器调试shellcode

## **Pwn checksec**

Checksec脚本

```
pwn checksec <executable>
```

## 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
* sysroot路径

## 禁用二进制文件的nx

```
pwn disablenx <filepath>
```

## Pwn disasm

反汇编十六进制操作码

```
pwn disasm ffe4
```

**可选项:**

* 上下文 (16,32,64,linux,windows...)
* 基地址
* 颜色(默认)/无颜色

## Pwn elfdiff

打印两个文件之间的差异

```
pwn elfdiff <file1> <file2>
```

## 十六进制转换

获取十六进制表示形式

```bash
pwn hex hola #Get hex of "hola" ascii
```

## Pwn phd

获取十六进制转储

```
pwn phd <file>
```

**可以选择:**

* 要显示的字节数
* 每行要突出显示的字节数
* 跳过开头的字节

## Pwn pwnstrip

## Pwn scrable

## Pwn shellcraft

获取 shellcode

```
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
```

**可选项:**

* shellcode和shellcode的参数
* 输出文件
* 输出格式
* 调试 (将dbg附加到shellcode)
* 在代码之前设置调试陷阱
* 在代码之后
* 避免使用操作码 (默认: 非空和换行符)
* 运行shellcode
* 彩色/无彩色
* 列出系统调用
* 列出可能的shellcode
* 生成作为共享库的ELF

## Pwn模板

获取一个Python模板

```
pwn template
```

**可选项：** 主机、端口、用户、密码、路径和静默模式

## Pwn unhex

从十六进制转换为字符串

```
pwn unhex 686f6c61
```

## Pwn 更新

更新 pwntools

```
pwn update
```

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

其他支持HackTricks的方式：

* 如果您想在HackTricks中看到您的**公司广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或 **关注**我们的**Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>
