Python libraries for networking

Someone told me about these python libraries for python for networking. I am sure that I will not remember them by heart, so I will write these libraries here, in order to remember

  • Asyncio – Python standard library. Asynchronous I/0, event loops, coroutines and tasks
  • Diesel – coroutine-based networking library for python
  • Pulsar – Event driven concurrent framework for Python
  • NAPALM (Network Automation and Programmability Abstraction Layer with Multivendor support) is a Python library that implements a set of functions to interact with different network device Operating Systems using a unified API.
  • Twisted – an event-driven networking engine written in Python 

C vs Python

I saw this picture on Instagram on page of some guy that teaches python

I assume that what this guy meant is that python fits best for some kind of applications than c, and for some kind of applications c fits better than python, and not that c generally sucks compared to python.

Pinging host for a lot of time

TL;DR: use this program to track if a host up or down using ping.

Sometimes for some kind of a check, I need to ping a host for a lot of time and see when the ping wasn’t successful. The familiar ping program doesn’t fit that purpose. Ping’s lines will scroll back, and if at some point ping will be unsuccessful, there is no way to know when it happened.

I searched google for a program that will log pings and tell when they were successful and when they were not. Found some for free and some programs that costs money.

I created a simple python script that will do just that. In addition I compiled the script to executable file for windows.

The program will ping destination and print the time when the ping was successful or not. After that it will print every time the destination changes it’s status. Output example:

./ -s
system up at 2018-04-02 10:37:05.976400
system down at 2018-04-02 10:37:19.039902
system up at 2018-04-02 10:37:26.063647

The program source code and executable file can be downloaded from my github page.