Skip to content

Instantly share code, notes, and snippets.

View jcefoli's full-sized avatar

Joe Cefoli jcefoli

View GitHub Profile
jcefoli / asus-cheatsheet.txt
Last active August 31, 2023 17:15
[Asus Router] Useful SSH Commands
View asus-cheatsheet.txt
# Modify Hosts file (/jffs/configs/hosts.add)
service restart_dnsmasq
# Parse Custom Client List
nvram get custom_clientlist | sed 's/</\n/g; s/>/\t/g' | sed 's/^/custom\t/' | tail '+2' | sed 's/\(^.*\)\(\t.*\)\(\t[0-9A-F][0-9A-F]:.*$\)/\1\3\2/'
# Remove Logged in User restriction
nvram unset login_ip
nvram commit
jcefoli / random-ip-in-cidr.ps1
Last active July 25, 2023 21:33
[pwsh] Generate a random IP address in a given CIDR range
View random-ip-in-cidr.ps1
function Get-RandomIPAddressInCIDR {
param (
# Split the CIDR into network address and subnet mask
$networkAddress, $subnetMaskBits = $CIDR -split '/'
$subnetMaskBits = [int]$subnetMaskBits
if ($subnetMaskBits -eq 32) {
jcefoli / file_datetime.ps1
Created May 10, 2023 15:58
File DateTimeStamp Output
View file_datetime.ps1
$outputFileName = "C:\Temp\File_{0:yyyyMMdd}_{0:HHmmss}.csv" -f (Get-Date)
jcefoli /
Created April 24, 2023 14:06
LolBanner Setup Script (Debian) - Create colorful text banners using the 3d.flf font, figlet and lolcat (wrapped by a bash function called lolcat)
#!/usr/bin/env bash
sudo apt install figlet lolcat --no-install-recommends -y
wget -P ~/.local/share/fonts/
sudo tee ~/.bashrc << 'EOF'
lolbanner ()
figlet -f ~/.local/share/fonts/3d.flf $@ | lolcat
jcefoli / Update-SessionEnvironment.ps1
Created January 27, 2023 19:53
Refresh Path In Powershell Session Using Chocolatey
View Update-SessionEnvironment.ps1
# Use chocolatey to refresh the path
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1"
Update-SessionEnvironment -Full
jcefoli / pwshIntellisense.ps1
Created December 19, 2022 17:05
Powershell Intellisense
View pwshIntellisense.ps1
## ##
# Get Configuration
## Get Intellisense Option
# Command History Path
jcefoli / dns-cluster-permissions.ps1
Last active November 26, 2022 04:59
Windows Cluster / DNS: Assign Full Rights to Cluster, Listener and Computer Objects (Bug workaround)
View dns-cluster-permissions.ps1
# Get a listing of all clusters (CLUS)
$clusters = Get-ADComputer -Filter "Name -like 'CLUS'"
#Set Domain
$DNSServer = (Get-ADDomain).PDCEMulator
#Set DNS Zone
$DNSZone = ""
#Iterate through the list of clusters get dns and add the appropriate full control objects (listener, cluster)
jcefoli / iisHeaders.ps1
Created September 16, 2022 21:40
IIS Header Examples
View iisHeaders.ps1
Import-Module WebAdministration
# Add Custom Header - Server Level
Add-WebConfigurationProperty -PSPath MACHINE/WEBROOT/APPHOST `
-Name . -Filter system.webServer/httpProtocol/customHeaders `
-AtElement @{name = "X-Custom" ; value = 'value' }
#Remove Server: Microsoft-IIS/10.0 Header
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/security/requestFiltering" -name "removeServerHeader" -value "True"
jcefoli / wsl_helper.ps1
Last active January 19, 2023 18:22
Set WSL Version
View wsl_helper.ps1
#Check WSL Version
wsl -l -v
#Set WSL Version to 2
wsl --set-version Ubuntu-22.04 2
jcefoli /
Created January 27, 2022 18:54
Login to Gitlab Runner (to initiate SSH connections and add server to known_hosts)
sudo su -l gitlab-runner -s /bin/bash