Add files via upload

This commit is contained in:
Zarcolio
2023-06-02 15:35:18 +02:00
committed by GitHub
parent 1f21bdb370
commit 765e57dd7e
14 changed files with 100884 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0, HelpMessage="Path of the input file.")]
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$InputFile,
[Parameter(Position=1, HelpMessage="Delay in milliseconds.")]
[int]$Delay = 500,
[Parameter(Position=2, HelpMessage="Wait time in milliseconds.")]
[int]$Wait = $null
)
# Determine output folder and file path
if (-not $InputFile.Contains("\") -and -not $InputFile.Contains("/")) {
$InputFile = Join-Path -Path (Get-Location) -ChildPath $InputFile
}
$OutputFolder = Split-Path -Parent $InputFile
if ([string]::IsNullOrWhiteSpace($OutputFolder)) {
Throw "Output folder cannot be determined from input file path."
}
$OutputFile = Join-Path -Path $OutputFolder -ChildPath "Dict_Attack.txt"
Write-Verbose "Output file path: $OutputFile"
# Create new output file or overwrite existing file
New-Item -ItemType File -Path $OutputFile -Force -ErrorAction Stop | Out-Null
Write-Verbose "Output file created successfully: $OutputFile"
# Read input file and convert to ducky script
$EnterKey = [char]13
$Lines = Get-Content $InputFile
foreach ($Line in $Lines) {
if ($Wait) {
$WaitStr = "DELAY $Wait"
}
else {
$WaitStr = "WAIT_FOR_BUTTON_PRESS"
}
$command = "STRING $line`nDELAY $Delay`nENTER`n$WaitStr`n"
Add-Content -Path $OutputFile -Value $Command
}
Write-Verbose "Conversion complete."
+35
View File
@@ -0,0 +1,35 @@
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][string]$InputFile
)
# Check if the input file exists
if (-not (Test-Path $InputFile)) {
Write-Error "The input file does not exist."
exit 1
}
# Read the contents of the input file
$content = Get-Content -Path $InputFile
# Initialize an empty array to hold the updated lines
$updatedContent = @()
foreach($line in $content) {
if($line -match "[~``'^`]"){
$updatedLine = $line.Replace("STRING", "ALTCODE")
$updatedContent += $updatedLine
} else {
$updatedContent += $line
}
}
# Remove lines equal to "STRING" after trimming
$updatedContent = $updatedContent.Trim() -replace "(`n|^)STRING(`n|$)", ""
# Prepare the output file name by adding "-edit" before the file extension
$outputFile = [System.IO.Path]::GetFileNameWithoutExtension($InputFile) + "-edit" + [System.IO.Path]::GetExtension($InputFile)
# Write the updated content to the output file
Set-Content -Path $outputFile -Value $updatedContent
+26
View File
@@ -0,0 +1,26 @@
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][string]$InputFile
)
# Check if the input file exists
if (-not (Test-Path $InputFile)) {
Write-Error "The input file does not exist."
exit 1
}
# Read the contents of the input file
$content = Get-Content -Path $InputFile
# Replace the specified characters in the content
$updatedContent = $content -replace "([~`'""^])", "$('${1}' * 2)`nBACKSPACE`nSTRING "
# Remove lines equal to "STRING" after trimming
$updatedContent = $updatedContent.Trim() -replace "(`n|^)STRING(`n|$)", ""
# Prepare the output file name by adding "-edit" before the file extension
$outputFile = [System.IO.Path]::GetFileNameWithoutExtension($InputFile) + "-edit" + [System.IO.Path]::GetExtension($InputFile)
# Write the updated content to the output file
Set-Content -Path $outputFile -Value $updatedContent
+66
View File
@@ -0,0 +1,66 @@
# Define the list of "very easy" numbers
$veryEasyNumbers = @(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) | ForEach-Object {
$_.ToString() * 4 # Four identical digits
}
$veryEasyNumbers += "1234" # The sequence "1234"
# Define the list of "easy" numbers consisting of adjacent duos
$adjacentEasyNumbers = @(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) | ForEach-Object {
"{0}{0}{1}{1}" -f $_, (($_ + 1) % 10) # Two pairs of digits
}
# Define the list of "easy" numbers consisting of all combinations of 2 duos
$easyNumbers = @(0..9) | ForEach-Object {
$firstDuo = "{0}{0}" -f $_
@(0..9) | ForEach-Object {
$secondDuo = "{0}{0}" -f $_
$number = "{0}{1}{2}{3}" -f $firstDuo[0], $firstDuo[1], $secondDuo[0], $secondDuo[1]
if ($veryEasyNumbers + $adjacentEasyNumbers -notcontains $number) {
$number
}
}
}
# Define the list of year numbers
$YearNumbers = @()
# Loop through all years from 1901 to the current year
for ($year = 1901; $year -le (Get-Date).Year; $year++) {
# Add the year to the array
$YearNumbers += $year
}
# Define the list of "easy" numbers consisting of all combinations under 100, twice
$doubleUnder100 = @(0..99) | ForEach-Object {
"{0:D2}{0:D2}" -f $_
}
# Generate all combinations from 0000 to 9999
$combinations = 0..9999 | ForEach-Object {
"{0:D4}" -f $_
}
# Randomize the order of the non-easy numbers
$nonEasyNumbers = $combinations | Where-Object {
$veryEasyNumbers + $adjacentEasyNumbers + $easyNumbers -notcontains $_
}
$randomizedNonEasyNumbers = $nonEasyNumbers | Get-Random -Count $nonEasyNumbers.Count
# Combine the easy, double under 100, and non-easy numbers and write to a file
$allNumbers = $veryEasyNumbers + $adjacentEasyNumbers + $YearNumbers + $easyNumbers + $doubleUnder100
$randomizedNumbers = @()
foreach ($number in $allNumbers) {
if ($randomizedNumbers -notcontains $number) {
$randomizedNumbers += $number
}
}
$randomizedNonEasyNumbers | ForEach-Object {
if ($randomizedNumbers -notcontains $_) {
$randomizedNumbers += $_
}
}
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$filePath = Join-Path -Path $scriptDir -ChildPath "pin_codes.txt"
$randomizedNumbers | Out-File -FilePath $filePath