Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
jfeilbach / check_tls.sh
Last active March 14, 2023 23:51
Check for TLS cert expiration
#!/bin/bash
SECONDS=0
RED='\033[0;31m'
WHITE='\033[1;37m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
list=''
@jfeilbach
jfeilbach / tomcat.service
Last active March 14, 2023 23:51
WorldServer systemd tomcat.service
[Unit]
Description=Tomcat 8.5 servlet container
After=network.target
[Service]
Type=forking
User=ws
Group=ws
@jfeilbach
jfeilbach / getinfo.sh
Last active March 14, 2023 23:50
getinfo.sh
#!/bin/sh
clear
sExternalMACALService="http://dns.kittell.net/macaltext.php?address="
# List all Network ports
NetworkPorts=$(ifconfig -uv | grep '^[a-z0-9]' | awk -F : '{print $1}')
#echo $NetworkPorts
# Function to convert IP Subnet Mask to CIDR
@jfeilbach
jfeilbach / netserv.sh
Last active March 14, 2023 23:50
netserv.sh
#!/bin/bash
services=$(networksetup -listnetworkserviceorder | grep 'Hardware Port')
while read line; do
sname=$(echo $line | awk -F "(, )|(: )|[)]" '{print $2}')
sdev=$(echo $line | awk -F "(, )|(: )|[)]" '{print $4}')
#echo "Current service: $sname, $sdev, $currentservice"
if [ -n "$sdev" ]; then
ifout="$(ifconfig $sdev 2>/dev/null)"
@jfeilbach
jfeilbach / gist:0781b1777c48a1e41bbf31a186e04fb2
Last active March 14, 2023 23:50
Bash script to dump UPnP NAT entries
#!/bin/bash
url=$1
soap_head=’<?xml version=”1.0” encoding=”utf-8”?><s:Envelope s:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/” xmlns:s=”http://schemas. xmlsoap.org/soap/envelope/”><s:Body><u:GetGenericPortMappingEntry xmlns:u=”urn:upnp- org:serviceId:WANIPConnection.1#GetGenericPortMappingEntry”><NewPortMappingIndex>’ soap_tail=’</NewPortMappingIndex></u:GetGenericPortMappingEntry></s:Body></ s:Envelope>’
for i in `seq 1 1000`; do
payload=$soap_head$i$soap_tail
curl -H ‘Content-Type: “text/xml;charset=UTF-8”’ -H ‘SOAPACTION: “urn:schemas-
upnp-org:service:WANIPConnection:1#GetGenericPortMappingEntry”’ --data “$payload” “$url”
echo “” done
@jfeilbach
jfeilbach / gist:22330779ad4120d3f96054eda95bdfc3
Created March 7, 2018 22:57
convert bash seconds to human readable hours minutes seconds
displaytime () {
local T=$SECONDS
local D=$((T/60/60/24))
local H=$((T/60/60%24))
local M=$((T/60%60))
local S=$((T%60))
[[ $D > 0 ]] && printf '%d days ' $D
[[ $H > 0 ]] && printf '%d hours ' $H
[[ $M > 0 ]] && printf '%d minutes ' $M
[[ $D > 0 || $H > 0 || $M > 0 ]] && printf 'and '
@jfeilbach
jfeilbach / get_dod_certs.sh
Created August 15, 2019 16:07
get the DoD certs including root certs. download, verify, install, and revoke
#!/bin/bash
# DoD Root Certificate install 19 July 2019
# to do: add Firefix import
# set cert numbers as variables
# combine fingerprint functions
# check all root CA fingerprints
# compare against CRL
SECONDS='0'
NC='\e[0m'
@jfeilbach
jfeilbach / get_splunk.sh
Created April 8, 2019 20:11
Get splunk universal forwarder download URL
#!/bin/bash
#URL="https://www.splunk.com/en_us/download/splunk-enterprise.html"
URL="https://www.splunk.com/en_us/download/universal-forwarder.html"
OS_REGEX="linux-2\.6-x86_64\.rpm"
#OS_REGEX="Linux-x86_64\.md5"
RESPONSE=`curl -s --connect-timeout 10 --max-time 10 $URL`
LINK=`echo $RESPONSE | egrep -o "data-link=\"https://[^\"]+-${OS_REGEX}\"" | cut -c12- | rev | cut -c2- | rev`
@jfeilbach
jfeilbach / backup.sh
Last active May 21, 2022 16:43
rsync downloads to remote storage
rsync -avhz --stats --progress --exclude='$RECYCLE.BIN' --exclude='$Recycle.Bin' --exclude='.AppleDB' --exclude='.AppleDesktop' --exclude='.AppleDouble' --exclude='.com.apple.timemachine.supported' --exclude='.dbfseventsd' --exclude='.DocumentRevisions-V100*' --exclude='.DS_Store' --exclude='.fseventsd' --exclude='.PKInstallSandboxManager' --exclude='.Spotlight*' --exclude='.SymAV*' --exclude='.symSchedScanLockxz' --exclude='.TemporaryItems' --exclude='.Trash*' --exclude='.vol' --exclude='.VolumeIcon.icns' --exclude='Desktop DB' --exclude='Desktop DF' --exclude='hiberfil.sys' --exclude='lost+found' --exclude='Network Trash Folder' --exclude='pagefile.sys' --exclude='Recycled' --exclude='RECYCLER' --exclude='System Volume Information' --exclude='Temporary Items' --exclude='Thumbs.db' /Volumes/Raid\ 0/Torrent\ Downloads/ /Volumes/vol2/ops_torrents/
--exclude='$RECYCLE.BIN' \
--exclude='$Recycle.Bin' \
--exclude='.AppleDB' \
--exclude='.AppleDesktop' \
--exclude='.AppleDouble' \
--exclude='.com.apple.timemachin
@jfeilbach
jfeilbach / ssl-dh-params.nse
Last active January 8, 2022 17:23
test Diffie-Hellman handshake using nmap
local nmap = require "nmap"
local shortport = require "shortport"
local sslcert = require "sslcert"
local stdnse = require "stdnse"
local string = require "string"
local math = require "math"
local table = require "table"
local tls = require "tls"
local vulns = require "vulns"
local have_ssl, openssl = pcall(require, "openssl")