= Build Instructions = == Development environment description == The prototype is implemented as a web application (Flask backend + Vite frontend + a Python client agent). Required software: * Python 3.11 or newer * Node.js 18+ and npm (for the frontend) * SQLite 3 (used by the prototype database) * Git * Visual Studio Code or PyCharm (recommended) * Modern web browser (Google Chrome, Microsoft Edge or Mozilla Firefox) Main Python libraries (see requirements.txt for the full list): * Flask, Flask-CORS, Flask-SocketIO * requests, python-dotenv * PyJWT, google-auth (Google login + JWT cookie session) * openai (RAG / natural-language chat module) * psutil (system metrics on the client) The prototype database is a local SQLite file: ''lan_logs_sysmon.db''. It is created automatically the first time the server starts. '''Note:''' The official project database from the previous phase is a PostgreSQL schema (project). The prototype uses a local SQLite database with the same table structure for easier local development. ---- == Build instructions == 1. Clone the project repository. {{{ git clone https://github.com/istevanoska/NETIntel cd NETIntel }}} 2. Create and activate a virtual environment. Windows: {{{ python -m venv .venv .venv\Scripts\activate }}} Linux/macOS: {{{ python3 -m venv .venv source .venv/bin/activate }}} 3. Install all required dependencies. {{{ pip install -r requirements.txt }}} 4. Create a .env file in the project root with the required configuration. {{{ GOOGLE_CLIENT_ID=your-google-oauth-client-id JWT_SECRET=your-secret-key OPENAI_API_KEY=your-openai-key # само за Chat / RAG модулот }}} 5. Start the server. {{{ python server.py }}} The server starts on: {{{ http://localhost:5555 }}} If the database does not exist, it is created automatically (all tables) when the server starts. 6. Configure and start the frontend. Create a file lan-frontend/.env with: {{{ VITE_API_BASE=http://localhost:5555 VITE_GOOGLE_CLIENT_ID=your-google-oauth-client-id }}} '''Note:''' VITE_GOOGLE_CLIENT_ID must be the same value as GOOGLE_CLIENT_ID in the backend .env. Then install and start: {{{ cd lan-frontend npm install npm run dev }}} The frontend starts on: {{{ http://localhost:5173 }}} 7. Start the client agent. {{{ python sctry.py }}} When prompted, enter the server IP address shown in the server terminal, and the environment token generated from the admin panel. ---- == Testing instructions == Open the application in a web browser: {{{ http://localhost:5173 }}} Login using a Google account (Google OAuth). The session is kept via an HttpOnly JWT cookie. After successful login the following prototype functionalities can be tested: * Dashboard – overview of all monitored computers * Computer Details – detailed information about a selected computer (processes, Sysmon events, security alerts) * Environment Management – create and manage environments and generate tokens * Agent Communication – send monitoring data from the client application * RAG / Chat – generate SQL queries from natural-language questions Example questions for the Chat module: * Show all active processes for PC-ADMIN. * Show all security alerts. * Show the latest Sysmon events. * List all monitored computers. Mini guide: 1. Login to the application (Google). 2. Open the Dashboard. 3. Select a monitored computer. 4. View system metrics, running processes and security events. 5. Open Environment Management (requires administrator role) to create environments and tokens. 6. Open the Chat page and ask a question in natural language. 7. Review the generated SQL query and the returned results. ---- == Database initialization == The database is created and populated automatically by the server on first start (init_db creates all tables if missing). Optionally, to (re)create the schema and load sample data manually, run: 1. database/schema.sql 2. database/sample_data.sql Then start the server: {{{ python server.py }}} ---- == Source code == The repository contains: * Complete application source code * Flask backend (server.py) * Python client agent (sctry.py) * Frontend source code (lan-frontend, Vite) * SQL scripts for creating the database schema and sample data * Project documentation All source code required to build and run the prototype is available in the DEVELOP repository.