|
543 | 543 |
|
544 | 544 | describe '' do
|
545 | 545 | [
|
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 | + }, |
558 | 570 | ].each do |test|
|
559 | 571 | it 'return Array with hits' do
|
560 | 572 | expect(subject.send(:print_consolehost_history, test[:input])).to eq(test[:output])
|
561 | 573 | end
|
562 | 574 | end
|
563 | 575 | end
|
564 | 576 | end
|
565 |
| - |
566 |
| - |
567 | 577 | end
|
0 commit comments