fastpluggy-network-node

No description available

v0.0.4
0 downloads this week
Latest version
Requires Python >=3.10

Quick Install

pip install fastpluggy-network-node
Or with specific version:
pip install fastpluggy-network-node==0.0.4

Network Node Plugin

Overview

The Network Node plugin provides network discovery, monitoring, and analysis capabilities. It allows you to scan your local network for devices, identify services running on those devices, and collect information about network interfaces and WiFi networks.

Installation

pip install fastpluggy-network-node

Package Structure

This plugin follows the standard fastpluggy plugin structure:
- pyproject.toml - Package configuration and metadata
- .gitlab-ci.yml - CI/CD configuration
- src/ - Source code
- plugin.py - Plugin entry point
- models.py - Database models
- routers/ - API and frontend routers
- schema/ - API schemas
- services/ - Business logic
- tasks/ - Background tasks
- templates/ - HTML templates

Dependencies

This plugin depends on:
- fastpluggy-tasks-worker (>= 0.0.1) - For asynchronous task execution
- fastpluggy-websocket-tool (>= 0.0.1) - For real-time updates
- python-nmap - For network scanning

Features

Network Discovery

  • Automatic detection of local network range
  • IP address scanning with ping sweep
  • MAC address resolution
  • Manufacturer identification from MAC addresses (OUI lookup)
  • Hostname resolution

Service Scanning

  • Port scanning with configurable ranges
  • Service detection and identification
  • Version detection
  • Banner grabbing
  • Vulnerability assessment

Network Interface Detection

  • Comprehensive detection of all network interfaces
  • Interface type identification (ethernet, wireless, loopback, bridge, tunnel)
  • Real-time status monitoring (up/down)
  • Network configuration details (IP address, MAC address, netmask, MTU, speed)

WiFi Network Scanning

  • Detection of available WiFi networks
  • Signal strength measurement
  • Security type identification
  • Channel and frequency information
  • Historical tracking of previously detected networks

Configuration

The plugin can be configured through the NetworkNodeConfig class in config.py. Key configuration options include:

Scan Configuration

# Common ports for scanning - most frequently used network service ports
COMMON_PORTS = [21, 22, 23, 25, 53, 80, 110, 111, 135, 139, 143, 443, 445, 993, 995, 1723, 3306, 3389, 5900, 8080]

# Scan configuration defaults
default_port_range: str = "1-1024"
default_scan_intensity: int = 3
default_timeout_seconds: int = 30

Service Detection Configuration

# Service detection configuration
enable_service_detection: bool = True
enable_os_detection: bool = False
enable_version_detection: bool = True
enable_script_scanning: bool = False

Performance Configuration

# Performance configuration
max_concurrent_scans: int = 10
scan_result_cache_ttl_minutes: int = 60

UI Configuration

# UI configuration
default_view_mode: str = "cards"  # cards or table
auto_refresh_interval_seconds: int = 300

OUI Lookup Configuration

The plugin includes functionality to identify device manufacturers from MAC addresses using OUI (Organizationally Unique Identifier) lookup. This feature is configured with the following settings in the NetworkNodeConfig class:

# OUI lookup configuration
oui_data_url: str = "https://standards-oui.ieee.org/oui/oui.txt"
oui_data_directory: str = "/data/network_node/oui"
oui_data_file: str = "/data/network_node/oui/oui.txt"
oui_cache_ttl_days: int = 30  # How often to refresh the OUI data

The OUI data is downloaded from the IEEE's official registry and cached locally in the /data/network_node/oui/ directory. The cache is refreshed automatically based on the configured TTL.

Usage

OUI Lookup

To get the manufacturer of a device from its MAC address:

from fastpluggy_plugin.network_node.services.oui_lookup import OUILookup

# Get the manufacturer for a MAC address
mac_address = "00:11:22:33:44:55"
manufacturer = OUILookup.get_manufacturer_from_mac(mac_address)
print(f"Device manufacturer: {manufacturer}")

Network Discovery

To discover devices on your local network:

from fastpluggy_plugin.network_node.tasks import network_discovery_task

# Discover devices on the local network
result = network_discovery_task(scan_method="ping")
print(result)

Service Scanning

To scan for services on a specific device:

from fastpluggy_plugin.network_node.tasks import service_scan_task

# Scan for services on a specific IP address
ip_address = "192.168.1.100"
port_range = "1-1024"
result = service_scan_task(ip_address, port_range)
print(result)

Full Network Scan

To perform a complete network scan (discovery + service scanning):

from fastpluggy_plugin.network_node.tasks import full_network_scan_task

# Run a full network scan
result = full_network_scan_task()
print(result)

Data Storage

  • Network nodes and services are stored in the database using SQLAlchemy models
  • OUI data is stored in the /data/network_node/oui/ directory
  • WiFi network data is stored in the database for historical tracking

API Endpoints

The plugin provides API endpoints for accessing network data:

Network Nodes

  • Endpoint: /api/network/nodes
  • Method: GET
  • Description: Get all network nodes with their services
  • Response: NetworkNodesResponse containing:
  • nodes: List of network nodes with their services
  • total_nodes: Total count of nodes
  • online_nodes: Count of online nodes
  • offline_nodes: Count of offline nodes
  • total_services: Total count of services across all nodes

Scan Status

  • Endpoint: /api/network/scan/status
  • Method: GET
  • Parameters:
  • task_id: ID of the scan task
  • Description: Check the status of a running scan task
  • Response: ScanStatusResponse containing task status information

