This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
A=`mktemp` | |
B=`mktemp` | |
hexdump -C "$1" > $A | |
hexdump -C "$2" > $B | |
diff -U 0 --label "$1" --label "$2" $A $B | less | |
rm $A $B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Usage: ./generate_email_robot.py NETWORK | |
# | |
# Setup: | |
# virtualenv env | |
# source env/bin/activate | |
# pip install ipaddr | |
# | |
# Example: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: twistd -ny telnet_auth.py | |
from twisted.conch.telnet import TelnetTransport, AuthenticatingTelnetProtocol | |
from twisted.internet.protocol import ServerFactory | |
from twisted.application.internet import TCPServer | |
from twisted.application.service import Application | |
log = open('creds.log', 'a') | |
class TelnetHoneypot(AuthenticatingTelnetProtocol): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Install HP management tools | |
hosts: hp | |
become: yes | |
tasks: | |
- name: Install pexpect for Ansible expect | |
apt: | |
name: python-pexpect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PREVTABLE=/tmp/routes | |
NEWTABLE=$(mktemp) | |
ip r > "$NEWTABLE" | |
if [ -f "$PREVTABLE" ]; then | |
diff -u "$PREVTABLE" "$NEWTABLE" | |
fi | |
mv "$NEWTABLE" "$PREVTABLE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read line | |
do | |
echo $line | |
if [[ $line == Writing* ]] | |
then | |
while IFS='"' read -ra writingline | |
do | |
filename=${writingline[1]%.*} | |
done <<< $line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from os.path import splitext | |
def db_to_norm(db): | |
return 10**(db/10.) | |
antfilename = sys.argv[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import fileinput | |
print "".join(sorted(fileinput.input(), key=lambda fqdn: fqdn.lower().split('.')[::-1])), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto.ec2.elb | |
def get_elbs_with_no_valid_instances(elb): | |
"""Finds ELBs with zero instances or where all instances are no longer in service.""" | |
for lb in elb.get_all_load_balancers(): | |
instances = lb.get_instance_health() | |
if len(instances) == 0: | |
yield lb | |
continue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
import urllib2 | |
librenms = json.loads( | |
urllib2.urlopen(urllib2.Request( | |
'https://librenms.hamwan.org/api/v0/devices', | |
headers={'X-Auth-Token': ''}, |