# Phishing training application

Application used for training users against phishing attacks using emails for communication. 
App also provides statistics about emails used in training.

## Starting the application with Vagrant

### Requirements

You need to have Virtualbox and Vagrant installed.

* Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) - required version 6.1.0+
* Install [Vagrant](https://www.vagrantup.com/downloads) - required version 2+

### Starting the application

To start application open the terminal with path to project directory and run following command:
```bash
$ vagrant up
```

Application is available on `http://localhost:3000`.

## Run application locally

If you want to run application without vagrant, firstly you must install 
mysql (server and client) and import dump file into database. Then install packages
for frontend and backend of application.

### MySQL install and config
Application is configured for 
following database settings:  

```DBNAME```  phishingdb  
```DBUSER```  phish  
```DBPASSWD```  phish123  

If you want to use different database settings, you must change Django setting file,
located in ```backend/trainingApi/settings.py```.

To install and configure database for application run following commands:
```bash
debconf-set-selections <<< "mysql-server mysql-server/root_password password $DBPASSWD"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $DBPASSWD"
sudo apt-get -y install mysql-server phpmyadmin
sudo apt-get -y install libmysqlclient-dev 
mysql -uroot -p$DBPASSWD -e "CREATE DATABASE $DBNAME"
mysql -uroot -p$DBPASSWD -e "grant all privileges on $DBNAME.* to '$DBUSER'@'localhost' identified by '$DBPASSWD'"
mysql -uroot -p$DBPASSWD $DBNAME < /vagrant/dump/dump.sql
```

### Backend
For backend of application you must install python3, python3-pip and pipenv.

```bash
cd backend
sudo apt-get install -y python3
sudo apt-get install -y python3-pip
sudo pip3 install pipenv
pipenv install
pipenv run python manage.py migrate
```

### Frontend
Before running frontend of application you must install nodejs, modules 
and then run build. Enter following commands to terminal:
```bash
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt -y install nodejs
cd frontend
npm install
npm audit fix
npm run build
sudo npm install -g serve
```

### Start application
After installation, you can run the application by typing following commands.

```bash
cd backend/
pipenv run python manage.py runserver
cd fronted/
serve -s build 
```



**author:** Patrik Brosz  
**version:** 0.1.0  
**license:** MIT  
**repository:** [Github](https://gitlab.fi.muni.cz/xbrosz/phishing-game.git)