# Installation Guide

## Prerequisites

- **Operating System**: Ubuntu 22.04/24.04, Debian 11/12, or Kali Linux
- **RAM**: Minimum 4GB (8GB recommended)
- **Disk Space**: At least 10GB free
- **Network**: Internet access for package downloads
- **Permissions**: Root access required

---

## Quick Installation

### One-Command Install

```bash
git clone https://github.com/DeNNiiInc/UltyScan /usr/share/sniper
cd /usr/share/sniper
bash install.sh force
```

The `force` flag runs the entire installation without prompts.

### What Gets Installed

The installer automatically sets up:

| Component | Description |
|-----------|-------------|
| **Core Scanner** | Main sniper script and modes |
| **Dependencies** | Nmap, Metasploit, Python tools |
| **Web Interface** | Apache + PHP dashboard |
| **Sudoers Config** | Web UI permissions |
| **Symlinks** | Easy command access |

---

## Step-by-Step Installation

### 1. Update System

```bash
apt update && apt upgrade -y
```

### 2. Install Git

```bash
apt install -y git
```

### 3. Clone Repository

```bash
git clone https://github.com/DeNNiiInc/UltyScan /usr/share/sniper
```

### 4. Run Installer

```bash
cd /usr/share/sniper
bash install.sh force
```

### 5. Verify Installation

```bash
sniper --help
```

You should see the help menu with all available options.

---

## Docker Installation

### Prerequisites

- Docker installed
- Docker Compose installed

### Steps

```bash
# Clone the repository
git clone https://github.com/DeNNiiInc/UltyScan /opt/ultyscan
cd /opt/ultyscan

# Build and start container
docker-compose up -d

# Enter the container
docker exec -it kali-linux bash

# Run installer inside container
./install.sh force
```

---

## Post-Installation

### Access the Web Interface

After installation, you'll see:

```
============================================
  ULTYSCAN WEB INTERFACE
============================================
  URL: http://YOUR_IP/ultyscan/
  Logs: /var/log/ultyscan/
  Loot: /usr/share/sniper/loot/workspace/
============================================
```

Open the URL in your browser to access the dashboard.

### Configure API Keys

Edit the configuration file to add your API keys:

```bash
nano /root/.sniper.conf
```

Add your keys:

```bash
SHODAN_API_KEY="your_shodan_key"
CENSYS_APP_ID="your_censys_id"
CENSYS_API_SECRET="your_censys_secret"
HUNTERIO_KEY="your_hunter_key"
GITHUB_API_KEY="your_github_token"
```

---

## Troubleshooting

### Issue: Command Not Found

```bash
# Check if symlink exists
ls -la /usr/bin/sniper

# Recreate if missing
ln -s /usr/share/sniper/sniper /usr/bin/sniper
```

### Issue: Web UI Not Loading

```bash
# Check Apache status
systemctl status apache2

# Restart Apache
systemctl restart apache2

# Check if files exist
ls -la /var/www/html/ultyscan/
```

### Issue: Scans Not Starting from Web UI

```bash
# Check sudoers configuration
cat /etc/sudoers.d/www-data-sniper

# Should contain:
# www-data ALL=(ALL) NOPASSWD: /usr/bin/bash /usr/share/sniper/sniper *

# Fix if missing:
echo 'www-data ALL=(ALL) NOPASSWD: /usr/bin/bash /usr/share/sniper/sniper *' > /etc/sudoers.d/www-data-sniper
chmod 440 /etc/sudoers.d/www-data-sniper
```

### Issue: Permission Denied Errors

```bash
# Fix ownership
chown -R root:root /usr/share/sniper
chmod +x /usr/share/sniper/sniper

# Fix web UI permissions
chown -R www-data:www-data /var/www/html/ultyscan
chown www-data:www-data /var/log/ultyscan
```

---

## Updating

To update to the latest version:

```bash
cd /usr/share/sniper
git pull origin main
bash install.sh force
```

Or from the Web UI: Go to **Settings** → **Update UltyScan**
