Skip to content

Instantly share code, notes, and snippets.

View aaronmelton's full-sized avatar

Aaron Melton aaronmelton

View GitHub Profile
#!/bin/bash
#
# author = "Aaron Melton <aaron@aaronmelton.com>"
# date = "2017-08-03"
# description = "Retrieve EC2 Instances"
# name = "get_ec2_instances.sh"
# version = "v0.0.4"
#
# REQUIREMENTS:
# 1. Install AWS Command Line Interface: https://aws.amazon.com/cli/
#!/bin/bash
#
# Uses AWS CLI to query CloudTrail (last 7 days only!) logs for Security
# Group changes.
#
for eventName in ApplySecurityGroupsToLoadBalancer
AuthorizeCacheSecurityGroupIngress AuthorizeClusterSecurityGroupIngress
AuthorizeDBSecurityGroupIngress AuthorizeSecurityGroupEgress
AuthorizeSecurityGroupIngress CreateCacheSecurityGroup
#!/bin/bash
#
# author = "Aaron Melton <aaron@aaronmelton.com>"
# date = "2017-09-15"
# description = "Create AWS Baseline"
# name = "create_aws_baseline.sh"
# version = "v0.0.5"
#
# REQUIREMENTS:
# 1. Install AWS Command Line Interface: https://aws.amazon.com/cli/
#!/bin/bash
#
# author = "Aaron Melton <aaron@aaronmelton.com>"
# date = "2017-08-30"
# description = "Retrieve Security-Groups"
# name = "get_security-groups.sh"
# version = "v0.0.1"
#
# REQUIREMENTS:
# 1. Install AWS Command Line Interface: https://aws.amazon.com/cli/
## 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
#!/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
#!/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
@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
@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
#!/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.