From 8462cb449ea415b4960c2970cf011a756eea6ee1 Mon Sep 17 00:00:00 2001 From: Zarcolio Date: Sat, 9 Sep 2023 20:46:20 +0200 Subject: [PATCH] Added 3plus1 --- .../Offensive/Generate-PinCodes.ps1 | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/BadUSB/Ducky Script Powershell/Offensive/Generate-PinCodes.ps1 b/BadUSB/Ducky Script Powershell/Offensive/Generate-PinCodes.ps1 index 085bdfc..22f38e3 100644 --- a/BadUSB/Ducky Script Powershell/Offensive/Generate-PinCodes.ps1 +++ b/BadUSB/Ducky Script Powershell/Offensive/Generate-PinCodes.ps1 @@ -15,7 +15,7 @@ [CmdletBinding()] param ( [switch]$UseMMDD, - [string]$PinOrder = "same,seqential,square,seqentialsamepairs,samepairs,years,1000,palindromes,pairs,DDMM,MMDD", # Default order + [string]$PinOrder = "same,seqential,square,seqentialsamepairs,samepairs,years,1000,palindromes,pairs,DDMM,MMDD,3plus1", # Default order [string]$PostPinText = "", # Custom text to append after each pin [string]$OutputFile = "4n_pin_codes.txt" # Default output file name ) @@ -116,7 +116,6 @@ $numericKeypad = @( @(7, 8, 9) ) -# Generate PIN codes $square = @() for ($row = 0; $row -lt 2; $row++) { for ($col = 0; $col -lt 2; $col++) { @@ -126,6 +125,35 @@ for ($row = 0; $row -lt 2; $row++) { } } + +# Define the range of unique numbers (0-9) +$uniqueNumbers = 0..9 +$3plus1 = @() # Initialize an empty array to store the PINs + +# Loop through each unique number +foreach ($uniqueNumber in $uniqueNumbers) { + # Loop through each possible PIN pattern (e.g., 1234, 2345, etc.) + for ($i = 0; $i -le 9; $i++) { + # Skip the iteration if $i is the same as $uniqueNumber + if ($i -eq $uniqueNumber) { + continue + } + + # Generate the PIN by alternating between $uniqueNumber and $i + $pin = "$uniqueNumber$i$i$i" + + # add it to the list + $3plus1 += $pin + } +} + +# Loop through the PINs again to generate and add the reversed PINs at the end +foreach ($pin in $3plus1) { + # Generate the reversed PIN and add it to the list + $reversedPin = $pin[3]+$pin[2]+$pin[1]+$pin[0] + $3plus1 += $reversedPin +} + # Create a hashtable for easy lookup $pinCategories = @{ "same" = $SameDigitsNumbers @@ -139,6 +167,7 @@ $pinCategories = @{ "MMDD" = $datesmmdd "pairs" = $doubleUnder100 "square" = $square + "3plus1" = $3plus1 } # Combine numbers based on the order specified in $PinOrder @@ -154,6 +183,7 @@ $combinations = 0..9999 | ForEach-Object { "{0:D4}" -f $_ } + # Randomize the order of the non-easy numbers $nonEasyNumbers = $combinations | Where-Object { $allNumbers -notcontains $_