Skip to content

Commit

Permalink
Update AzureAegis.ps1
Browse files Browse the repository at this point in the history
Changing default pattern provided
  • Loading branch information
alvinlazz authored Aug 30, 2024
1 parent ee61d72 commit 7ece319
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions AzureAegis.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Define the function to display the Help message
function Show-Help {
Write-Host "==========================" -ForegroundColor Cyan
Write-Host " Welcome to AzureVault!" -ForegroundColor Green
Write-Host " Welcome to AzureAegis!" -ForegroundColor Green
Write-Host "==========================" -ForegroundColor Cyan
Write-Host " Version : 1.0" -ForegroundColor White
Write-Host ""
Expand All @@ -21,8 +21,6 @@ function Show-Help {
Write-Host "- **Keep script updated** to guard against bugs/vulnerabilities." -ForegroundColor Yellow
Write-Host "- **Report any suspicious/bug activity** immediately." -ForegroundColor Yellow
Write-Host ""
Write-Host "For detailed documentation, visit: https://confluence.newfold.com/display/EMC/Get+Azure+Key+Vault+Secrets+in+Windows+Terminal" -ForegroundColor Blue
Write-Host ""
Write-Host "Happy exploring!`n" -ForegroundColor Green
}

Expand Down Expand Up @@ -89,12 +87,12 @@ function Get-SecretWithProgress {
function keyz {
if (Test-Path $filePath) {
$KeyVaults = Get-Content -Path $filePath
$KeyVaultsx = $KeyVaults | findstr /i "ops email database BMC"
$KeyVaultsx = $KeyVaults | findstr /i "PATTERN" #<<<<<<< CHANGE HERE IN CODE WITH PATTERN
if ($KeyVaults) {
function Print-Option {
param([string[]]$opts)
cls
Write-Host "`n Welcome To AzureVault, " -NoNewline -ForegroundColor Green
Write-Host "`n Welcome To AzureAegis, " -NoNewline -ForegroundColor Green
Write-Host "$currentUsername !" -ForegroundColor Cyan
Write-Host "`n ===================== `n" -ForegroundColor DarkMagenta
for ($i = 0; $i -lt $opts.Length; $i++) {
Expand Down Expand Up @@ -165,8 +163,8 @@ function keyz {
} else {
cls
Write-Host "Selected Location:" -NoNewline -ForegroundColor Magenta
Write-Host "$selectedVault" -NoNewline -ForegroundColor Green
Write-Host "|| (Press 'x' and Enter Key to list all SecretName)`n" -ForegroundColor Magenta
Write-Host "$selectedVault" -NoNewline -ForegroundColor Green
Write-Host "|| (Press 'x' and Enter Key to list all SecretName)`n" -ForegroundColor Magenta
$pattern = Read-Host "Enter\Paste secret 'name'"
$ScList = Get-content "C:\Users\$currentUsername\KeySecrets.txt" | findstr $pattern
if ($pattern -match 'x') {
Expand Down Expand Up @@ -228,15 +226,15 @@ function keyz {
$selectedOption = Read-Option -opts $KeyVaultsx
Search-Option -opts $selectedOption
} else {
$uniqueValue = Get-AzKeyVault | findstr /r "^Vault" | Select-String -Pattern '\b\w*kv-\w*-\w*-*\w*\b' -AllMatches
$uniqueValue = Get-AzKeyVault | findstr /r "^Vault" | Select-String -Pattern 'PATTERN' -AllMatches #<<<<<<< CHANGE HERE IN CODE WITH PATTERN
foreach ($match in $uniqueValue.Matches) {
$contentToAdd = "$number $match";
Add-Content -Path "C:\Users\$currentUsername\KeyVaults.txt" -Value $contentToAdd;
$number++
}
$filePath = "C:\Users\$currentUsername\KeyVaults.txt"
$KeyVaults = Get-content $filePath
$KeyVaultsx = $KeyVaults | findstr /i "ops email database BMC"
$KeyVaultsx = $KeyVaults | findstr /i "PATTERN" #<<<<<<< CHANGE HERE IN CODE WITH PATTERN
keyz
}
} else {
Expand Down

0 comments on commit 7ece319

Please sign in to comment.