Network Interfaces

  • Endpoint: /api/network/interfaces
  • Method: GET
  • Description: Get all network interfaces detected on the local system
  • Response: NetworkInterfacesResponse containing:
  • interfaces: List of network interfaces
  • total_interfaces: Total count of interfaces
  • active_interfaces: Count of active interfaces

WiFi Networks

  • Endpoint: /api/network/wifi/networks
  • Method: GET
  • Parameters:
  • show_historical: Whether to include historical networks (default: true)
  • Description: Scan for available WiFi networks and return both current and historical networks
  • Response: WiFiNetworksResponse containing:
  • networks: List of all networks (current and historical)
  • current_networks: List of currently active networks
  • historical_networks: List of previously detected networks
  • total_networks: Total count of all networks
  • active_networks: Count of currently active networks
  • historical_networks_count: Count of historical networks
  • security_counts: Count of networks by security type
  • frequency_counts: Count of networks by frequency band

Web Interface

The plugin provides web interfaces for viewing network data:

  • /network/dashboard - Network dashboard
  • /network/nodes - Network nodes
  • /network/services - Network services
  • /network/interfaces - Network interfaces
  • /network/wifi - WiFi networks

Dependencies

  • psutil - For network interface detection
  • loguru - For logging
  • SQLAlchemy - For database models

Changes to Network Node Tasks

Summary of Changes

The original tasks.py file has been refactored into a proper Python module with the following structure:

network_node/
└── tasks/
    ├── __init__.py       # Module initialization and exports
    ├── discovery.py      # Network node discovery functionality
    ├── service_scan.py   # Service scanning functionality
    ├── README.md         # Module documentation
    └── CHANGES.md        # This file

Detailed Changes

  1. Created a Module Structure
    - Created a tasks directory within the network_node module
    - Added an __init__.py file to make it a proper Python module
    - Organized imports and exports in the __init__.py file

  2. Split Functionality
    - Moved network discovery functions to discovery.py
    - Moved service scanning functions to service_scan.py
    - Maintained the same function signatures for backward compatibility

  3. Improved Import Handling
    - Added proper error handling for optional dependencies
    - Used conditional imports to avoid circular dependencies
    - Added the TASKS_WORKER_AVAILABLE flag to check for task worker availability

  4. Added Documentation
    - Created a comprehensive README.md with module structure and usage examples
    - Added this CHANGES.md file to document the refactoring process

Benefits of the New Structure

  1. Better Organization
    - Clear separation of concerns between discovery and service scanning
    - Easier to understand and maintain the codebase

  2. Improved Imports
    - More explicit imports make dependencies clearer
    - Reduced risk of circular imports

  3. Better Documentation
    - Comprehensive documentation of the module structure and usage
    - Examples for common use cases

Backward Compatibility

The refactoring maintains backward compatibility by:

  1. Keeping the same function signatures
  2. Exporting all functions through the __init__.py file
  3. Ensuring that the module can be imported the same way as before

Usage

The module can be used the same way as before:

from src.domains.network_node.tasks import network_discovery_task, service_scan_task

Or with more explicit imports:

from src.domains.network_node.tasks.discovery import network_discovery_task
from src.domains.network_node.tasks.service_scan import service_scan_task

fastpluggy-network-node API

API documentation for this plugin is not available.

Package Analysis

Last analysis performed: 2025-08-14 14:10:16

✓ Valid Entry Point

This plugin has a valid entry point:
network_node = fastpluggy_plugin.network_node.plugin:NetworkNodePlugin

No Issues Found

No issues were found during the analysis of this package.

v0.0.73

v0.0.72

v0.0.71

v0.0.70

v0.0.69

v0.0.68

v0.0.67

v0.0.66

v0.0.65

v0.0.64

v0.0.63

v0.0.62

v0.0.61

v0.0.60

v0.0.59

v0.0.58

v0.0.57

v0.0.56

v0.0.55

v0.0.54

v0.0.53

v0.0.52

v0.0.51

v0.0.50

v0.0.49

v0.0.48

v0.0.47

v0.0.46

v0.0.45

v0.0.44

v0.0.43

v0.0.42

v0.0.41

v0.0.40

v0.0.39

v0.0.38

v0.0.37

v0.0.36

v0.0.35

v0.0.34

v0.0.33

v0.0.32

v0.0.30

v0.0.29

v0.0.28

v0.0.27

v0.0.26

v0.0.25

v0.0.24

v0.0.23

v0.0.22

v0.0.21

v0.0.20

v0.0.19

v0.0.18

v0.0.17

v0.0.16

v0.0.15

v0.0.14

v0.0.13

v0.0.12

v0.0.11

v0.0.10

v0.0.9

v0.0.8

v0.0.7

v0.0.6

v0.0.5

v0.0.4

Latest

Plugin Information

Name
fastpluggy-network-node
Version
0.0.4
Entry Point
fastpluggy_plugin.network_node.plugin:NetworkNodePlugin
Python
>=3.10
Status
Community
License
MIT
Keywords
network discovery monitoring wifi

Dependencies

fastpluggy-websocket-tool
None

Download Statistics

0
Weekly
1
Monthly
1
Total

Download Frequency: ~1 downloads per month
Average Per Day: 0.0 downloads
Last Download: 30 days ago
Yearly Estimate: 12 downloads
0% estimated growth rate based on 30 days of data