Commit 432d2132 authored by Ignacio Crespo's avatar Ignacio Crespo

Dorothea Ubunut 20.04

parent a8a4bcee
......@@ -18,8 +18,8 @@
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
lab_attacks:
attackers: 100
slaves: 200
attackers: 5
slaves: 3
sampling:
enabled: true
packet_sampling: 1000
......@@ -40,4 +40,4 @@
packet_sampling: 500
networks:
internal_net: 182.168.1.0
internet: 126.52.30.0
\ No newline at end of file
internet: 126.52.30.0
SYSTEM:ubuntu:20.04
\ No newline at end of file
......@@ -102,8 +102,12 @@ services:
netflow_generator:
container_name: netflow_generator
build: ./netflow_generator
image: lab/netflow_generator
build:
context: .
dockerfile: ./netflow_generator/Dockerfile
args:
- SYSTEM=${SYSTEM}
volumes:
- ./results/NetflowMachineResults:/home/total-traffic/
networks:
......
......@@ -17,7 +17,10 @@
## You should have received a copy of the GNU Lesser General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
FROM ubuntu:18.04
ARG SYSTEM
FROM $SYSTEM
#Install the necessary packages
RUN apt-get -y update;
......@@ -35,7 +38,10 @@ RUN sysctl net.ipv4.conf.all.forwarding=1
RUN apt-get -y install git
RUN apt-get -y install module-assistant
RUN apt-get -y install build-essential
RUN apt-get -y install iptables iptables-dev pkg-config
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt-get -y install iptables-dev; exit 0
RUN apt-get -y install libxtables-dev iptables-netflow-dkms; exit 0
RUN apt-get -y install iptables libxtables-dev iptables-netflow-dkms pkg-config
RUN DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y -q --allow-change-held-packages linux-image-$(uname -r)
RUN apt-get -y install linux-headers-$(uname -r)
RUN apt-get -y install cron
......@@ -75,7 +81,7 @@ WORKDIR /
COPY CIC-cron /etc/cron.d/CIC-cron
COPY ./netflow_generator/CIC-cron /etc/cron.d/CIC-cron
RUN chmod 0644 /etc/cron.d/CIC-cron
RUN crontab /etc/cron.d/CIC-cron
RUN touch /var/log/cron.log
......@@ -84,11 +90,11 @@ RUN mkdir /home/tcpdump-capture/
RUN mkdir /home/total-traffic/
RUN echo 0 > checkNetflow.txt
COPY get-data.sh .
COPY ./netflow_generator/get-data.sh .
RUN chmod +x get-data.sh
#Launch start.sh
COPY start.sh .
COPY ./netflow_generator/start.sh .
RUN chmod +x start.sh
CMD ["./start.sh"]
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -35,9 +35,7 @@ RUN sysctl net.ipv4.conf.all.forwarding=1
RUN apt-get -y install git
RUN apt-get -y install module-assistant
RUN apt-get -y install build-essential
RUN apt-get -y install iptables iptables-dev pkg-config
RUN DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y -q --allow-change-held-packages linux-image-$(uname -r)
RUN apt-get -y install linux-headers-$(uname -r)
RUN apt-get -y install iptables pkg-config
RUN apt-get -y install cron
#Install java to be able to use CICFlowMeter
......@@ -48,7 +46,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wireshark-common
RUN apt-get install -y libpcap-dev
#Clone the project that emulates a router with netflow
RUN git clone git://github.com/aabc/ipt-netflow.git ipt-netflow;
RUN mkdir /home/CICFlowMeter40
COPY ./CICFlowMeter40/ /home/CICFlowMeter40
......
SYSTEM:ubuntu:20.04
\ No newline at end of file
......@@ -68,7 +68,11 @@ services:
netflow_generator:
container_name: netflow_generator_normal
build: ./netflow_generator
build:
context: .
dockerfile: ./netflow_generator/Dockerfile
args:
- SYSTEM=${SYSTEM}
image: lab/netflow_generator
volumes:
- ./results/NetflowMachineResults:/home/total-traffic/
......
# mailing.py needs the proper login credentials for this particular user
[mailconfig]
user = example@example.com
pw = password
user = test@test.com
pw = 12345
smtp = smtp.gmail.com
......@@ -18,7 +18,9 @@
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
FROM ubuntu:18.04
ARG SYSTEM
FROM $SYSTEM
#Install the necessary packages
RUN apt-get -y update;
......@@ -36,7 +38,10 @@ RUN sysctl net.ipv4.conf.all.forwarding=1
RUN apt-get -y install git
RUN apt-get -y install module-assistant
RUN apt-get -y install build-essential
RUN apt-get -y install iptables iptables-dev pkg-config
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt-get -y install iptables-dev; exit 0
RUN apt-get -y install libxtables-dev iptables-netflow-dkms; exit 0
RUN apt-get -y install iptables libxtables-dev iptables-netflow-dkms pkg-config
RUN DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y -q --allow-change-held-packages linux-image-$(uname -r)
RUN apt-get -y install linux-headers-$(uname -r)
RUN apt-get -y install cron
......@@ -76,7 +81,7 @@ WORKDIR /
COPY CIC-cron /etc/cron.d/CIC-cron
COPY ./netflow_generator/CIC-cron /etc/cron.d/CIC-cron
RUN chmod 0644 /etc/cron.d/CIC-cron
RUN crontab /etc/cron.d/CIC-cron
RUN touch /var/log/cron.log
......@@ -85,11 +90,11 @@ RUN mkdir /home/tcpdump-capture/
RUN mkdir /home/total-traffic/
RUN echo 0 > checkNetflow.txt
COPY get-data.sh .
COPY ./netflow_generator/get-data.sh .
RUN chmod +x get-data.sh
#Launch start.sh
COPY start.sh .
COPY ./netflow_generator/start.sh .
RUN chmod +x start.sh
CMD ["./start.sh"]
This diff is collapsed.
......@@ -35,9 +35,7 @@ RUN sysctl net.ipv4.conf.all.forwarding=1
RUN apt-get -y install git
RUN apt-get -y install module-assistant
RUN apt-get -y install build-essential
RUN apt-get -y install iptables iptables-dev pkg-config
RUN DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y -q --allow-change-held-packages linux-image-$(uname -r)
RUN apt-get -y install linux-headers-$(uname -r)
RUN apt-get -y install iptables pkg-config
RUN apt-get -y install cron
#Install java to be able to use CICFlowMeter
......@@ -48,7 +46,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wireshark-common
RUN apt-get install -y libpcap-dev
#Clone the project that emulates a router with netflow
RUN git clone git://github.com/aabc/ipt-netflow.git ipt-netflow;
RUN mkdir /home/CICFlowMeter40
COPY ./CICFlowMeter40/ /home/CICFlowMeter40
......
......@@ -50,12 +50,25 @@ if args.clean:
os.system('docker rm $(docker ps -a -q)')
os.system('docker rmi $(docker images -q)')
if args.type == 'attack':
system = os.popen("egrep '^(VERSION_ID|NAME)=' /etc/os-release | awk -F \"=\" '{print $2}' | tr \"\n\" ':' | tr -d '\"\"' | tr [[:upper:]] [[:lower:]] | sed 's/.$//'")
version = 'SYSTEM:' + str(system.read())
f = open('./lab_attacks/.env', 'w')
try:
#print(version)
f.write(version)
finally:
f.close()
#Delete the kernel module
os.system('sudo rmmod ipt_NETFLOW 2> /dev/null')
attaker = conf_file["lab_attacks"]["attackers"]
attackers = conf_file["lab_attacks"]["attackers"]
slaves = conf_file["lab_attacks"]["slaves"]
# Change slaves.
os.system('sed -i \'/slaves = /c\\\tslaves = '+ str(slaves) +'\' ./lab_attacks/attacks/tasks.py')
#We change the sampling
if conf_file["lab_attacks"]["sampling"]["enabled"] == True:
sampling = conf_file["lab_attacks"]["sampling"]["packet_sampling"]
......@@ -78,11 +91,21 @@ if args.type == 'attack':
os.system('docker-compose -f ./lab_attacks/docker-compose.yml build')
os.system('docker-compose -f ./lab_attacks/docker-compose.yml up --scale attacker='+str(attaker)+' --scale slave='+str(slaves)+' --force-recreate --abort-on-container-exit')
os.system('docker-compose -f ./lab_attacks/docker-compose.yml up --scale attacker='+str(attackers)+' --scale slave='+str(slaves)+' --force-recreate --abort-on-container-exit')
if args.type == 'normal':
system = os.popen("egrep '^(VERSION_ID|NAME)=' /etc/os-release | awk -F \"=\" '{print $2}' | tr \"\n\" ':' | tr -d '\"\"' | tr [[:upper:]] [[:lower:]] | sed 's/.$//'")
version = 'SYSTEM:' + str(system.read())
f = open('./lab_normal/.env', 'w')
try:
#print(version)
f.write(version)
finally:
f.close()
os.system('sudo rmmod ipt_NETFLOW 2> /dev/null')
generators = conf_file["lab_normal"]["generators"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment