Skip to content

Instantly share code, notes, and snippets.

View AfroThundr3007730's full-sized avatar
🔧
Hacking all the things...

Eddie Carswell AfroThundr3007730

🔧
Hacking all the things...
View GitHub Profile
@AfroThundr3007730
AfroThundr3007730 / decrypt_gnupg-sc.sh
Created July 20, 2020 07:38
Modified version of Debian's cryptsetup hook for GnuPG Smartcard unlock
#!/bin/sh
if [ -d "/cryptroot/gnupghome" ]; then
export GNUPGHOME="/cryptroot/gnupghome"
fi
run_gpg() {
/usr/bin/gpg --no-options --trust-model=always "$@"
}
decrypt_gpg () {
@AfroThundr3007730
AfroThundr3007730 / github-next-center-headers.user.css
Last active July 19, 2020 17:16
Restores the padding to center the headers in the repository view.
/* ==UserStyle==
@name Github-Next - Center Header
@namespace github.com/AfroThundr3007730
@version 0.0.20200719
@description Restores the padding to center the headers in the repository view.
@author AfroThundr
@homepageURL https://gist.github.com/AfroThundr3007730/1596ae3898d08f91a42bc4f64e8b4a44
@updateURL https://gist.githubusercontent.com/AfroThundr3007730/1596ae3898d08f91a42bc4f64e8b4a44/raw/github-next-center-headers.user.css
@license CC-BY-SA-4.0
==/UserStyle== */
@AfroThundr3007730
AfroThundr3007730 / Set-UserPrimaryComputer.ps1
Last active March 14, 2021 21:34
Script to set msDS-PrimaryComputer attribute by OU mapping
# Script to enforce Primary Computer attribute by OU mapping
# Used to limit the scope of roaming profiles and folder redirection
Start-Transcript 'C:\ProgramData\primary-computers.log' -Append
Write-Host 'Checking and updating user Primary Computer mappings.'
# Define group mapping array
$groupMappings = @()
# Add members to array
$groupMappings += @{
@AfroThundr3007730
AfroThundr3007730 / pfsense-props.conf
Created June 10, 2020 00:07
Splunk field extractions for pfSense firewall logs (IPv4)
# The first attempt used CSV, but can't break up the first fields
[pfsense-fw-ipv4-tcp]
INDEXED_EXTRACTIONS = csv
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
SHOULD_LINEMERGE = false
category = Network & Security
pulldown_type = 1
FIELD_NAMES = log_metadata,sub_rulenum,anchor,tracker,interface,reason,action,direction,ip_version,ip_tos,ip_ecn,ip_ttl,ip_id,ip_offset,ip_flags,ip_proto_id,ip_proto_text,ip_length,ip_src_addr,ip_dest_addr,ip_src_port,ip_dst_port,ip_data_length,tcp_flags,tcp_seq_num,tcp_ack_num,tcp_window,tcp_urg,tcp_opts
@AfroThundr3007730
AfroThundr3007730 / epo-web-redirect.md
Last active June 3, 2020 17:06
ePO apache config to put the webconsole on 443 (colocated with agent port)

Why do this?

I wanted to redirect the web console to port 443, but the agents use that for communication with ePO. I could change the agent communication port, but I don't want to redeploy all the agents to fix their configurations. Thus, this madness was born.

The configs

You'll need to navigate to the ePO apache server configuration directory:

X:\Program Files (x86)\McAfee\ePolicy Orchestrator\Apache2\conf
@AfroThundr3007730
AfroThundr3007730 / vm-deploy-progress.ps1
Last active March 31, 2024 18:55
Get completion percentage for batch VM clone tasks
# Get completion percentage for batch VM clone tasks
function Get-VMDeployProgress() {
[Alias('deployProgress')]
Param(
[string]$VCUser = $global:DefaultVIServers[0].User.Split('\')[1]
)
do {
$Tasks = Get-Task | Where-Object { $_.Name -match 'clone' `
-and $_.State -match 'running' `
-and $_.ExtensionData.Info.Reason.UserName -match $VCUser }
@AfroThundr3007730
AfroThundr3007730 / gpo-cleanup.ps1
Created April 10, 2020 04:32
Nuking orphaned GPOs in the SYSVOL
# Nuking orphaned GPOs in the SYSVOL
Start-Transcript .\gpo-cleanup.log
$guids = (get-gpo -All).id.guid
$files = (ls .).name
Write-Host 'Registered GPOs:' $guids.count
Write-Host 'GPO Files:' ($files | Select-String '{').count
$extraFiles = @()
@AfroThundr3007730
AfroThundr3007730 / add-dod-certs.sh
Last active May 4, 2025 21:29
Import DoD root certificates into linux CA store
#!/bin/bash
# Imports DoD root certificates into Linux CA store
# Version 0.4.2 updated 20250425 by AfroThundr
# SPDX-License-Identifier: GPL-3.0-or-later
# For issues or updated versions of this script, browse to the following URL:
# https://gist.github.com/AfroThundr3007730/ba99753dda66fc4abaf30fb5c0e5d012
# Dependencies: curl gawk openssl unzip wget
@AfroThundr3007730
AfroThundr3007730 / Rotate-ESXiCreds.ps1
Created March 20, 2020 03:32
Mass change ESXi host passwords to new values
# Mass change ESXi host passwords to new values
# The hashtable should have an entry for every host
# Ensure $host_creds doesn't end up in your history
Connect-VIServer -Server 'YOUR_VCSA' -Credential (Get-Credential)
$host_creds = @{
'ESXi1.lab.local' = 'VALUE_FROM_PW_DB';
'ESXi2.lab.local' = 'VALUE_FROM_PW_DB';
# More as needed...
@AfroThundr3007730
AfroThundr3007730 / ComputerHygiene.ps1
Last active March 14, 2021 21:13
Script to disable inactive computer accounts after a set period and delete disabled accounts after another set period.
Start-Transcript C:\ProgramData\computer-hygiene.log -Append
function accountFilter($accountList) {
# Filter out system principals and exempt accounts
return $accountList | Where-Object {
# Don't process these accounts
$_.DistinguishedName -notmatch "OU=Domain Controllers" -and
$_.DistinguishedName -notmatch "OU=VMWare" -and
$_.DistinguishedName -notmatch "OU=Linux"
} | Sort-Object