Skip to content

Instantly share code, notes, and snippets.

Avatar
🔧
Hacking all the things...

Eddie James Carswell II AfroThundr3007730

🔧
Hacking all the things...
View GitHub Profile
@AfroThundr3007730
AfroThundr3007730 / get_stream_stats.sh
Last active Sep 19, 2022
Parses chatterino logs to get stream income from bits and subscriptions
View get_stream_stats.sh
#!/bin/bash
# Parses chatterino logs to get stream income from bits and subscriptions
get_stream_stats() {
local f=${1##*/}; f=${f%.*}
printf 'Channel: %s Date: %s\n' "${f%%-*}" "${f#*-}"
awk '/[Cc]heer/ {
for (i=1;i<=NF;i++) {
if ($i~/^[Cc]heer$/) {
j=i+1
token=$i$j
@AfroThundr3007730
AfroThundr3007730 / Resolve-DnsRecordAllDCs.ps1
Last active Sep 19, 2022
Resolves a DNS record on all active DCs in a domain
View Resolve-DnsRecordAllDCs.ps1
function Resolve-DnsRecordAllDCs {
<# .SYNOPSIS
Resolves a DNS record on all active DCs in a domain #>
[Alias('nslookup_all')]
Param(
# Name to resolve
[Parameter(Mandatory, ValueFromPipeline)]
[string]$Name,
# Type of record
[Parameter(ValueFromPipelineByPropertyName)]
@AfroThundr3007730
AfroThundr3007730 / split_music_compilation.sh
Created Sep 14, 2022
Splits an audio file based on timestamps in a cuesheet
View split_music_compilation.sh
#!/bin/bash
# Splits an audio file based on timestamps in a cuesheet
split_music_compilation() {
[[ -f $1 ]] || { echo 'Audio file not found:' "$1"; return 1; }
[[ -f $2 ]] || { echo 'Cuesheet file not found:' "$2"; return 1; }
local source=$1 cuesheet=$2 count=0 pstamp='0:00' stamp title album
while read -r line; do
[[ $line =~ ([0-9]+:[0-9]+:[0-9]+).-.(.*).\[(.*)\] ]] && {
stamp=${BASH_REMATCH[1]}
title=${BASH_REMATCH[2]}
@AfroThundr3007730
AfroThundr3007730 / mc_generate_map.sh
Last active Sep 6, 2022
Generates a coordinate grid to move a player to generate a Minecraft map
View mc_generate_map.sh
#!/bin/bash
# Generates a coordinate grid to move a player to generate a Minecraft map
# Quick n dirty original version:
#for x in $(seq -2500 100 2500); do
# for z in $(seq -2500 100 2500); do
# echo "Cords: $x $z"
# screen -S mc -X stuff "/tp $player $x 128 $z\n"
# sleep 5
# done
@AfroThundr3007730
AfroThundr3007730 / Get-SMSManagementPoint.ps1
Last active Sep 19, 2022
Finds SCCM management point in AD based on site code
View Get-SMSManagementPoint.ps1
function Get-SMSManagementPoint {
<# .SYNOPSIS
Finds SCCM management point based on site code #>
Param(
# The site code to search
[Parameter(Mandatory)]
[string]$SiteCode
)
return [adsisearcher]::new(
@AfroThundr3007730
AfroThundr3007730 / wg-auto.sh
Created Jun 17, 2022
Wrapper and service to start and stop wireguard interfaces
View wg-auto.sh
#!/bin/bash
# Wrapper to start and stop wireguard interfaces
wg_start() {
echo "Setting up Wireguard interface $2..."
ipv4=$(awk '$1 ~ /Address/ && $3 ~ /\./ {print $3}' /etc/wireguard/"${2}".conf)
ipv6=$(awk '$1 ~ /Address/ && $3 ~ /:/ {print $3}' /etc/wireguard/"${2}".conf)
ip link add dev "$2" type wireguard
[[ -n $ipv4 ]] && ip addr add dev "$2" "$ipv4"
[[ -n $ipv6 ]] && ip addr add dev "$2" "$ipv6"
@AfroThundr3007730
AfroThundr3007730 / Get-StringPermutations.ps1
Last active Sep 23, 2022
Gets recursive unique combinations of characters in a string
View Get-StringPermutations.ps1
function Get-StringPermutations {
<# .SYNOPSIS
Calculates the permutations of an input string #>
[Alias('permutate')]
Param(
# String to calculate permutations from
[Parameter(Mandatory)]
[String]$String,
# Return only unique permutations
[Parameter()]
@AfroThundr3007730
AfroThundr3007730 / Get-SSLServerCertificate.ps1
Last active Sep 19, 2022
Powershell function similar to openssl -s_client to retrieve a certificate
View Get-SSLServerCertificate.ps1
function Get-SSLServerCertificate {
<# .SYNOPSIS
Retrieves the X509 certificate by connecting to a SSL enabled server #>
[Alias('s_client')]
Param(
# Hostname or IP address to connect to
[Parameter(Mandatory)]
[String]$Hostname,
# Port to connect to
[Parameter()]
@AfroThundr3007730
AfroThundr3007730 / unicode_btoa_atob.js
Created Jul 4, 2021
Unicode string to base64 (wrapper for btoa and atob)
View unicode_btoa_atob.js
"use strict"
const u_btoa = str => btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_match, pl) => String.fromCharCode('0x' + pl)))
const u_atob = str => decodeURIComponent(atob(str).split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join(''))
@AfroThundr3007730
AfroThundr3007730 / SignScript.ps1
Last active Sep 19, 2022
Wrapper to Set-AuthenticodeSignature
View SignScript.ps1
function Set-ScriptSignature {
<# .SYNOPSIS
Wrapper function to sign and timestamp a script file #>
[Alias('SignScript')]
Param(
# The script file to sign
[Parameter(Mandatory)]
[String]$ScriptFile
)