2024-04-12 16:21:09 +02:00
|
|
|
# Example project of a website including an SQL injection
|
|
|
|
|
|
|
|
This implementation is meant to be used for training purposes.
|
2024-04-16 15:11:51 +02:00
|
|
|
Do not use this code in production or as a blueprint for development!
|
2024-04-12 16:21:09 +02:00
|
|
|
|
2024-04-16 15:11:51 +02:00
|
|
|
## Installation
|
2024-04-12 16:21:09 +02:00
|
|
|
|
|
|
|
Use python poetry to install dependencies in the following way.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
poetry install
|
|
|
|
```
|
|
|
|
|
2024-04-16 15:11:51 +02:00
|
|
|
Dependencies can be found inside the `./pyproject.toml` file.
|
|
|
|
|
|
|
|
After installation has been done, start the flask server.
|
|
|
|
|
2024-04-18 15:56:25 +02:00
|
|
|
### Create the Database
|
|
|
|
|
|
|
|
Execute the [create_db](./create_db.py) script to setup the database
|
|
|
|
|
|
|
|
```sh
|
|
|
|
python3 ./create_db.py
|
|
|
|
```
|
|
|
|
|
|
|
|
### Run Flask
|
2024-04-16 15:11:51 +02:00
|
|
|
|
|
|
|
```sh
|
|
|
|
poetry run python3 ./flask_sqli.py
|
|
|
|
```
|
|
|
|
|
|
|
|
Now, the website is accessible at [localhost:5000](http://localhost:5000/)
|
|
|
|
|
|
|
|
### Manual Installation
|
|
|
|
|
2024-04-12 16:21:09 +02:00
|
|
|
If you want to install the dependencies manually use a venv in the following way.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
python3 -m venv venv
|
|
|
|
source venv/bin/activate
|
|
|
|
pip install flask
|
|
|
|
```
|
|
|
|
|
2024-04-18 15:56:25 +02:00
|
|
|
### Run Flask After Manual Installation
|
2024-04-12 16:21:09 +02:00
|
|
|
|
2024-04-16 15:11:51 +02:00
|
|
|
Start the flask server without poetry in the following way.
|
2024-04-12 16:21:09 +02:00
|
|
|
|
|
|
|
```sh
|
2024-04-16 15:11:51 +02:00
|
|
|
source venv/bin/activate
|
|
|
|
python3 ./flask_sqli.py
|
2024-04-12 16:21:09 +02:00
|
|
|
```
|
2024-04-18 15:56:25 +02:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
First start the server, open your browser and open the website on locahost and
|
|
|
|
the port displayed after starting the flask server. Using the default
|
|
|
|
configuration of flask, the port is `5000`.
|
|
|
|
|
|
|
|
```
|
|
|
|
http://localhost:5000
|
|
|
|
```
|