python
RSA PKI based encryption and decryption in python
Generate RSA key pair in pem format Remember above pem file contains private and public key. Keep it secure with yourself. Extract public key out of pem file Now you have private key embedded in private.pem file along with public key. And a copy of public key is available in public.pem file. You can share […]
Python pandas dataframe to Influxdb with column and other tags
Python pandas is very powerful data processing library. It can take large data from variety of sources (CSVs, databases, excel etc) and process it in memory. After processing the data you may have to dump it in influxdb. In influxdb each measurement has tags and fields. While writing pandas dataframe to influxdb we can define […]
Mass network connection tracker
At times, you want to keep track of network connections between multiple hosts on different TCP ports. For example, if you have a medium or large scale infra comprising of many applications, databases, devices etc. All these mutually connect with each other on TCP ports. And in case there is an unannounced change in routing […]
Login and parse ASP.NET sites with Python
I am using web scraping on several sites to get information like prices from e-commerce sites and meter readings, balance amount etc from my apartment service provider portal. This is fairly simple to do in python using “requests” and “beautifulsoup” modules. Recently, my apartment service provider revamped their website in ASP.NET. I thought it was […]
Automated bulk command execution on SSH enabled hosts and devices
In the lockdown period, during pandemic, there is nothing much to do over weekend 😏. Was just thinking of writing ✍️ something, something useful…. then came up with an idea to address a common problem that many sysadmins and netadmins come across. At times, we want to run set of commands on many devices, hosts […]
High performance python based SNMP poller
In my last post, I wrote a basic SNMP poller using python easysnmp module. To make it more practical and industry ready I have further enriched it with following: Read SNMPv2 and SNMPv3 devices from CSV file. Based on the field count in device record use SNMPv2 or SNMPv3 module. Poll thousands of devices by […]
SNMP polling to get network interface statistics
This is very common used case in industry. Lets see how this can be implemented in python using easysnmp python module. This can be further extended to inject collected data into databases or CSVs. Here is the sample result of above program.
Ping and NMAP as REST API
I came across this idea while working on problem statement, where requirement was to run ping and nmap checks on devices and hosts from a jump server. Best way to offer nmap and ping check without getting users on jump server was to offer ping and nmap in some form of web service. To do […]
Python Dictionary – versatile data Structure
Python is really simple and powerful when you have to handle complex data objects. Dictionary is one of the popular data structures used in python. Just thought to put up quick code explaining what all you can do with a dictionary object in really simple way. Here is the output you get upon executing above […]
LDAP operations using Python
Normal command line LDAP tools such as ldapsearch, ldapadd, ldapmodify etc are handy when you are playing with standalone data. But if you want to do operations such as, taking user data from CSV in LDAP or get a neat formatted output for LDAP queries then python-ldap module is really what you need. Here is […]