Pyric - Python Wireless Library

0.1.6.3 · active · verified Fri Apr 17

Pyric is a Python library designed to simplify interaction with wireless network interfaces on Linux. It provides tools to manage wireless devices, query their status, and control modes like monitor mode. The current version is 0.1.6.3, and it appears to be actively maintained with recent commits, though new releases are infrequent.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import `pyw` and list available wireless interfaces on your system, including a crucial check for root privileges which are often required for Pyric operations. It also shows how to get basic information like driver and PHY number for detected interfaces.

import os
from pyric import pyw

# Check for root privileges - Pyric often requires root to interact with wireless interfaces
if os.geteuid() != 0:
    print("Warning: This script should ideally be run as root for full functionality.\nProceeding, but some operations might fail due to permissions.")

# List all wireless interfaces
try:
    interfaces = pyw.winterfaces()
    if interfaces:
        print(f"Found wireless interfaces: {', '.join(interfaces)}")
        for iface in interfaces:
            print(f"  - Interface: {iface}, Driver: {pyw.driverinfo(iface)}, PHY: {pyw.phynum(iface)}")
    else:
        print("No wireless interfaces found. Ensure adapter is enabled and drivers are loaded.")
except Exception as e:
    print(f"An error occurred while listing interfaces: {e}")
    print("Ensure you have proper permissions (run as root) and that wireless drivers are loaded.")

view raw JSON →