Skip to content

Instantly share code, notes, and snippets.

View tbaschak's full-sized avatar

Theo Baschak tbaschak

View GitHub Profile
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oCiphers=aes256-cbc,aes192-cbc,aes128-cbc,3des-cbc -l username 10.10.10.10
@tbaschak
tbaschak / check-mbix-routeserver-lastupdated.py
Created November 20, 2019 01:04
Python3 Nagios check plugin that will notify if MBIX RS configs get more than a day out of date.
#!/usr/bin/env python3
import sys
from datetime import datetime
import requests
rs = { 'rs1': 'http://lg.mbix.ca/rs1.txt',
'rs2': 'http://lg.mbix.ca/rs2.txt'}
now = datetime.now()
@tbaschak
tbaschak / check-mbix-routeserver-lastupdated.py
Created November 20, 2019 01:03
Python3 Nagios check plugin that will notify if MBIX RS configs get more than a day out of date.
#!/usr/bin/env python3
import sys
from datetime import datetime
import requests
rs = { 'rs1': 'http://lg.mbix.ca/rs1.txt',
'rs2': 'http://lg.mbix.ca/rs2.txt'}
now = datetime.now()
@tbaschak
tbaschak / waitforping.sh
Created September 5, 2019 16:37
waits for a host to come up, then sends a notification
#!/bin/bash
IP="1.1.1.1"
while [ "$RETURNCODE" != "0" ]; do
ping -c 1 $IP &> /dev/null
RETURNCODE=$? # ; echo $?
sleep 1
done
echo "Host $IP is up" | slackcat
@tbaschak
tbaschak / gen_mac.py
Created October 26, 2018 22:03
generates a mac address in the mikrotik bridge range
#!/usr/bin/env python
# 00:00:5E:80:00:00 - 00:00:5E:FF:FF:FF
import random
from os.path import expanduser
def rand_mac():
return "%02x:%02x:%02x:%02x:%02x:%02x" % (
0, 0, 94,
@tbaschak
tbaschak / pdnsutil.bash_completion.d
Created November 29, 2017 05:33
my custom fork of pdnsutil.bash_completion.d included in pdns source
# simple & stupid implementation of bash completion for pdnsutil
#
# (C) 2016 Joerg Jungermann
#
# License: GPLv2
#
# put it into /etc/bash_completion.d/
#
# pdnsutil <TAB> - expands to known operations given as $1
# pdnsutil YOUNAMEIT <TAB> - completes to available zones, might be expensive with many (>10000) zones
@tbaschak
tbaschak / netbps.pl
Created March 2, 2017 05:16
Measures BPS coming out of tcpdump. Usage: `tcpdump -l -e -n ether broadcast | ./netbps`. Un-Modified from http://superuser.com/questions/356907/how-to-get-real-time-network-statistics-in-linux-with-kb-mb-bytes-format-and-for Raw
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes;
my $reporting_interval = 5.0; # seconds
my $bytes_this_interval = 0;
my $start_time = [Time::HiRes::gettimeofday()];
STDOUT->autoflush(1);
@tbaschak
tbaschak / netpps.pl
Created March 1, 2017 22:40
Measures PPS coming out of tcpdump. Usage: `tcpdump -l -e -n ether broadcast | ./netpps`. Modified from http://superuser.com/questions/356907/how-to-get-real-time-network-statistics-in-linux-with-kb-mb-bytes-format-and-for
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes;
my $reporting_interval = 5.0; # seconds
my $packets_this_interval = 0;
my $start_time = [Time::HiRes::gettimeofday()];
STDOUT->autoflush(1);
@tbaschak
tbaschak / my_imgurup.sh
Last active January 17, 2017 08:16 — forked from goodevilgenius/my_imgurup.sh
upload images to your imgur account from the command line
#!/bin/bash
# To use, create ~/.myimgurup, and put in your client ID and secret
# E.g.:
# CLIENT_ID=80238f8092
# CLIENT_SECRET=239a482b034c820
#
# Next run `base /path/to/my_imgurup.sh auth` to get your PIN and access token
# Finally, `base /path/to/my_imgurup.sh up /path/to/image.png` to upload an image
@tbaschak
tbaschak / bgplg.h.communities.patch
Created January 8, 2017 07:04
adds show rib community command to openbsd bgplg
--- bgplg.h.orig 2017-01-08 00:54:08.000000000 -0600
+++ bgplg.h 2017-01-08 01:00:11.000000000 -0600
@@ -47,6 +47,8 @@
{ BGPCTL, "show", "ip", "bgp", "peer-as", NULL } }, \
{ "show ip bgp empty-as", 0, 0, NULL, \
{ BGPCTL, "show", "ip", "bgp", "empty-as", NULL } }, \
+ { "show rib community", 1, 1, "&lt;community&gt;", \
+ { BGPCTL, "show", "rib", "community", NULL } }, \
{ "show ip bgp summary", 0, 0, NULL, \
{ BGPCTL, "show", "ip", "bgp", "summary", NULL } }, \