Skip to content

Commit 909a353

Browse files
committed
Added optimization options
1 parent a73a7ef commit 909a353

3 files changed

Lines changed: 165 additions & 5 deletions

File tree

Scripts/BitGuesser.ps1

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ function RefreshDrives {
1010
$driveSelectBox.Items.Clear()
1111
$driveSelectBox.Items.AddRange($driveLetters)
1212
}
13+
function OptimizeSettings {
14+
$processAmountSelector.Value = $coreCount*2
15+
$noWaitOption.Checked = $true
16+
$waitOption.Checked = $false
17+
Write-Host "Optimized settings for speed."
18+
}
1319

1420
$global:process = @()
1521
function OnStartButtonClick {
@@ -19,12 +25,26 @@ function OnStartButtonClick {
1925
$driveLetter = $driveSelectBox.Text
2026
$adjustedCoreCount = $processAmountSelector.Value
2127
if ($randomRadio.Checked -eq $true) {
22-
$proc = Start-Process -FilePath pwsh -ArgumentList "-NoProfile -File .\Scripts\BitGuesserProcess.ps1 -driveLetter $driveLetter -saveLocation $saveLocation -coreCount $adjustedCoreCount" -Verb RunAs -WindowStyle Maximized -PassThru
23-
$global:process += $proc
28+
if ($waitOption.Checked -eq $true) {
29+
$proc = Start-Process -FilePath pwsh -ArgumentList "-NoProfile -File .\Scripts\BitGuesserProcess.ps1 -driveLetter $driveLetter -saveLocation $saveLocation -coreCount $adjustedCoreCount" -Verb RunAs -WindowStyle Maximized -PassThru
30+
$global:process += $proc
31+
$infoBox.Text = "Currently running with settings:`nMode: Random Guesses`nConfirming Guesses: True`nParallel Guesses: $($adjustedCoreCount)`nDrive Letter: $($driveLetter)"
32+
} elseif ($noWaitOption.Checked -eq $true) {
33+
$proc = Start-Process -FilePath pwsh -ArgumentList "-NoProfile -File .\Scripts\BitGuesserProcess-NoWait.ps1 -driveLetter $driveLetter -saveLocation $saveLocation -coreCount $adjustedCoreCount" -Verb RunAs -WindowStyle Maximized -PassThru
34+
$global:process += $proc
35+
$infoBox.Text = "Currently running with settings:`nMode: Random Guesses`nConfirming Guesses: False`nParallel Guesses: $($adjustedCoreCount)`nDrive Letter: $($driveLetter)"
36+
}
2437
}
2538
elseif ($orderRadio.Checked -eq $true) {
26-
$proc = Start-Process -FilePath pwsh -ArgumentList "-NoProfile -File .\Scripts\BitGuesserProcess-InOrder.ps1 -driveLetter $driveLetter -saveLocation $saveLocation -coreCount $adjustedCoreCount" -Verb RunAs -WindowStyle Maximized -PassThru
27-
$global:process += $proc
39+
if ($waitOption.Checked -eq $true) {
40+
$proc = Start-Process -FilePath pwsh -ArgumentList "-NoProfile -File .\Scripts\BitGuesserProcess-InOrder.ps1 -driveLetter $driveLetter -saveLocation $saveLocation -coreCount $adjustedCoreCount" -Verb RunAs -WindowStyle Maximized -PassThru
41+
$global:process += $proc
42+
$infoBox.Text = "Currently running with settings:`nMode: Ordered Guesses`nConfirming Guesses: True`nParallel Guesses: $($adjustedCoreCount)`nDrive Letter: $($driveLetter)"
43+
} elseif ($noWaitOption.Checked -eq $true) {
44+
$proc = Start-Process -FilePath pwsh -ArgumentList "-NoProfile -File .\Scripts\BitGuesserProcess-InOrder-NoWait.ps1 -driveLetter $driveLetter -saveLocation $saveLocation -coreCount $adjustedCoreCount" -Verb RunAs -WindowStyle Maximized -PassThru
45+
$global:process += $proc
46+
$infoBox.Text = "Currently running with settings:`nMode: Ordered Guesses`nConfirming Guesses: False`nParallel Guesses: $($adjustedCoreCount)`nDrive Letter: $($driveLetter)"
47+
}
2848
}
2949
$guesserProgressLabel.Text = "Generating keys..."
3050
$startButton.Enabled = $false
@@ -42,6 +62,7 @@ function OnStopButtonClick {
4262
$guesserProgressLabel.Text = ""
4363
$startButton.Enabled = $true
4464
$stopButton.Enabled = $false
65+
$infoBox.Text = ""
4566
}
4667

4768
# Loading external assemblies
@@ -62,8 +83,12 @@ $startButton = New-Object System.Windows.Forms.Button
6283
$stopButton = New-Object System.Windows.Forms.Button
6384
$infoBox = New-Object System.Windows.Forms.TextBox
6485
$modeBox = New-Object System.Windows.Forms.GroupBox
65-
$randomRadio = New-Object System.Windows.Forms.RadioButton
6686
$orderRadio = New-Object System.Windows.Forms.RadioButton
87+
$randomRadio = New-Object System.Windows.Forms.RadioButton
88+
$advancedOptions = New-Object System.Windows.Forms.GroupBox
89+
$waitOption = New-Object System.Windows.Forms.RadioButton
90+
$noWaitOption = New-Object System.Windows.Forms.RadioButton
91+
$optimizeButton = New-Object System.Windows.Forms.Button
6792
#
6893
# guesserProgressBar
6994
#
@@ -199,9 +224,54 @@ $orderRadio.TabIndex = 7
199224
$orderRadio.Text = "Go in Order"
200225
$orderRadio.UseVisualStyleBackColor = $true
201226
#
227+
# advancedOptions
228+
#
229+
$advancedOptions.Controls.Add($noWaitOption)
230+
$advancedOptions.Controls.Add($waitOption)
231+
$advancedOptions.Location = New-Object System.Drawing.Point(158, 67)
232+
$advancedOptions.Name = "advancedOptions"
233+
$advancedOptions.Size = New-Object System.Drawing.Size(133, 74)
234+
$advancedOptions.TabIndex = 8
235+
$advancedOptions.TabStop = $false
236+
$advancedOptions.Text = "Advanced"
237+
#
238+
# waitOption
239+
#
240+
$waitOption.AutoSize = $true
241+
$waitOption.Checked = $true
242+
$waitOption.Location = New-Object System.Drawing.Point(7, 20)
243+
$waitOption.Name = "waitOption"
244+
$waitOption.Size = New-Object System.Drawing.Size(104, 17)
245+
$waitOption.TabIndex = 9
246+
$waitOption.TabStop = $true
247+
$waitOption.Text = "Confirm Guesses"
248+
$waitOption.UseVisualStyleBackColor = $true
249+
#
250+
# noWaitOption
251+
#
252+
$noWaitOption.AutoSize = $true
253+
$noWaitOption.Location = New-Object System.Drawing.Point(7, 44)
254+
$noWaitOption.Name = "noWaitOption"
255+
$noWaitOption.Size = New-Object System.Drawing.Size(88, 17)
256+
$noWaitOption.TabIndex = 10
257+
$noWaitOption.Text = "Don\'t Confirm"
258+
$noWaitOption.UseVisualStyleBackColor = $true
259+
#
260+
# optimizeButton
261+
#
262+
$optimizeButton.Location = New-Object System.Drawing.Point(298, 67)
263+
$optimizeButton.Name = "optimizeButton"
264+
$optimizeButton.Size = New-Object System.Drawing.Size(74, 74)
265+
$optimizeButton.TabIndex = 11
266+
$optimizeButton.Text = "Optimize Settings for Speed"
267+
$optimizeButton.UseVisualStyleBackColor = $true
268+
$optimizeButton.Add_Click({OptimizeSettings})
269+
#
202270
# BitGuesserGUI
203271
#
204272
$BitGuesserGUI.ClientSize = New-Object System.Drawing.Size(384, 261)
273+
$BitGuesserGUI.Controls.Add($optimizeButton)
274+
$BitGuesserGUI.Controls.Add($advancedOptions)
205275
$BitGuesserGUI.Controls.Add($modeBox)
206276
$BitGuesserGUI.Controls.Add($infoBox)
207277
$BitGuesserGUI.Controls.Add($stopButton)
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#Requires -Version 7.0
2+
3+
param (
4+
[Parameter(Mandatory=$true)]
5+
[string]$driveLetter,
6+
[Parameter(Mandatory=$true)]
7+
[string]$saveLocation,
8+
[Parameter(Mandatory=$true)]
9+
[int]$coreCount
10+
)
11+
12+
# Initialize a global variable to store the current key count
13+
if (-not (Get-Variable -Name currentKey -Scope Global -ErrorAction SilentlyContinue)) {
14+
$Global:currentKey = 0
15+
}
16+
17+
function GenerateBitLockerKey {
18+
# Convert the current key count to a string with leading zeros, padded to 48 digits
19+
$keyString = $Global:currentKey.ToString("D48")
20+
21+
# Split the key string into 6 segments of 8 digits each
22+
$keySegments = @()
23+
for ($i = 0; $i -lt 8; $i++) {
24+
$segment = $keyString.Substring($i * 6, 6)
25+
$keySegments += $segment
26+
}
27+
28+
# Combine the segments into a single string separated by hyphens
29+
$mockKey = $keySegments -join '-'
30+
31+
# Increment the current key count
32+
$Global:currentKey++
33+
34+
return $mockKey
35+
}
36+
37+
while ($true) {
38+
$bitKeys = @()
39+
for ($i = 0; $i -lt 10000; $i++) {
40+
$bitKeys += GenerateBitLockerKey
41+
}
42+
$bitKeys | ForEach-Object -Parallel {
43+
$recoveryKey = $_
44+
Start-Process -FilePath "manage-bde" -ArgumentList "-unlock $using:driveLetter -RecoveryPassword $recoveryKey" -WindowStyle Hidden
45+
Write-Host "$recoveryKey" -ForegroundColor Yellow
46+
} -ThrottleLimit $coreCount
47+
}
48+
Read-Host
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#Requires -Version 7.0
2+
3+
param (
4+
[Parameter(Mandatory=$true)]
5+
[string]$driveLetter,
6+
[Parameter(Mandatory=$true)]
7+
[string]$saveLocation,
8+
[Parameter(Mandatory=$true)]
9+
[int]$coreCount
10+
)
11+
12+
# Function to generate a single BitLocker recovery key
13+
function GenerateBitLockerKey {
14+
# Initialize an empty array to store the key segments
15+
$keySegments = @()
16+
17+
# Loop to generate 6 segments of 8 digits each
18+
for ($i = 0; $i -lt 8; $i++) {
19+
# Generate a random 8-digit number
20+
$segment = -join ((0..9) | Get-Random -Count 6)
21+
22+
# Add the segment to the key segments array
23+
$keySegments += $segment
24+
}
25+
26+
# Combine the segments into a single string separated by hyphens
27+
$mockKey = $keySegments -join '-'
28+
return $mockKey
29+
}
30+
31+
while ($true) {
32+
$bitKeys = @()
33+
for ($i = 0; $i -lt 10000; $i++) {
34+
$bitKeys += GenerateBitLockerKey
35+
}
36+
$bitKeys | ForEach-Object -Parallel {
37+
$recoveryKey = $_
38+
Start-Process -FilePath "manage-bde" -ArgumentList "-unlock $using:driveLetter -RecoveryPassword $recoveryKey" -WindowStyle Hidden
39+
Write-Host "$recoveryKey" -ForegroundColor Yellow
40+
} -ThrottleLimit $coreCount
41+
}
42+
Read-Host

0 commit comments

Comments
 (0)