Skip to content

Instantly share code, notes, and snippets.

View vnetman's full-sized avatar

Venkat C vnetman

  • Bangalore
View GitHub Profile
@vnetman
vnetman / ilgeoip.py
Created May 19, 2019 02:21
Program appends Geo IP information to IPv4 addresses
#!/usr/bin/env python2.7
# This program reads lines on stdin and copies them to stdout, after
# appending any IPv4 addresses found on the line with geo information.
#
# Examples:
#
# $ echo "Hello there" | ./ilgeoip.py
# Hello there
#
@vnetman
vnetman / netmiko_description_to_vlan.py
Created March 21, 2019 03:38
Netmiko script to place an interface in a VLAN based on its description
#!/usr/bin/env python3
import sys
import re
import logging
import ipaddress
import netrc
from netmiko import Netmiko
# Netmiko script to place different interfaces in different VLANs based
@vnetman
vnetman / ipv4.py
Created April 25, 2018 05:36
Convert an IPv4 address in standard (dotted decimal) notation to a decimal number, for educational/entertainment purposes
#!/usr/bin/env python3
#
# Convert an IPv4 address in standard (dotted decimal) notation to a
# decimal number, for educational/entertainment purposes
# .
#
# E.g.
#
# vnetman@vnetman-laptop:~/data/bin$ ./ipv4.py
# Usage: ./ipv4.py <ipv4 address>
@vnetman
vnetman / md5sum.py
Created April 25, 2018 04:54
md5sum.py: Python code to return the same md5sum as the Linux 'md5sum' utility
#!/usr/bin/env python3
import os
import sys
import hashlib
def md5sum(filename):
try:
fh = open(filename, 'rb')
except IOError as e:
@vnetman
vnetman / gist:ad6609837cb96ded15655521d0416ae8
Created March 26, 2018 15:39
hosts3d packet counter fix
diff --git a/src/hosts3d.cpp b/src/hosts3d.cpp
index 6ac5886..b8b0bed 100644
--- a/src/hosts3d.cpp
+++ b/src/hosts3d.cpp
@@ -49,6 +49,7 @@ host_type *seltd = 0, *lnkht = 0; //selected host, link line host
MyLL hstsLL, lnksLL, altsLL, pktsLL; //dynamic data struct for hosts, links, alerts, packets
GLuint objsDraw; //GL compiled objects
MyGLWin GLWin; //2D GUI
+unsigned long long pktsSeen = 0ull;