Skip to main content

A comprehensive tool for scanning and debugging RTSP streams in networks

Project description

RTSP Scanner

A comprehensive Python tool for scanning, debugging, and testing RTSP (Real Time Streaming Protocol) streams in networks. This tool helps network administrators and security professionals discover RTSP cameras, test connectivity, and identify available channels.

Features

  • Network Port Scanning: Scan entire networks or IP ranges for open RTSP ports
  • RTSP URL Testing: Validate and test RTSP URLs for connectivity and accessibility
  • Channel Discovery: Automatically discover available RTSP channels on cameras
  • Credential Testing: Test common default credentials on RTSP streams
  • Multi-threaded: Fast concurrent scanning with configurable workers
  • Debug Logging: Detailed logging for troubleshooting
  • Export Results: Export scan results to JSON or CSV formats
  • No Dependencies: Uses only Python standard library

Installation

From Source

# Clone the repository
git clone https://github.com/yourusername/rtsp-scanner.git
cd rtsp-scanner

# Install the package
pip install -e .

Using pip (once published)

pip install rtsp-scanner

Build Distribution Package

# Build wheel and source distribution
python setup.py sdist bdist_wheel

# Install from built package
pip install dist/rtsp-scanner-1.0.0-py3-none-any.whl

Usage

Command Line Interface

The tool provides several commands for different scanning operations:

1. Scan Network for RTSP Ports

Scan an entire network range for open RTSP ports:

rtsp-scanner scan-network 192.168.1.0/24

With custom ports:

rtsp-scanner scan-network 192.168.1.0/24 --ports 554 8554 7447

2. Scan Single Host

Scan ports on a specific host:

rtsp-scanner scan-ports 192.168.1.100

3. Scan IP Range

Scan a range of IP addresses:

rtsp-scanner scan-range 192.168.1.1 192.168.1.50

4. Test RTSP URL

Test a specific RTSP URL for connectivity:

rtsp-scanner test-url rtsp://192.168.1.100:554/stream

With authentication:

rtsp-scanner test-url rtsp://192.168.1.100:554/stream --username admin --password admin

5. Validate RTSP URL

Validate URL format and parse components:

rtsp-scanner validate-url rtsp://192.168.1.100:554/Streaming/Channels/101

6. Scan for Channels

Discover available RTSP channels on a camera:

rtsp-scanner scan-channels 192.168.1.100

With authentication:

rtsp-scanner scan-channels 192.168.1.100 --username admin --password admin

With credential testing (tries common default credentials):

rtsp-scanner scan-channels 192.168.1.100 --with-creds

7. Quick Channel Scan

Quick scan with only the most common paths:

rtsp-scanner quick-scan 192.168.1.100

8. Scan Numbered Channels

Scan numbered channel patterns (channel1, channel2, etc.):

rtsp-scanner scan-numbered 192.168.1.100

With custom range:

rtsp-scanner scan-numbered 192.168.1.100 --range 1-32

9. Test Common Credentials

Test common default credentials on a URL:

rtsp-scanner test-credentials rtsp://192.168.1.100:554/

Global Options

Available for all commands:

  • --debug: Enable debug logging for detailed output
  • --log-file FILE: Log output to a file
  • --output FILE: Export results to JSON or CSV file
  • --timeout SECONDS: Connection timeout (default: 2.0)
  • --workers NUM: Max concurrent workers (default: 50)

Examples:

# Enable debug mode with file logging
rtsp-scanner scan-network 192.168.1.0/24 --debug --log-file scan.log

# Export results to JSON
rtsp-scanner scan-channels 192.168.1.100 --output results.json

# Adjust timeout and workers
rtsp-scanner scan-network 192.168.1.0/24 --timeout 5 --workers 100

Python API

You can also use RTSP Scanner as a Python library:

Port Scanner

from rtsp_scanner.core.port_scanner import PortScanner
from rtsp_scanner.utils.logger import setup_logger

# Setup logger
logger = setup_logger(debug=True)

# Create scanner
scanner = PortScanner(timeout=2.0, max_workers=50, logger=logger)

# Scan network
results = scanner.scan_network('192.168.1.0/24')

# Scan single host
results = scanner.scan_host('192.168.1.100')

# Scan IP range
results = scanner.scan_ip_range('192.168.1.1', '192.168.1.50')

print(results)

RTSP Tester

from rtsp_scanner.core.rtsp_tester import RTSPTester

# Create tester
tester = RTSPTester(timeout=5.0)

# Validate URL
is_valid, message = tester.validate_rtsp_url('rtsp://192.168.1.100:554/stream')
print(f"Valid: {is_valid}, Message: {message}")

