|
| 1 | +# DialogChain Scripts: Network Scanning |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This directory contains scripts for network and printer discovery in DialogChain. The main script for network scanning is `network_scanner.py`, which can detect devices and camera services (RTSP, HTTP, ONVIF, etc.) on your network. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Requirements |
| 10 | + |
| 11 | +- Python 3.8+ |
| 12 | +- Install dependencies: |
| 13 | + ```bash |
| 14 | + pip install -r ../../requirements.txt |
| 15 | + # or for direct script use: |
| 16 | + pip install aiohttp python-nmap opencv-python |
| 17 | + ``` |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## Usage: network_scanner.py |
| 22 | + |
| 23 | +Scan your network for devices and services: |
| 24 | + |
| 25 | +```bash |
| 26 | +python3 network_scanner.py --network 192.168.1.0/24 |
| 27 | +``` |
| 28 | + |
| 29 | +Scan for cameras (RTSP, HTTP, ONVIF): |
| 30 | + |
| 31 | +```bash |
| 32 | +python3 network_scanner.py --network 192.168.1.0/24 --service rtsp,http,https,onvif --port 80,443,554,8000-8090,8443,8554,8888,9000-9001,10000-10001 --verbose |
| 33 | +``` |
| 34 | + |
| 35 | +Scan a specific device: |
| 36 | + |
| 37 | +```bash |
| 38 | +python3 network_scanner.py --network 192.168.188.176 --service rtsp,http,https,onvif --port 80,443,554,8000,8080,8443,8554,8888 |
| 39 | +``` |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## Makefile Shortcuts |
| 44 | + |
| 45 | +Use the Makefile in the parent directory for common scans: |
| 46 | + |
| 47 | +- **Scan default network:** |
| 48 | + ```bash |
| 49 | + make scan-network |
| 50 | + ``` |
| 51 | +- **Scan for cameras:** |
| 52 | + ```bash |
| 53 | + make scan-cameras |
| 54 | + ``` |
| 55 | +- **Scan a specific camera:** |
| 56 | + ```bash |
| 57 | + make scan-camera IP=192.168.188.176 |
| 58 | + ``` |
| 59 | +- **Scan common local ranges for cameras:** |
| 60 | + ```bash |
| 61 | + make scan-local-camera |
| 62 | + ``` |
| 63 | +- **Quick scan:** |
| 64 | + ```bash |
| 65 | + make scan-quick |
| 66 | + ``` |
| 67 | +- **Full scan (slow):** |
| 68 | + ```bash |
| 69 | + make scan-full |
| 70 | + ``` |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Command-Line Options |
| 75 | + |
| 76 | +- `--network` Network or IP to scan (e.g., `192.168.1.0/24` or `192.168.1.101`) |
| 77 | +- `--service` Comma-separated list of services (e.g., `rtsp,http,https,onvif`) |
| 78 | +- `--port` Ports or port ranges (e.g., `80,443,554,8000-8090`) |
| 79 | +- `--timeout` Timeout per connection (default: 3.0) |
| 80 | +- `--verbose` Show detailed output |
| 81 | + |
| 82 | +--- |
| 83 | + |
| 84 | +## Example: Scan for Cameras on All Local Networks |
| 85 | + |
| 86 | +```bash |
| 87 | +make scan-local-camera |
| 88 | +``` |
| 89 | + |
| 90 | +This will scan all common local networks for camera-related services and print a summary of detected devices. |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## Troubleshooting |
| 95 | + |
| 96 | +- Ensure your Python environment has all required dependencies (`aiohttp`, etc.). |
| 97 | +- Run scans with `--verbose` for more details. |
| 98 | +- If no devices are found, check your network, firewall, and device connectivity. |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +For more information, see the main project README or contact the project maintainers. |
0 commit comments