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.
pip install pyricVerified import paths — ran on the pinned version, not inferred.
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.
Ensure you are running Pyric on a Linux operating system for full functionality. Use platform-specific libraries or conditional logic if cross-platform support is needed.
Execute your Python script with `sudo python your_script.py`. Incorporate `os.geteuid() != 0` checks in your code to alert users if root is required.
Dynamically discover interfaces using `pyw.winterfaces()` or `pyw.phynum()` and select the desired one. Always clean up temporary interfaces created (e.g., `pyw.monstop('mon0')`).Verify the capabilities of your wireless card and its driver using `iw list`. Ensure no other network managers (like NetworkManager) are interfering. Try bringing the interface down (`pyw.down(dev)`) before changing its mode (`pyw.monstart(dev, 'mon0')`).
Run your Python script with `sudo`. Example: `sudo python your_script.py`.
Check `pyw.winterfaces()` for an empty list before attempting to access elements. Ensure your wireless adapter is present, enabled, and its drivers are loaded. Also, verify you're running on Linux.
Verify the interface name using `ifconfig` or `ip a`. Use `pyw.winterfaces()` to get a list of active wireless interfaces. Ensure the interface is 'up' if required by the operation.