Skip to content

Commit 6dffb3a

Browse files
authored
Update azure_spec.rb
1 parent 99b3b60 commit 6dffb3a

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

spec/lib/msf/core/post/azure_spec.rb

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -543,25 +543,35 @@
543543

544544
describe '' do
545545
[
546-
{ input: "$creds = New-Object System.Management.Automation.PSCredential('example', $password)",
547-
output: ["Line 1 may contain sensitive information. Manual search recommended, keyword hit: System.Management.Automation.PSCredential"]},
548-
{ input: "$password = ConvertTo-SecureString 'example' -AsPlainText -Force",
549-
output: ["Line 1 may contain sensitive information. Manual search recommended, keyword hit: ConvertTo-SecureString"]},
550-
{ input: "Connect-AzAccount -AccessToken $AccessToken -AccountId 11111111-1111-1111-1111-111111111111",
551-
output: ["Line 1 may contain sensitive information. Manual search recommended, keyword hit: Connect-AzAccount"]},
552-
{ input: "$server = New-PSSession -ComputerName 1.1.1.1 -Credential $creds",
553-
output: ["Line 1 may contain sensitive information. Manual search recommended, keyword hit: New-PSSession"]},
554-
{ input: %q|Set-AzVMExtension -ResourceGroupName "example" -ExtensionName "ExecCmd" -VMName "server" -Location "Example" -Publisher Microsoft.Compute -ExtensionType CustomScriptExtension -TypeHandlerVersion 1.8 -SettingString '{"commandToExecute":"powershell net users example example /add /Y; net localgroup administrators example /add"}'|,
555-
output: ["Line 1 may contain sensitive information. Manual search recommended, keyword hit: commandToExecute"]},
556-
{ input: "Invoke-Command -Session $infradminsrv -ScriptBlock{hostname}",
557-
output: ["Line 1 may contain sensitive information. Manual search recommended, keyword hit: -ScriptBlock"]},
546+
{
547+
input: "$creds = New-Object System.Management.Automation.PSCredential('example', $password)",
548+
output: ['Line 1 may contain sensitive information. Manual search recommended, keyword hit: System.Management.Automation.PSCredential']
549+
},
550+
{
551+
input: "$password = ConvertTo-SecureString 'example' -AsPlainText -Force",
552+
output: ['Line 1 may contain sensitive information. Manual search recommended, keyword hit: ConvertTo-SecureString']
553+
},
554+
{
555+
input: 'Connect-AzAccount -AccessToken $AccessToken -AccountId 11111111-1111-1111-1111-111111111111',
556+
output: ['Line 1 may contain sensitive information. Manual search recommended, keyword hit: Connect-AzAccount']
557+
},
558+
{
559+
input: '$server = New-PSSession -ComputerName 1.1.1.1 -Credential $creds',
560+
output: ['Line 1 may contain sensitive information. Manual search recommended, keyword hit: New-PSSession']
561+
},
562+
{
563+
input: %q|Set-AzVMExtension -ResourceGroupName "example" -ExtensionName "ExecCmd" -VMName "server" -Location "Example" -Publisher Microsoft.Compute -ExtensionType CustomScriptExtension -TypeHandlerVersion 1.8 -SettingString '{"commandToExecute":"powershell net users example example /add /Y; net localgroup administrators example /add"}'|,
564+
output: ['Line 1 may contain sensitive information. Manual search recommended, keyword hit: commandToExecute']
565+
},
566+
{
567+
input: 'Invoke-Command -Session $infradminsrv -ScriptBlock{hostname}',
568+
output: ['Line 1 may contain sensitive information. Manual search recommended, keyword hit: -ScriptBlock']
569+
},
558570
].each do |test|
559571
it 'return Array with hits' do
560572
expect(subject.send(:print_consolehost_history, test[:input])).to eq(test[:output])
561573
end
562574
end
563575
end
564576
end
565-
566-
567577
end

0 commit comments

Comments
 (0)