Getting Started

Complete setup guide for the AISS Platform.

⚡ Quick Start

The AISS way

After setup, you never need to remember a path or command again. Just open any terminal — anywhere on your system — and type aiss. Everything starts automatically.

Step 1 — Clone the repository

git clone https://github.com/AhmedIbrahimofficial/aiss-backend.git
cd aiss-backend

Step 2 — Add aiss to your PATH (run once, as Administrator)

Windows PowerShell (run as Administrator):

# Replace the path below with where you cloned the repo
$dir = "C:\path\to\aiss-backend"
[System.Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";$dir", "User")

Or double-click setup_path.bat inside the repo (runs the above automatically).

Step 3 — Close and reopen your terminal, then type:

aiss

That's it. AISS will install all dependencies, create the database, and launch the full system automatically — from any folder, any time.

What starts automatically

✓ Python dependencies installed (first run only)

✓ SQLite database created automatically

✓ All 12 detection modules activated

✓ GUI Threat Monitor window opens

✓ Live terminal feed starts

Backend API → http://localhost:8000

Swagger Docs → http://localhost:8000/docs

Frontend → http://localhost:3000

🪟 Windows Setup (Full Guide)

1. Clone the repository

git clone https://github.com/AhmedIbrahimofficial/aiss-backend.git
cd aiss-backend

2. Make aiss a global command (one time only)

Option A — Double-click setup_path.bat in the repo folder (easiest).

Option B — Run in PowerShell as Administrator:

$dir = (Get-Location).Path
[System.Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";$dir", "User")

3. Close terminal, reopen, then run from anywhere:

aiss

First run: installs Python packages, creates logs/cybersecurity.db, starts everything. Every run after: launches instantly.

4. (Optional) Configure .env for AI features

# Edit the .env file in the repo folder
ANTHROPIC_API_KEY=sk-ant-...   # enables Claude AI analysis
SECRET_KEY=your-random-secret
ALLOWED_ORIGINS=http://localhost:3000

5. Start the frontend (separate terminal)

cd path\to\aiss-frontend
npm install
npm run dev

🐧 Linux / macOS Setup

1. Clone the repository

git clone https://github.com/AhmedIbrahimofficial/aiss-backend.git
cd aiss-backend

2. Make aiss a global command (one time only)

# Add to PATH permanently
echo 'export PATH="$PATH:'"$(pwd)"'"' >> ~/.bashrc
source ~/.bashrc

# For zsh (macOS default):
echo 'export PATH="$PATH:'"$(pwd)"'"' >> ~/.zshrc
source ~/.zshrc

3. Make the launcher executable

chmod +x start.sh

4. Run from anywhere:

aiss

First run installs all dependencies and creates the database automatically.

5. (Optional) Configure .env

nano .env
ANTHROPIC_API_KEY=sk-ant-...
SECRET_KEY=your-random-secret
ALLOWED_ORIGINS=http://localhost:3000

⚙️ Configuration (.env)

AISS works out of the box with zero config — SQLite is used by default. The .env file is auto-created on first run. Only edit it if you want AI features or PostgreSQL.

Full .env reference:

# ── Database (SQLite by default, zero setup) ──
DATABASE_URL=sqlite+aiosqlite:///./logs/cybersecurity.db

# ── Switch to PostgreSQL for production ───────
# DATABASE_URL=postgresql://user:password@localhost:5432/aiss

# ── CORS ──────────────────────────────────────
ALLOWED_ORIGINS=http://localhost:3000

# ── JWT ───────────────────────────────────────
SECRET_KEY=change-this-to-a-long-random-secret
ACCESS_TOKEN_EXPIRE_MINUTES=10080
REFRESH_TOKEN_EXPIRE_DAYS=30

# ── Email (optional, for account verification) 
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=youremail@gmail.com
SMTP_PASSWORD=your-gmail-app-password
FRONTEND_URL=http://localhost:3000

# ── Claude AI (optional, enables AI analysis) ─
ANTHROPIC_API_KEY=sk-ant-...

🚀 Background / Production

Windows — Keep running after terminal closes:

# Run in PowerShell
Start-Process python -ArgumentList "main.py" -NoNewWindow

Linux — Using nohup:

nohup uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4 &

Linux — Using pm2 (recommended):

npm install -g pm2
pm2 start "uvicorn main:app --host 0.0.0.0 --port 8000" --name aiss
pm2 startup && pm2 save

Linux — Using systemd:

# /etc/systemd/system/aiss.service
[Unit]
Description=AISS API
After=network.target

[Service]
WorkingDirectory=/path/to/aiss-backend
ExecStart=/path/to/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000
Restart=always

[Install]
WantedBy=multi-user.target

sudo systemctl enable aiss
sudo systemctl start aiss

📡 API Reference

MethodEndpointDescription
POST/api/auth/registerCreate new account
GET/api/auth/verify-emailVerify email via token
POST/api/auth/loginLogin → get tokens
POST/api/auth/refreshRefresh access token
GET/api/auth/meCurrent user info
POST/api/auth/forgot-passwordRequest reset email
POST/api/auth/reset-passwordReset password
GET/api/threats/All threats
GET/api/threats/activeActive threats
GET/api/threats/statsThreat statistics
POST/api/threats/{id}/resolveResolve a threat
GET/api/kill-chainKill chain stage map
POST/api/scanner/simulateInject demo threats
POST/api/ai/analyzeClaude AI threat analysis
GET/api/network/connectionsLive network connections
GET/api/healthHealth check

🔐 Authentication

Register a new account:

curl -X POST http://localhost:8000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"username":"ahmed","email":"ahmed@example.com","password":"SecurePass123!"}'

Login (get tokens):

curl -X POST http://localhost:8000/api/auth/login \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=ahmed&password=SecurePass123!"

# Response:
# { "access_token": "eyJ...", "refresh_token": "eyJ...", "token_type": "bearer" }

Use token in requests:

curl http://localhost:8000/api/threats/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

WebSocket connection:

const ws = new WebSocket("ws://localhost:8000/ws");

ws.onopen = () => {
  ws.send(JSON.stringify({ action: "auth", token: "YOUR_JWT" }));
};

ws.onmessage = (e) => {
  const msg = JSON.parse(e.data);
  if (msg.status === "authenticated") {
    ws.send(JSON.stringify({ action: "start_monitoring" }));
  }
};