Python for Network Engineers

Create a Tkinter Gui With Sqlite Backend

By George El. • March 2020 • Reading time: 4 minutes

In this post I will show you how to create a single gui app using tkinter as frontend and sqlite as a backend. Python has many gui libraries and tkinter is one of them that is supported natively, that is you don’t need to install any extra modules. The app has the ability to search, add, update and delete router from a sqlite database.

Perform an Arp Poisoning Attack Using Scapy

By George El. • November 2019 • Reading time: 3 minutes

In this post I will show you how to perform an arp poisoning attack on local network using a python package called scapy. Scapy is a package that allows us to craft our own packets specifying all layers from layer2 to layer7. In my local network I have two pcs, with addresses 192.

Using TextFSM to Parse Cli Output

By George El. • July 2019 • Reading time: 4 minutes

Many times we connect to a router or switch usually with netmiko and we want to parse the output of a command. TextFSM is a Python module for parsing semi-structured text into python tables. It uses templates that use regular expressions in order to parse the output. The good thing is that there are already hundreds of templates for many devices and commands.

Using CiscoConfParse to Parse Cisco Configurations

By George El. • June 2019 • Reading time: 3 minutes

In this post I will present a python module that makes the parsing of cisco configuration files easy. The module is called CiscoConfParse Lets start by installing it pip install ciscoconfparse I will use the following cisco file which is taken from the documentation site, but I have added a few lines in the beginning

Using Python to Remove Passwords and IP Addresses From Configuration Files

By George El. • January 2019 • Reading time: 4 minutes

Lets assume you have a configuration file and you want to send it to someone, but you want to remove the passwords, and ip addresses before you send it. the program takes one argument, the config to be read import sys import re if len(sys.argv) < 2: print("please type a configuration file: replaceIPs.

Configuring Dhcp Snooping and Arp Inspection on Cisco Switches

By George El. • January 2019 • Reading time: 4 minutes

Dhcp snooping is a feature that protects against rogue DHCP agents. This happens by characterising links as trusted and untrusted. Untrusted ports can only forward requests, while trusted can forward all dhcp messages. steps to to configure dhcp 1. characterize uplink interfaces as trusted I assume your dhcp server is on the distribution or core layer.

Remote Span Quick Configuration

By George El. • January 2019 • Reading time: 1 minute

remote span quick tip lets say you want to capture some packets from switch A that is connected to switch B and you have your packet capture device on the swB You have to specify a vlan on all switches as remote-span vlan 400 remote-span On switch A where your host is connected to gi1/0/1

Ip fragmentation and ip mtu size

By George El. • December 2018 • Reading time: 5 minutes

In this example, I explain the ip fragmentation, based on the ip mtu size and the role of icmp unreachable messages. You can follow along, by downloading the pcap files&nbsp;<a href="R3-cloud.pcapng">cloud-R3</a> <a href="R2-R3.pcapng">R2-R3</a> I have the following topology. Cloud 1 is where my PC is with ip address 192.168.137.1, a windows 10 machine, from wich I ping router R2 which has a loopback ip address of 2.

To VTP or Not to VTP

By George El. • December 2018 • Reading time: 3 minutes

VTP is the cisco Vlan Trunking Protocol. It allows the automatic configuration of vlans by setting one or more switches as VTP servers and other switches as VTP clients. Changes are allowed only in the Servers. There is another mode, called transparent, which allows the propagation of vtp advertisements but does not participate in the vtp domain.