Skip to content

Commit 4ffa90f

Browse files
author
Tom Softreck
committed
update
1 parent 9e80d6e commit 4ffa90f

File tree

1 file changed

+66
-11
lines changed

1 file changed

+66
-11
lines changed

Makefile

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,23 +298,71 @@ run-iot: setup-env
298298
SCAN_SCRIPT=scripts/network_scanner.py
299299
PRINTER_SCRIPT=scripts/printer_scanner.py
300300

301-
# Network scanning
302-
scan-network:
303-
@echo "🔍 Scanning network for devices..."
304-
@python3 $(SCAN_SCRIPT) --network 192.168.1.0/24
301+
# Common network settings
302+
DEFAULT_NETWORK?=192.168.1.0/24
303+
COMMON_PORTS=80,443,554,8000-8090,8443,8554,8888,9000-9001,10000-10001
304+
SERVICES=rtsp,http,https,onvif,rtmp,rtmps,rtmpt,rtmpts,rtmpe,rtmpte,rtmfp
305305

306-
scan-cameras:
306+
# Network scanning targets
307+
.PHONY: scan-network scan-cameras scan-camera scan-printers scan-local scan-quick scan-full scan-local-camera help
308+
309+
## Network scanning
310+
scan-network: ## Scan the default network for common services
311+
@echo "🔍 Scanning $(DEFAULT_NETWORK) for common services..."
312+
@python3 $(SCAN_SCRIPT) --network $(DEFAULT_NETWORK) --service $(SERVICES) --port $(COMMON_PORTS)
313+
314+
## Camera-specific scanning
315+
scan-cameras: ## Scan for cameras and related services
307316
@echo "📷 Scanning for cameras (RTSP, HTTP, ONVIF, etc.)..."
308-
@python3 $(SCAN_SCRIPT) --network 192.168.1.0/24 --service rtsp,http,https,onvif,rtmp,rtmps,rtmpt,rtmpts,rtmpe,rtmpte,rtmfp --port 80-90,443,554,8000-8090,8443,8554,8888,9000-9001,10000-10001
317+
@python3 $(SCAN_SCRIPT) --network $(DEFAULT_NETWORK) --service $(SERVICES) --port $(COMMON_PORTS) --verbose
309318

310-
scan-camera:
319+
scan-camera: ## Scan a specific camera IP (make scan-camera IP=192.168.1.100)
320+
@if [ -z "$(IP)" ]; then echo "❌ Please specify an IP address: make scan-camera IP=192.168.1.100"; exit 1; fi
311321
@echo "🔍 Scanning camera at $(IP)..."
312-
@python3 $(SCAN_SCRIPT) --network $(IP) --service rtsp,http,https,onvif --port 80,81,82,83,84,85,86,87,88,89,90,443,554,8000,8001,8002,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8443,8554,8888,9000,9001,10000,10001 --verbose
313-
314-
scan-printers:
322+
@python3 $(SCAN_SCRIPT) --network $(IP) --service $(SERVICES) --port $(COMMON_PORTS) --verbose
323+
324+
## Quick and full network scans
325+
scan-quick: ## Quick scan of common ports (fast but less thorough)
326+
@echo "⚡ Quick network scan..."
327+
@python3 $(SCAN_SCRIPT) --network $(DEFAULT_NETWORK) --port 21-23,80,443,554,8000,8080,8081,8443,9000 --timeout 1
328+
329+
scan-full: ## Comprehensive scan (slower but more thorough)
330+
@echo "🔍 Full network scan (this may take a while)..."
331+
@python3 $(SCAN_SCRIPT) --network $(DEFAULT_NETWORK) --port 1-10000 --timeout 2
332+
333+
## Local network scan (common home network ranges)
334+
scan-local: ## Scan common local network ranges
335+
@echo "🏠 Scanning common local network ranges..."
336+
@for net in 192.168.0.0/24 192.168.1.0/24 192.168.2.0/24 10.0.0.0/24 10.0.1.0/24; do \
337+
echo "\n📡 Scanning network: $$net"; \
338+
python3 $(SCAN_SCRIPT) --network $$net --service $(SERVICES) --port $(COMMON_PORTS); \
339+
done
340+
341+
## Printer management
342+
scan-printers: ## List all available printers
315343
@echo "🖨️ Listing available printers..."
316344
@python3 $(PRINTER_SCRIPT) list
317345

346+
## Help target
347+
help: ## Show this help
348+
@echo "\nAvailable commands:"
349+
@echo "================="
350+
@echo "Network Scanning:"
351+
@echo " make scan-network - Scan default network for common services"
352+
@echo " make scan-cameras - Scan for cameras and related services"
353+
@echo " make scan-camera - Scan a specific camera (IP=required)"
354+
@echo " make scan-quick - Quick scan of common ports"
355+
@echo " make scan-full - Comprehensive network scan (slow)"
356+
@echo " make scan-local - Scan common local network ranges"
357+
@echo " make scan-local-camera - Scan local networks specifically for cameras"
358+
@echo "\nPrinter Management:"
359+
@echo " make scan-printers - List available printers"
360+
@echo " make print-test - Print a test page to default printer"
361+
@echo "\nExamples:"
362+
@echo " make scan-camera IP=192.168.1.100 # Scan specific device"
363+
@echo " make scan-network NETWORK=10.0.0.0/24 # Scan custom network"
364+
@echo " make scan-printers # List all available printers"
365+
318366
print-test:
319367
@echo "🖨️ Sending test page to default printer..."
320368
@echo "Hello from DialogChain! This is a test print." | python3 $(PRINTER_SCRIPT) print
@@ -438,4 +486,11 @@ quickstart: install-deps setup-env init-camera build-go
438486

439487
# Development workflow
440488
dev-workflow: dev lint test build
441-
@echo "✅ Development workflow completed"
489+
@echo "✅ Development workflow completed"
490+
## Scan for cameras on local networks
491+
scan-local-camera: ## Scan common local networks for cameras
492+
@echo "🔍 Scanning local networks for cameras..."
493+
@for net in 192.168.0.0/24 192.168.1.0/24 192.168.2.0/24 10.0.0.0/24 10.0.1.0/24; do \
494+
echo "\n📡 Scanning for cameras on network: $$net"; \
495+
python3 $(SCAN_SCRIPT) --network $$net --service rtsp,http,https,onvif --port 80,81,82,83,84,85,86,87,88,89,90,443,554,8000-8100,8443,8554,8888,9000-9010,10000-10010 --timeout 2 --verbose; \
496+
done

0 commit comments

Comments
 (0)