FazleArefin/kali-ctf-machine-setup

GitHub: FazleArefin/kali-ctf-machine-setup

利用 Ansible playbook 在 Kali Linux 上自动化安装 CTF 和渗透测试所需的额外工具及漏洞靶场环境。

Stars: 14 | Forks: 2

# kali-ctf-machine-setup ![截图](https://static.pigsec.cn/wp-content/uploads/repos/cas/94/94756661562c5ef0da040a9849f793cdb36e186fda7b2b518e8c32dc1d139475.png) 本仓库包含 Ansible playbook,用于在 Kali Linux 基础上为 CTF (Capture The Flag) 和渗透测试活动安装额外的工具。 这些工具在 [Hack The Box](https://www.hackthebox.com/)、[TryHackMe](https://tryhackme.com/) 等平台上玩 CTF 时非常有用。 ## 操作指南? ### 0. 设置 Kali Linux 假定您已经进行了纯净的 Kali Linux 安装。本 README 专为 [Kali 虚拟机镜像](https://www.kali.org/get-kali/#kali-virtual-machines) 量身定制。 ### 1. 升级软件包 此步骤是可选的,因为 Ansible playbook 会处理它。但是,强烈建议在此阶段升级所有已安装的软件包,以避免日后出现问题。 ``` sudo apt update sudo apt full-upgrade -y ``` ### 2. 安装 git 和 ansible/ansible-core ``` sudo apt update sudo apt install git ansible -y # 仅当 ansible 包不可用时,安装 ansible-core 及以下所需的 collections sudo apt install ansible-core -y # 安装额外的 ansible collections(此处不要使用 `sudo`) ansible-galaxy collection install ansible.posix \ community.general \ community.docker \ community.crypto ``` ### 3. 克隆此仓库 ``` git clone https://github.com/FazleArefin/kali-ctf-machine-setup.git cd kali-ctf-machine-setup ``` ### 4. 运行 Ansible playbook 以安装额外的工具 出现提示时输入用户 (`kali`) 的密码(如果是自定义安装,您的用户 ID 可能会有所不同)。 根据您是否希望拉取带有漏洞的 Docker 镜像,运行以下命令之一。 #### 安装且不包含带有漏洞的 Docker 镜像 ``` ansible-playbook -vv -e "setup_vuln_docker_images=false" -K main.yml ``` #### 安装并包含带有漏洞的 Docker 镜像 ``` ansible-playbook -vv -e "setup_vuln_docker_images=true" -K main.yml ``` ### 5. 进一步自定义(可选) 可以通过运行以下命令来对安装进行进一步的自定义: ``` kali-tweaks ``` ## 内置的 Docker 漏洞镜像 *Docker 漏洞镜像* 是运行了故意存在漏洞的服务的 Docker 容器。安装了以下漏洞镜像,以便您可以在自己的 Kali 安装环境中进行练习: - [OWASP Juice Shop](https://owasp.org/www-project-juice-shop/) - [OWASP WebGoat](https://owasp.org/www-project-webgoat/) ### 运行带有漏洞的 Docker 镜像 #### OWASP Juice Shop ``` docker run --rm -d -p 3000:3000 --name juice-shop bkimminich/juice-shop # 在 Kali 主机中使用 Web 浏览器访问 http://localhost:3000 ``` #### OWASP WebGoat ``` docker run --rm -it -p 127.0.0.1:8080:8080 -p 127.0.0.1:9090:9090 -e TZ=UTC --name webgoat webgoat/webgoat # 在 Kali 主机中使用 Web 浏览器访问 http://127.0.0.1:8080/WebGoat ``` #### DVWA (Damn Vulnerable Web Application) ``` sudo systemctl start dvwa # 导航至 http://localhost:42001 # 默认凭据为 admin:password # 可以在 `/etc/dvwa/config/config.inc.php` 中更改安全级别 ``` ## 额外的 Git 仓库 额外的 Git 仓库已在本地克隆到以下位置: - [`/opt/GitTools`](https://github.com/internetwache/GitTools):包含 3 个工具的仓库,用于攻击暴露 `.git` 目录的网站 - [`/opt/zphisher`](https://github.com/htr-tech/zphisher):具有 30+ 模板的自动化钓鱼工具 - [`/opt/vulhub`](https://github.com/vulhub/vulhub):基于 Docker Compose 的预构建漏洞环境 - [`/opt/privesc-scripts/LinEnum`](https://github.com/rebootuser/LinEnum):脚本化的本地 Linux 枚举和权限提升检查 - [`/opt/privesc-scripts/linux-exploit-suggester`](https://github.com/The-Z-Labs/linux-exploit-suggester):Linux 权限提升审计工具 - [`/opt/privesc-scripts/linux-smart-enumeration`](https://github.com/diego-treitos/linux-smart-enumeration):具有详细级别的用于渗透测试和 CTF 的 Linux 枚举工具 - [`/opt/WEF`](https://github.com/D3Ext/WEF):Wi-Fi Exploitation Framework ## Kali Linux 实用链接 - [Kali 工具](https://www.kali.org/tools/) - [Kali Linux Metapackages](https://www.kali.org/tools/kali-meta/) - [Kali 默认凭据](https://www.kali.org/docs/introduction/default-credentials/) ## 其他实用链接 - **[HackTricks](https://book.hacktricks.xyz/)** ⭐ - **[HackTricks Cloud](https://cloud.hacktricks.xyz/)** ⭐ - [OWASP Cheat Sheet Series](https://cheatsheetseries.owasp.org/) - [OWASP Web 安全测试指南](https://owasp.org/www-project-web-security-testing-guide/latest/) - [Payloads All The Things](https://swisskyrepo.github.io/PayloadsAllTheThings/) - [GTFOBins](https://gtfobins.github.io/) - [CyberChef](https://gchq.github.io/CyberChef/) – 编码/解码数据 - [CrackStation](https://crackstation.net/) – 哈希彩虹表 - [Reverse Shell Generator](https://www.revshells.com/) - [CI/CD Goat](https://github.com/cider-security-research/cicd-goat) - [h4cker](https://github.com/The-Art-of-Hacking/h4cker) - [PortSwigger Web 安全学院](https://portswigger.net/web-security/all-materials) - [推荐的 Kali Linux Wi-Fi 适配器](https://github.com/morrownr/USB-WiFi/blob/main/home/Recommended_Adapters_for_Kali_Linux.md) ## 捐赠 如果您认为我的工作在某种程度上帮助了您,并为您节省了时间和精力,我很乐意接受任何金额的捐赠。不过,本仓库中的代码是完全免费的。 Bitcoin (BTC): `bc1qzlhpm94vtk2ht67etdutzcy2g5an5v6g36tp0m`
标签:Ansible, Cutter, 安全, 特权提升, 系统提示词, 自动化部署, 请求拦截, 超时处理