Lab 3 Database Webserver Connection - JadenGil/Jaden-Tech-Journal GitHub Wiki

To begin I logged into mysql and made 2 new users with full privileges (for now)

image

Updated the UFW Firewall rules:

image

Normally I'd need to install python3 with sudo apt-get python3 but the Kali box I'm using already has it installed

image

Intalling python3 addons:

apt-get install python3-pip
apt-get install python3.12-venv

Made a directory on the desktop called "project"

image

Create a virtual environment:

image

Install flask:

image

Make a directory for flask:

image

Install the following:

pip install flask-mysql
pip install cryptography

now before moving on we need to make a directory called "static", "js" that is in the static dir, and "templates" which is in the flask dir. It should look something like this at first:

image


Creating app.py

I made app.py using sudo nano app.py and it should look something like this:

image


Creating button.html

Button.html will be in the templates directory and should look something like this:

image


Creating button.js

Button.js should be in the static/js/ directory and it should look something like this:

image


Running the server

To run the server we need to enter the following:

export FLASK_APP=app.py
flask run --host=0.0.0.0

The output should look like this:

image

going to 127.0.0.1 will take you to this page:

image

Deliverable Test Connection:

image