mirror of
https://github.com/vinta/awesome-python.git
synced 2026-10-06 17:05:16 +08:00
docs: add Network Virtualization category intro
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
Configure network devices from several vendors through one API with the Python network automation library NAPALM. Scapy forges, sends, and sniffs packets.
|
||||
|
||||
How to choose:
|
||||
|
||||
- Configuring network devices from several vendors, or reading their state: NAPALM
|
||||
- Forging, sending, sniffing, and dissecting network packets: Scapy
|
||||
|
||||
NAPALM [talks to network devices of different operating systems through a unified API](https://napalm.readthedocs.io/en/latest/), to change their configuration or retrieve data from them. `pip install napalm` [installs all the core drivers](https://napalm.readthedocs.io/en/latest/installation/index.html). Pick the driver for your device's OS with [`get_network_driver()`](https://napalm.readthedocs.io/en/latest/#selecting-the-right-driver), like `get_network_driver('eos')`. Then [connect in a `with` block](https://napalm.readthedocs.io/en/latest/tutorials/context_manager.html), which opens and closes the session for you. To change the configuration, [load a candidate that replaces the device's config or merges into it](https://napalm.readthedocs.io/en/latest/tutorials/changing_the_config.html#replacing-the-configuration), and check the diff with `compare_config()`. Then apply it with `commit_config()`, or throw it away with `discard_config()`. What each driver supports differs, so [test your workflow in a lab first](https://napalm.readthedocs.io/en/latest/support/index.html#configuration-support-matrix).
|
||||
|
||||
Scapy [sends, sniffs, dissects, and forges network packets](https://scapy.readthedocs.io/en/latest/introduction.html#about-scapy), and you can use it [as a shell or as a library](https://github.com/secdev/scapy). Instead of telling you a port is open or closed, it [gives you the full decoded packets](https://scapy.readthedocs.io/en/latest/introduction.html#what-makes-scapy-so-special), so you probe once and interpret many times. Install it with `pip install scapy`, and on Windows, [install Npcap first](https://scapy.readthedocs.io/en/latest/installation.html#windows). [Sending packets needs root privileges](https://scapy.readthedocs.io/en/latest/usage.html#starting-scapy), so start the shell with `sudo scapy`, or on Windows from a command prompt with administrator privileges. Build a packet by [stacking layers with `/`](https://scapy.readthedocs.io/en/latest/usage.html#stacking-layers), like `IP()/TCP()`, and fields you don't set get sensible defaults. In your own scripts, [import what you need from `scapy.all`](https://scapy.readthedocs.io/en/latest/extending.html#using-scapy-in-your-tools).
|
||||
Reference in New Issue
Block a user