""" Quick Start Guide - Network Scanner ==================================== This guide will help you get started with the network scanner quickly. ## Step 1: Setup Run the setup script: ```bash ./start.sh ``` Or manually: ```bash python3 -m venv venv source venv/bin/activate pip install -r requirements.txt cp .env.example .env ``` ## Step 2: Start the Server ```bash python main.py ``` The server will start at http://localhost:8000 ## Step 3: Use the API ### Option 1: Web Interface Open http://localhost:8000/docs in your browser for interactive API documentation. ### Option 2: Command Line Interface ```bash # Scan a network python cli.py scan 192.168.1.0/24 # List hosts python cli.py hosts # Show topology python cli.py topology # Show statistics python cli.py stats ``` ### Option 3: Python API ```python from examples.usage_example import NetworkScannerClient import asyncio async def quick_scan(): client = NetworkScannerClient() scan_id = await client.start_scan("192.168.1.0/24") result = await client.wait_for_scan(scan_id) print(f"Found {result['hosts_found']} hosts") asyncio.run(quick_scan()) ``` ### Option 4: REST API ```bash # Start a scan curl -X POST http://localhost:8000/api/scans/start \ -H "Content-Type: application/json" \ -d '{ "network_range": "192.168.1.0/24", "scan_type": "quick", "use_nmap": false }' # Get hosts curl http://localhost:8000/api/hosts # Get topology curl http://localhost:8000/api/topology ``` ## Common Use Cases ### 1. Quick Network Discovery ```bash python cli.py scan 192.168.1.0/24 quick python cli.py hosts ``` ### 2. Detailed Port Scan ```bash python cli.py scan 192.168.1.100 deep ``` ### 3. Monitor Network Changes Run periodic scans and compare results in the database. ### 4. Visualize Network ```bash python cli.py topology ``` Access the topology data at http://localhost:8000/api/topology ## Configuration Edit `.env` file to customize: ```bash # Scan faster with more workers MAX_CONCURRENT_SCANS=100 # Enable nmap integration ENABLE_NMAP=True # Change default network DEFAULT_NETWORK_RANGE=192.168.0.0/24 ``` ## Troubleshooting ### No hosts found? - Check the network range is correct - Verify you can ping hosts on that network - Try increasing the timeout: `DEFAULT_SCAN_TIMEOUT=5` ### Scans too slow? - Use "quick" scan type instead of "standard" or "deep" - Increase concurrent scans: `MAX_CONCURRENT_SCANS=100` - Disable service detection in scan request ### Permission errors? - Socket-based scanning doesn't require root - If using nmap with OS detection, you'll need root: `sudo python main.py` ## Next Steps 1. Integrate with your frontend application 2. Set up scheduled scans 3. Export topology data 4. Add custom service detection rules 5. Configure alerting for network changes ## Need Help? - Check the full README.md - View API docs at http://localhost:8000/docs - Review logs at logs/network_scanner.log - Check the examples/ directory for more code samples Happy scanning! 🔍