From 38c5b2f96b8b21d1780ff41d2bfdf84ab9a13c8a Mon Sep 17 00:00:00 2001 From: Audrey Aaliyah Jensen Date: Fri, 25 Aug 2023 11:17:39 -0500 Subject: [PATCH] lists passwords to console --- Sandbox Scripts/prepare.ps1 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Sandbox Scripts/prepare.ps1 b/Sandbox Scripts/prepare.ps1 index 22fa869..1ce036b 100644 --- a/Sandbox Scripts/prepare.ps1 +++ b/Sandbox Scripts/prepare.ps1 @@ -1,10 +1,17 @@ -# Copy Extract.py and *.zip to the desktop. # Regex the password from the zip's filename. Copy to var # Open 7zip, extract to desktop, input password. # take all *.eml and make .mht copies. +#Copy items to desktop Copy-Item './extract.py' '..'; - Get-ChildItem | Where-Object { $_.name -match '\.zip'} | ForEach-Object {Write-Output $_.name; Copy-Item -Path $_.name -Destination '..' } +#Capture zip password from filename +$pwPattern = [regex] "[A-z 0-9 \-]{1,251}\((?[A-z0-9]{1,251})\)\.zip"; + +$files = Get-ChildItem; +$passwords = [Regex]::Matches($files, $pwPattern); +Write-Output $passwords.groups.Value[1] +Get-ChildItem | Where-Object { $_.name -match $pwPattern} | ForEach-Object {Write-Output $_.group } + Write-Output Done; \ No newline at end of file