# Parse URL
parsed = tester.parse_rtsp_url('rtsp://admin:admin@192.168.1.100:554/stream')
print(parsed)

# Test connection
result = tester.test_rtsp_connection('rtsp://192.168.1.100:554/stream')
print(result)

# Test with authentication
result = tester.test_rtsp_with_auth('rtsp://192.168.1.100:554/stream', 'admin', 'admin')
print(result)

# Test common credentials
results = tester.test_common_credentials('rtsp://192.168.1.100:554/')
print(results)

Channel Scanner

from rtsp_scanner.core.channel_scanner import ChannelScanner

# Create scanner
scanner = ChannelScanner(timeout=5.0, max_workers=20)

# Scan channels
channels = scanner.scan_channels('192.168.1.100', port=554)
print(channels)

# Scan with authentication
channels = scanner.scan_channels('192.168.1.100', username='admin', password='admin')

# Scan with credential testing
channels = scanner.scan_with_credentials('192.168.1.100')

# Quick scan
channels = scanner.quick_scan('192.168.1.100')

# Scan numbered channels
channels = scanner.scan_numbered_channels('192.168.1.100', channel_range=range(1, 17))

Output Formatting

from rtsp_scanner.utils.output import OutputFormatter

formatter = OutputFormatter()

# Format as table
table = formatter.format_table(results, headers=['host', 'port', 'status'])
print(table)

# Format as JSON
json_str = formatter.format_json(results, pretty=True)
print(json_str)

# Export to file
formatter.export_json(results, 'results.json')
formatter.export_csv(results, 'results.csv')

# Print summary
summary = formatter.format_summary(results, scan_type="Network Scan")
print(summary)

Supported Camera Manufacturers

The scanner includes path patterns for many popular camera brands:

  • Hikvision
  • Dahua
  • Axis
  • Foscam
  • Amcrest
  • TP-Link
  • Generic ONVIF cameras
  • And many more...

Common RTSP Ports

The scanner checks these ports by default:

  • 554 (Standard RTSP)
  • 8554
  • 7447
  • 5554
  • 88
  • 8000
  • 8080
  • 8888

Security Considerations

This tool is designed for:

  • Authorized network security assessments
  • Testing your own cameras and infrastructure
  • Network administration and troubleshooting
  • Educational purposes

Warning: Only use this tool on networks and devices you own or have explicit permission to test. Unauthorized scanning may be illegal in your jurisdiction.

Troubleshooting

Connection Timeouts

If you're experiencing many timeouts:

rtsp-scanner scan-network 192.168.1.0/24 --timeout 5

Slow Scanning

Increase the number of workers:

rtsp-scanner scan-network 192.168.1.0/24 --workers 100

Debug Mode

Enable debug logging to see detailed information:

rtsp-scanner scan-channels 192.168.1.100 --debug

Save Logs

Save debugging logs to a file:

rtsp-scanner scan-network 192.168.1.0/24 --debug --log-file scan.log

Project Structure

rtsp-scanner/
├── rtsp_scanner/
│   ├── __init__.py
│   ├── cli.py                  # Command-line interface
│   ├── core/
│   │   ├── __init__.py
│   │   ├── port_scanner.py     # Network port scanning
│   │   ├── rtsp_tester.py      # RTSP URL testing
│   │   └── channel_scanner.py  # Channel discovery
│   └── utils/
│       ├── __init__.py
│       ├── logger.py           # Logging utilities
│       └── output.py           # Output formatting
├── setup.py
├── pyproject.toml
├── requirements.txt
├── MANIFEST.in
└── README.md

Requirements

  • Python 3.7 or higher
  • No external dependencies (uses only standard library)

Development

Running Tests

# Install development dependencies
pip install pytest

# Run tests (when implemented)
pytest tests/

Code Formatting

# Install formatters
pip install black flake8

# Format code
black rtsp_scanner/

# Check style
flake8 rtsp_scanner/

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Changelog

Version 1.0.0 (2025-11-25)

  • Initial release
  • Network port scanning
  • RTSP URL testing and validation
  • Channel discovery
  • Credential testing
  • Export to JSON/CSV
  • Comprehensive CLI interface

Author

RTSP Scanner Team

Support

For issues, questions, or contributions, please visit: https://github.com/yourusername/rtsp-scanner/issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rtsp_network_scanner-1.0.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file rtsp_network_scanner-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rtsp_network_scanner-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 568729be740f45fe6cfb25473132445317207eaa5fecf7e818d3aaf10a46b014
MD5 20e97a7ae7a34157419b6b1021aad3de
BLAKE2b-256 f5ddf4bf49f375194748797998d57675481e8123a27368ef53e2360a7606f942

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page