Skip to main content

Python library for ISP network management - MikroTik, Ubiquiti NanoStation, Cisco, SNMP

Project description

isptools 🌐 (v3.0.0)

PyPI version Python versions License: MIT


🌍 (Arabic / العربية)

isptools هي مكتبة Python احترافية وأداة سطر أوامر (CLI) متكاملة مصممة خصيصاً لمهندسي الشبكات وفنيي مزودي خدمات الإنترنت (ISPs).

❓ ما هي أداة isptools؟

هي أداة شاملة لإدارة أجهزة الشبكة من شركات مختلفة مثل MikroTik, Ubiquiti, Cisco, و أجهزة SNMP عبر واجهة موحدة.

⚙️ كيف تعمل الأداة؟

  1. الاتصال الموحد: تستخدم بروتوكولات (SSH, HTTP, API) للوصول للأجهزة.
  2. التحليل: تحول البيانات المعقدة إلى تقارير بسيطة.
  3. الإصلاح التلقائي (AutoFix): تكتشف المشاكل (مثل ضعف الإشارة) وتعالجها تلقائياً.
  4. رسم الخرائط: ترسم خريطة الشبكة (Topology) آلياً.

👨‍💻 المطور

تم التطوير بواسطة ياسين طه (devyassin01).

💻 الأنظمة المدعومة

تعمل على: Linux, Windows, macOS, و Android (Termux).


🌎 (English / الإنجليزية)

isptools is a professional Python library and CLI tool designed specifically for network engineers and ISP technicians.

❓ What is isptools?

It is a comprehensive tool for managing network equipment from multiple vendors like MikroTik, Ubiquiti, Cisco, and SNMP devices through a unified interface.

⚙️ How does it work?

  1. Unified Connection: Uses standard protocols (SSH, HTTP, API) to access devices.
  2. Analysis: Converts complex data into simple, readable reports.
  3. Self-Healing (AutoFix): Detects issues (like low signal) and fixes them automatically.
  4. Topology Mapping: Automatically maps the network structure.

👨‍💻 Developer

Developed by Yassin Taha (devyassin01).

💻 Supported Systems

Runs on: Linux, Windows, macOS, and Android (Termux).


Features

  • Unified API: One library to talk to multiple vendor platforms.
  • MikroTik: Full support via RouterOS API.
  • Ubiquiti NanoStation: Deep integration with airOS 6.x/8.x (Auto-detection, Link Quality, Spectrum Scan).
  • Cisco: Command execution via SSH (Netmiko).
  • SNMP: Generic monitoring support (v1, v2c, v3).
  • CLI Tool: Powerful isptools command for terminal-based management.
  • Monitoring: Built-in asynchronous poller for concurrent device monitoring.
  • Alerting: Flexible alert manager with threshold-based rules.

Installation

pip install isptools

CLI Usage

The library comes with a powerful CLI tool:

# Scan a device for full info
isptools scan --host 192.168.1.20 --user admin --password pass --type ubiquiti

# List connected clients
isptools clients --host 192.168.1.1 --user admin --password pass --type mikrotik

# Live monitor stats
isptools monitor --host 10.0.0.1 --user ubnt --password ubnt --type ubiquiti --interval 2

Quick Start (Python API)

Basic Usage

from isptools import ISPTools, Device

# Initialize
isp = ISPTools()

# Add a MikroTik device
isp.add_device(Device(
    host="192.168.88.1", 
    username="admin", 
    password="password", 
    device_type="mikrotik"
))

# Connect and get stats
isp.connect_all()
stats = isp.get_stats("192.168.88.1")
print(f"CPU Load: {stats.cpu_load}%")

Advanced NanoStation Support

from isptools import ISPTools, Device

isp = ISPTools()
isp.add_device(Device(host="192.168.1.20", username="ubnt", password="ubnt", device_type="ubiquiti"))
isp.connect_all()

driver = isp.devices["192.168.1.20"]
quality = driver.get_link_quality()
print(f"Link Quality Score: {quality['score']}/100 ({quality['level']})")

# Run spectrum scan
# results = driver.scan_spectrum()

Advanced Features

AutoFix (Self-Healing)

Automatically detect and repair common network issues with a permission-based system.

from isptools import ISPTools, Device, PermissionManager, PermissionLevel, AutoFixEngine

pm = PermissionManager(level=PermissionLevel.SAFE_FIX, require_confirm=True)
engine = AutoFixEngine(pm)

isp = ISPTools()
# ... add devices ...
stats = isp.get_stats("192.168.1.20")
results = engine.apply_fixes(isp.devices["192.168.1.20"], stats.__dict__)

Network Topology Mapping

Discover how your devices are connected and export the graph.

from isptools import TopologyMapper, TopologyExporter

mapper = TopologyMapper(list(isp.devices.values()))
graph = mapper.discover()
print(TopologyExporter.to_mermaid(graph))

Reports & History

Track bandwidth and performance over time using SQLite.

from isptools import StatsCollector, Reporter

collector = StatsCollector()
reporter = Reporter(collector)

# After some polling...
reporter.export_html("192.168.1.1", hours=24, output_path="daily_report.html")

Telegram Alerts

Get notified of issues directly on your phone.

from isptools import TelegramNotifier

tg = TelegramNotifier(bot_token="YOUR_TOKEN", chat_id="YOUR_ID")
tg.send_alert("192.168.1.20", "Signal dropped to -85 dBm", "Increased TX power ✅")

API Reference

Device Dataclass

Field Type Description
host str IP address or hostname
username str Login username
password str Login password
device_type str mikrotik, ubiquiti, cisco, snmp
port int Optional override port

ISPTools Class Methods

  • add_device(device: Device): Register a device.
  • connect_all(): Establish connections to all devices.
  • get_stats(host: str) -> DeviceStats: Fetch performance metrics.
  • get_clients(host: str) -> List[Station]: List connected clients.
  • start_monitor(interval: int): Start async background polling.
  • stop_monitor(): Stop polling.

Publishing

To publish a new version to PyPI:

  1. Update version in isptools/version.py.
  2. Commit changes and push.
  3. Create a git tag:
git tag -a v3.0.0 -m "Release version 3.0.0"
git push origin v3.0.0

GitHub Actions will automatically build and publish to PyPI.


👨‍💻 Developer

isptools was developed by Yassin Taha

[

Instagram

](https://instagram.com/y_as.01) [

GitHub

](https://github.com/alexiq01)

Built with ❤️ for ISP engineers and network technicians.

License

MIT

Project details


Download files

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

Source Distribution

isptools_pro-3.0.0.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

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

isptools_pro-3.0.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file isptools_pro-3.0.0.tar.gz.

File metadata

  • Download URL: isptools_pro-3.0.0.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for isptools_pro-3.0.0.tar.gz
Algorithm Hash digest
SHA256 c2ab8b7b98d4ef063809da588aad5cb6d19f9956dfb843987334ce2538707aec
MD5 bdcfd5bea4a4330839f90584e6110e9b
BLAKE2b-256 3d2ff5ea2208ac86515b3835a68359c352a169e36d42b53db6802481c2a98c97

See more details on using hashes here.

File details

Details for the file isptools_pro-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: isptools_pro-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for isptools_pro-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19f8ea4f40970f6f0bb83e958060dbbedd116a67d6e33706c757be1eaa71c1e4
MD5 c6169fef8a8ae459e2298c5c4da8e2ea
BLAKE2b-256 383cd1c9c8cd6a4e6965fb225e30106cd4054033cb3f34bbb230dfd4d255c965

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