Skip to content

Instantly share code, notes, and snippets.

View aaronmelton's full-sized avatar

Aaron Melton aaronmelton

View GitHub Profile
@aaronmelton
aaronmelton / RaspberryPi.bash_profile
Last active December 20, 2015 08:18
Raspberry Pi .bash_profile that displays Uptime, Memory Usage, CPU Load Averages, # Running Processes, IP Address and Free Disk Space
###############################################################################
# Original file here: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=23440 #
# #
# I have modified this .bash_profile to suit my own purposes. Feel free to #
# edit it to meet your own requirements. #
###############################################################################
#
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
@aaronmelton
aaronmelton / Raspbian4HamRadio.sh
Created July 28, 2013 16:56
VERY basic script I wrote to automate setup of a Raspbian Desktop for Ham Radio operations.
#!/bin/bash
#
# Raspbian4HamRadio.sh 1.01
# Aaron Melton <aaron(at)aaronmelton(dot)com> de KK4LOV
#
#
#
# Before we get busy customizing our box, let's make sure all the base packages
# are up-to-date.
# Update the repository cache to make sure we get the latest package versions
@aaronmelton
aaronmelton / keybase.md
Created December 20, 2014 15:34
### Keybase proof

Keybase proof

I hereby claim:

  • I am aaronmelton on github.
  • I am aaronmelton (https://keybase.io/aaronmelton) on keybase.
  • I have a public key whose fingerprint is D4B7 A647 5215 4E27 F74F 2A7D FD5F EBFA 4D6F 7ED6

To claim this, I am signing this object:

@aaronmelton
aaronmelton / downloadWHOIS.sh
Created February 16, 2015 15:20
This script uses native whois command to return the WHOIS information of the IP Addresses provided.
#!/usr/bin/sh
#
# downloadWHOIS.sh
#
# This script uses native whois command to return the WHOIS information
# of the IP Addresses provided.
#
# USAGE:
# $ ./downloadWHOIS.sh 1.2.3.4
# $ ./downloadWHOIS.sh 1.2.3.4 1.2.3.5 1.2.3.6 etc.
#!/usr/bin/sh
#
# downloadOTX.sh
#
# This script uses AlienVault's Open Threat Exchange (OTX) to download a PDF
# containing the IP reputation of the IP Addresses provided.
#
# USAGE:
# $ ./downloadOTX.sh 1.2.3.4
# $ ./downloadOTX.sh 1.2.3.4 1.2.3.5 1.2.3.6 etc.
@aaronmelton
aaronmelton / ping_diffs.sh
Last active December 30, 2015 20:37
Ping targets and send email w/ attachment if results different than previous execution.
#!/bin/sh
TARGETS="192.168.1.0/24"
OPTIONS="-v -sn -n"
DATE=`date +%F`
cd /var/log/nmap
nmap $OPTIONS $TARGETS -oA ping_$DATE > /dev/null
if [ -e ping-prev.xml ]; then
ndiff ping-prev.xml ping_$DATE.xml > pingdiff_$DATE.txt
if [ "$?" -eq "1" ]; then
echo "See attachment for NMAP differences." | mutt -s "NMAP Differences Discovered" -a pingdiff_$DATE.txt -- user@email.com
@aaronmelton
aaronmelton / nmap_diffs.sh
Last active December 30, 2015 20:37
Port scan targets and send email w/ attachment if results different than previous execution.
#!/bin/sh
TARGETS="192.168.1.0/24"
FILENAME="nmap_192.168.1.0"
OPTIONS="-v -n --open -sS -sU -F --scan-delay 1s"
DATE=`date +%F`
cd /var/log/nmap
nmap $OPTIONS $TARGETS -oA $FILENAME\_$DATE > /dev/null
if [ -e $FILENAME\-prev.xml ]; then
ndiff $FILENAME\-prev.xml $FILENAME\_$DATE.xml > $FILENAME\-diff_$DATE.txt
if [ "$?" -eq "1" ]; then
#!/bin/bash
#
(echo "DISK FREE:"; df -h; echo -e \\n; echo "DISK USAGE:"; du -h -d1 /var/ftp) | mail -s "Disk Usage Report" user@email.com
#!/bin/bash
TARGET="192.168.1.1"
ping -c3 $TARGET > /dev/null
if [ "$?" -eq "1" ]; then
echo | mail -s "HOSTNAME Unreachable at $(date)" user@email.com
fi
## Script: Router Update Script
## Author: aaron@aaronmelton.com
## Version: 1.2
## Created: 2012-03-12
## Updated: 2012-03-13
## Description: This script provides the ability to securely copy a Cisco IOS
## file to a Cisco router and then instruct the router to copy
## the contents of the file into the running-config.
#!/usr/bin/expect