Skip to content

Commit

Permalink
Rename folder to WiFiChallengeLab-docker, add DEV variable, add READM…
Browse files Browse the repository at this point in the history
…E Create the VM manually
  • Loading branch information
r4ulcl committed Dec 9, 2024
1 parent 822d21a commit a968c10
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ And for a Hyper-v VM, in a admin console:
vagrant up hyper-v_vm --provider=hyperv
```

### Create the VM manually (M1, M2, etc recommended)

- Download a Ubuntu20.04 VM
- Exeute the following code as root

``` bash
cd /var/
git clone https://github.com/r4ulcl/WiFiChallengeLab-docker
bash /var/WiFiChallengeLab-docker/vagrant/install.sh
```


## Usage

### Attack from Ubuntu VM
Expand All @@ -138,7 +150,7 @@ vagrant up hyper-v_vm --provider=hyperv
- TODO

## Modify config files
To modify the files you can download the repository and edit both APs and clients (in the VM the path is /var/WiFiChallenge). The files are divided by APs, Clients, and Nzyme files.
To modify the files you can download the repository and edit both APs and clients (in the VM the path is /var/WiFiChallengeLab-docker). The files are divided by APs, Clients, and Nzyme files.

## Recompile Docker
To recreate the Docker files with the changes made, modify the docker-compose.yml file by commenting out the "image:" line in each Docker and uncommenting the line with "build:". Then use "docker compose build" to create a new version.
Expand Down
46 changes: 28 additions & 18 deletions vagrant/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edit_config_file() {
fi
}


DEV=True

# update package lists
sudo apt-get update
Expand Down Expand Up @@ -66,19 +66,29 @@ sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo apt-get install bridge-utils -y
sudo service docker restart

## Go to WiFiChallengeFolder (git clone...)
cp -r /media/WiFiChallenge /var/
cd /var/WiFiChallenge
shred -vzn 3 /var/WiFiChallenge/.git

if [ "$DEV" == "True" ]; then
## Go to WiFiChallengeFolder (git clone...)
cp -r /media/WiFiChallenge/ /var/
mv /var/WiFiChallenge /var/WiFiChallengeLab-docker
else
cd /var
git clone https://github.com/r4ulcl/WiFiChallengeLab-docker
fi

cd /var/WiFiChallengeLab-docker

# Delete unnecesary files
shred -vzn 3 /var/WiFiChallengeLab-docker/.git
# No need
shred -vzn 3 /var/WiFiChallenge/APs
shred -vzn 3 /var/WiFiChallenge/Clients
shred -vzn 3 /var/WiFiChallengeLab-docker/APs
shred -vzn 3 /var/WiFiChallengeLab-docker/Clients

find /var/WiFiChallenge/APs -type f -exec shred -zvu -n 5 {} \;
find /var/WiFiChallenge/Clients -type f -exec shred -zvu -n 5 {} \;
find /var/WiFiChallenge/vagrant -type f -exec shred -zvu -n 5 {} \;
find /var/WiFiChallengeLab-docker/APs -type f -exec shred -zvu -n 5 {} \;
find /var/WiFiChallengeLab-docker/Clients -type f -exec shred -zvu -n 5 {} \;
find /var/WiFiChallengeLab-docker/vagrant -type f -exec shred -zvu -n 5 {} \;

rm -r /var/WiFiChallenge/Clients /var/WiFiChallenge/APs
rm -r /var/WiFiChallengeLab-docker/Clients /var/WiFiChallengeLab-docker/APs

## Install RDP server
echo 'Install RDP server'
Expand All @@ -89,13 +99,13 @@ echo 'Install hacking WiFi tools'
sudo bash Attacker/installTools.sh

## Extract nzyme default logs (attacker)
cd /var/WiFiChallenge/nzyme/
cd /var/WiFiChallengeLab-docker/nzyme/
rm -r logs/ data/
sudo apt-get install -y p7zip-full
7z x nzyme-logs.7z

## Enable docker
cd /var/WiFiChallenge/
cd /var/WiFiChallengeLab-docker/
sudo docker compose -f docker-compose.yml up -d
#sudo docker compose -f docker-compose-minimal.yml up -d

Expand All @@ -121,15 +131,15 @@ sudo apt-get -y autoremove --purge ubuntu-web-launchers landscape-client-ui-inst
echo 'flag{2162ae75cdefc5f731dfed4efa8b92743d1fb556}' | sudo tee /root/flag.txt

echo '#!/bin/bash
cd /var/WiFiChallenge
cd /var/WiFiChallengeLab-docker
sudo docker compose restart aps
sudo docker compose restart clients' | sudo tee /root/restartWiFi.sh /home/user/restartWiFi.sh
chmod +x /root/restartWiFi.sh /home/user/restartWiFi.sh

echo '#!/bin/bash
#Update images from AP and clients
cd /var/WiFiChallenge
cd /var/WiFiChallengeLab-docker
sudo docker compose pull
sudo docker compose up --detach
' | sudo tee /root/updateWiFiChallengeLab.sh /home/user/updateWiFiChallengeLab.sh
Expand Down Expand Up @@ -188,9 +198,9 @@ trap "rm ${PID_FILE}; exit 0" SIGINT SIGTERM SIGHUP
echo $$ > "${PID_FILE}"
# Loop
GREP_STRING="MULTIPLE_SIGNAL_TRACKS|BANDIT_CONTACT|DEAUTH_FLOOD|UNEXPECTED_FINGERPRINT|UNEXPECTED_BSSID|UNEXPECTED_CHANNEL"
ALERT1=`cat /var/WiFiChallenge/logsNzyme/alerts.log | grep -E "$GREP_STRING" | tail -n 1 | jq .message`
ALERT1=`cat /var/WiFiChallengeLab-docker/logsNzyme/alerts.log | grep -E "$GREP_STRING" | tail -n 1 | jq .message`
while true ; do
ALERT2=`cat /var/WiFiChallenge/logsNzyme/alerts.log | grep -E "$GREP_STRING" | tail -n 1 | jq .message`
ALERT2=`cat /var/WiFiChallengeLab-docker/logsNzyme/alerts.log | grep -E "$GREP_STRING" | tail -n 1 | jq .message`
if [ "$ALERT1" != "$ALERT2" ] ; then
ALERT1=$ALERT2
notify-send -i /opt/background/nzyme.ico "WIDS Nzyme" "$ALERT2"
Expand Down Expand Up @@ -239,7 +249,7 @@ gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
# Change icon theme to Adwaita
gsettings set org.gnome.desktop.interface icon-theme "Adwaita"
sudo rm -rf /var/WiFiChallenge/zerofile 2> /dev/null
sudo rm -rf /var/WiFiChallengeLab-docker/zerofile 2> /dev/null
# Auto delete
sed -i "s/bash \/etc\/configureUser.sh//g" /home/vagrant/.bashrc
Expand Down

0 comments on commit a968c10

Please sign in to comment.