Skip to content

Instantly share code, notes, and snippets.

@purplemonkeymad
purplemonkeymad / RegExBruteForcer.psm1
Created June 26, 2022 22:15
Basic Regex brute forcer
class RegExExpandedValues {
<# wet with class as it keeps stuff together and I can put a bit of code in it.
I extend to other types might use inheritance at some point. shrug #>
$OriginalString
$ValueList
<# I can't be bothered to fill it out right now, feel free.#>
static [hashtable]$SlashCodes = @{
[char]'d' = 0..9 | ForEach-Object { "$_" }
@purplemonkeymad
purplemonkeymad / IPSubnet
Created March 5, 2020 16:16
Powershell class for subnet calculation.
class IPSubnet {
[ipaddress]$InitialAddress
[ValidateRange(0,128)]
[int]$SubnetLength
# basic constructor
IPSubnet([ipaddress]$InitialAddress,[int]$SubnetLength){
$this.InitialAddress = $InitialAddress
$this.SubnetLength = $SubnetLength
@purplemonkeymad
purplemonkeymad / gist:7f669507e22397160915f6e3a729bc05
Created November 11, 2019 11:35
Text file compression cmdlets
function ConvertTo-DeflateBase64String{
[cmdletbinding(DefaultParameterSetName="String")]
Param(
[Parameter(ParameterSetName="String",Mandatory=$true,ValueFromPipeline=$true,Position=1)][string]$String,
[Parameter(ParameterSetName="Byte",Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=2)]
[Byte[]]$Bytes
)
process{
$ms = New-Object System.IO.MemoryStream
$cwr = New-Object System.IO.Compression.DeflateStream($ms,[System.IO.Compression.CompressionMode]::Compress)
@purplemonkeymad
purplemonkeymad / Draw-Menu.ps1
Created April 8, 2019 17:18
Arrow key menu.
function Draw-Menu {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[pscustomobject]$menuState
)
begin {
}