This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Force TLS 1.2 | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
# Basic Auth Credentials | |
$user = 'changeme' | |
$pass = 'insecure-password' | |
# Handle Basic Auth (Hacky in Powershell) | |
$pair = "$($user):$($pass)" | |
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
This script will prevent GPOs from enabling the screensaver, shutting off your screen, or force-locking your workstation | |
It works by sending an F15 keystroke every minute (only if there have been no keystrokes or mouse movement for 30 seconds) | |
Be green - if you want to use this, power off your monitor(s)! | |
#> | |
Add-Type @' | |
using System; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-RandomIPAddressInCIDR { | |
param ( | |
[string]$CIDR | |
) | |
# Split the CIDR into network address and subnet mask | |
$networkAddress, $subnetMaskBits = $CIDR -split '/' | |
$subnetMaskBits = [int]$subnetMaskBits | |
if ($subnetMaskBits -eq 32) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
REM This snippet will take an input string with spaces and replace them with %20 | |
SET /p input=Input string: | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
SET input=!input: =%%20! | |
ECHO. | |
ECHO %input% | |
PAUSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$outputFileName = "C:\Temp\File_{0:yyyyMMdd}_{0:HHmmss}.csv" -f (Get-Date) | |
#C:/Temp/File_20230510_115723.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Keeps you productive by spoofing activity to prevent GPO idle timeouts, RDP disconnects, sleep, etc. | |
.Description | |
This script creates a Scheduled Task that runs at login which uses Kernel SetThreadExecutionState to prevent GPOs | |
from disconnecting your RDP session. Will also prevent sleeping/screensavers/display timeouts | |
See the example below for a one liner that will download and execute this script directly from GitHub! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$host.ui.RawUI.WindowTitle = "Idle Keepalive" | |
$dotNetCode = @' | |
[DllImport("kernel32.dll", CharSet = CharSet.Auto,SetLastError = true)] | |
public static extern void SetThreadExecutionState(uint esFlags); | |
'@ | |
$ste = Add-Type -memberDefinition $dotNetCode -name System -namespace Win32 -passThru | |
$ES_CONTINUOUS = [uint32]"0x80000000" #Requests that the other EXECUTION_STATE flags set remain in effect until SetThreadExecutionState is called again with the ES_CONTINUOUS flag set and one of the other EXECUTION_STATE flags cleared. | |
$ES_AWAYMODE_REQUIRED = [uint32]"0x00000040" #Requests Away Mode to be enabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use chocolatey to refresh the path | |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" | |
Update-SessionEnvironment -Full |