diff --git a/app/machinecontrol.py b/app/machinecontrol.py index dbfaa7f..19d87b1 100644 --- a/app/machinecontrol.py +++ b/app/machinecontrol.py @@ -442,8 +442,8 @@ class Machine(): playground = self.vm_manager.get_playground() if self.get_os() == "linux": - cmd = f""" -nohup {playground}/caldera_agent.sh start & + cmd = f"""chmod +x caldera_agent.sh; +nohup bash {playground}/caldera_agent.sh start & """ elif self.get_os() == "windows": if playground: diff --git a/experiment.yaml b/experiment.yaml index b095bbe..de51c16 100644 --- a/experiment.yaml +++ b/experiment.yaml @@ -84,7 +84,7 @@ targets: ### # simple switch if targets is used in attack simulation. Default is true. If set to false the machine will not be started - active: yes + active: no vm_name: target2 os: windows @@ -129,7 +129,7 @@ targets: ### # simple switch if targets is used in attack simulation. Default is true. If set to false the machine will not be started - active: no + active: yes vm_name: target3 os: linux diff --git a/systems/Vagrantfile b/systems/Vagrantfile index fc5a939..4e9d0e4 100644 --- a/systems/Vagrantfile +++ b/systems/Vagrantfile @@ -198,11 +198,11 @@ Vagrant.configure("2") do |config| ls /vagrant cd /vagrant/target3 chmod +x bootstrap.sh - ./bootstrap.sh + sudo ./bootstrap.sh # Install implant - chmod +x hackme.sh - ./hackme.sh + #chmod +x hackme.sh + #./hackme.sh SHELL end @@ -278,7 +278,7 @@ Vagrant.configure("2") do |config| ls /vagrant cd /vagrant/attacker1 chmod +x bootstrap.sh - ./bootstrap.sh + sudo ./bootstrap.sh echo "Attacker ready" SHELL diff --git a/systems/attacker1/bootstrap.sh b/systems/attacker1/bootstrap.sh new file mode 100755 index 0000000..e14904e --- /dev/null +++ b/systems/attacker1/bootstrap.sh @@ -0,0 +1,24 @@ +#!/bin/bash + + +# Bootstrap the new VM +# +# + +echo "Bootstrapping attacker1" + +# Update system +apt update +cd ~ +wget https://bootstrap.pypa.io/get-pip.py +python3 get-pip.py +apt -y install golang sphinx-common +#apt -y upgrade + +#apt -y install apt-transport-https +#apt -y install openssh-server +#apt -y install whois # for mkpasswd + +ip addr show eth1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1 > /vagrant/attacker1/ip4.txt + +# reboot diff --git a/systems/target3/bootstrap.sh b/systems/target3/bootstrap.sh new file mode 100755 index 0000000..7d57892 --- /dev/null +++ b/systems/target3/bootstrap.sh @@ -0,0 +1,75 @@ +#!/bin/bash + + +# Bootstrap the new VM +# +# + +# Update system +apt update +apt -y upgrade + +apt -y install apt-transport-https +apt -y install openssh-server +apt -y install whois # for mkpasswd +apt -y install libprotobuf-dev +apt -y install libbpf-dev +apt -y install gdb + + +# Add vulnerable user +# mkpasswd -m sha-512 # To calc the passwd +# This is in the debian package "whois" + +# user with password "test" +# useradd -m -p '$6$bc4k4Tq2.1GW$0ysyuxyfyds2JkfVEf9xHy39MhpS.hhnAo4sBLprNfIHqcpaa9GJseRJJsrq0cSOWwYlOPrdHQNHp10E1ekO81' -s /bin/bash test + +# user with password "passw0rd" +# useradd -m -p '$6$q5PAnDI5K0uv$hMGMJQleeS9F2yLOiHXs2PxZHEmV.ook8jyWILzDGDxSTJmTTZSe.QgLVrnuwiyAl5PFJVARkMsSnPICSndJR1' -s /bin/bash password + +# Install Elastic search debian repo + +wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - +echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee /etc/apt/sources.list.d/elastic-7.x.list +apt update + +# Install Logstash +apt -y install default-jre +apt -y install logstash + +# Install filebeat +apt -y install filebeat +# Configure logstash as output +cp /vagrant/target1/config/filebeat.yml /etc/filebeat/filebeat.yml +cp /vagrant/target1/config/caldera_agent.service /etc/systemd/system/ + +# Config logstash +cp /vagrant/target1/logstash_conf/*.conf /etc/logstash/conf.d +rm /vagrant/target1/logstash/filebeat.json +touch /vagrant/target1/logstash/filebeat.json +chmod o+w /vagrant/target1/logstash/filebeat.json + +# Start Logstash and filebeat +filebeat modules enable system,iptables +filebeat setup --pipelines --modules iptables,system, +systemctl start logstash.service +systemctl enable filebeat +systemctl enable logstash.service + +# Run logstash manually for debugging: +# https://www.elastic.co/guide/en/logstash/current/running-logstash-command-line.html +# /usr/share/logstash/bin/logstash --node-name debug -f /etc/logstash/conf.d/ --log.level debug --config.debug + +# To test conf files: +# /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/ -t + +# Start Caldera agent service +# ln -s /vagrant/target1/config/caldera_agent.service /etc/systemd/system +# chmod 666 /etc/systemd/system +# systemctl enable caldera_agent.service +# systemctl start caldera_agent.service + + +ip addr show enp0s8 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1 > /vagrant/target3/ip4.txt + +# reboot