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 / 98-vmware-modconfig.install.sh
Last active Jul 28, 2021
Wrapper for vmware-modconfig to sign the modules for secure boot
View 98-vmware-modconfig.install.sh
#!/bin/bash
# Hook to sign VMware kernel modules after kernel install
# Place at: /etc/kernel/install.d/98-vmware-modconfig.install
COMMAND="${1:-add}"
KERNEL_VER="${2:-$(uname -r)}"
SIGN_CMD="/lib/modules/$KERNEL_VER/build/scripts/sign-file"
SBSIGN_KEY='/etc/efikeys/db.key'
SBSIGN_CRT='/etc/efikeys/db.crt'
@AfroThundr3007730
AfroThundr3007730 / add-dod-certs.sh
Last active Jul 28, 2021
Import DoD root certificates into linux CA store
View add-dod-certs.sh
#!/bin/bash
# Import DoD root certificates into linux CA store
main() {
# Location of bundle from DISA site
url='https://public.cyber.mil/pki-pke/pkipke-document-library/'
bundle=$(curl -s $url | awk -F '"' 'tolower($2) ~ /dod.zip/ {print $2}')
#bundle=https://dl.dod.cyber.mil/wp-content/uploads/pki-pke/zip/certificates_pkcs7_v5-6_dod.zip
# Set cert directory and update command based on OS
@AfroThundr3007730
AfroThundr3007730 / socks-create.sh
Created Jun 23, 2019
Create an on-demand SSH-based SOCKS5 proxy via systemd socket activation
View socks-create.sh
#!/bin/bash
# These steps will allow the setup of an on-demand SSH proxy
# Three unit files will be created to serve this purpose:
# ssh-socks-helper.socket - The listening socket providing activation
# ssh-socks-helper.service - A systemd proxy to pass the socket fd
# ssh-socks.service - The actual SSH service providing the tunnel
cat <<'EOF' > ~/.config/systemd/user/ssh-socks-helper.socket
[Unit]
Description=Proxy Helper Socket for Bastion SOCKS5 Proxy
@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 / sourceable.ps1
Last active Jun 14, 2021
Making executable scripts source-friendly
View sourceable.ps1
# This file can be sourced and also executed directly
# Definitions and declarations go here
function main () {
# All action happens here
return 0
}
# Only run if not sourced
@AfroThundr3007730
AfroThundr3007730 / Logoff-InactiveUsers.ps1
Last active Apr 19, 2021
Logoff inactive user sessions after 2 days
View Logoff-InactiveUsers.ps1
# Version 1
$idleDays = 2
$users = (((query user) -replace '^>', '') -replace '\s{2,}', ',').Trim() |
ForEach-Object {
if ($_.Split(',').Count -eq 5) {
Write-Output ($_ -replace '(^[^,]+)', '$1,')
}
else {
Write-Output $_
View cve-2006-2184.py
#!/usr/bin/env python
import sys
import struct
import socket as so
print '#######################################################################'
print '# CVE-2006-2184 - Allied Telesyn TFTP v1.9 Long Filename Overflow #'
print '# This is a modified version of Re4son\'s code #'
print '# (https://github.com/Re4son/AT-TFTP_Long_Filename) #'
@AfroThundr3007730
AfroThundr3007730 / vm-deploy-progress.ps1
Last active Apr 2, 2021
Get completion percentage for batch VM clone tasks
View vm-deploy-progress.ps1
# 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 / genpw.ps1
Last active Mar 30, 2021
bash and powershell functions to generate strong passwords
View genpw.ps1
function genpw() {
Param(
[int]$l = 20,
[int]$c = 5
)
Write-Host ("Generating {0} passwords of length {1}`n" -f $c, $l)
1..$c | % {
(1..$l | % {
@AfroThundr3007730
AfroThundr3007730 / AutoConnect-VIServer.ps1
Last active Mar 30, 2021
Automate PowerCLI connection to vCenter
View AutoConnect-VIServer.ps1
# Automated PowerCLI connections to vCenter Server
# Script will use stored PSCredentials if user is unprivileged
function AutoConnect-VIServer () {
Param(
[string]$server = 'vcenter'
)
# Check if user is in a group with vCenter permissions
if ([System.Security.Principal.WindowsIdentity]::GetCurrent().Groups.Translate(
[System.Security.Principal.NTAccount]) -contains 'DOMAIN\vCenter_Admins') {