diff options
author | Harmj0y <will@harmj0y.net> | 2016-03-11 17:45:46 -0500 |
---|---|---|
committer | Harmj0y <will@harmj0y.net> | 2016-03-11 17:45:46 -0500 |
commit | 6a17f759ab1fe4c3cfdbfc33e362c362b4d47da1 (patch) | |
tree | 7d46904a8b4d2675a00329840da16a8c446812e4 /Tests | |
parent | dee094a993642894d4542c6bc8c11864863e4536 (diff) | |
download | PowerSploit-6a17f759ab1fe4c3cfdbfc33e362c362b4d47da1.tar.gz PowerSploit-6a17f759ab1fe4c3cfdbfc33e362c362b4d47da1.zip |
Added Get-System to Privesc/
Added Pester tests for Get-System
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Privesc.tests.ps1 | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Tests/Privesc.tests.ps1 b/Tests/Privesc.tests.ps1 index 296829f..999d712 100644 --- a/Tests/Privesc.tests.ps1 +++ b/Tests/Privesc.tests.ps1 @@ -787,3 +787,45 @@ Describe 'Get-SiteListPassword' { } } } + + +Describe 'Get-System' { + + if(-not $(Test-IsAdmin)) { + Throw "'Get-System' Pester test needs local administrator privileges." + } + + AfterEach { + Get-System -RevToSelf + } + + It 'Should not throw with default parameters and should elevate to SYSTEM.' { + { Get-System } | Should Not Throw + "$([Environment]::UserName)" | Should Be 'SYSTEM' + } + + It 'Named pipe impersonation should accept an alternate service and pipe name.' { + { Get-System -Technique NamedPipe -ServiceName 'testing123' -PipeName 'testpipe' } | Should Not Throw + "$([Environment]::UserName)" | Should Be 'SYSTEM' + } + + It 'Should elevate to SYSTEM using token impersonation.' { + { Get-System -Technique Token } | Should Not Throw + "$([Environment]::UserName)" | Should Be 'SYSTEM' + } + + It '-WhoAmI should display the current user.' { + { Get-System -Technique Token } | Should Not Throw + { Get-System -WhoAmI } | Should Match 'SYSTEM' + } + + It 'RevToSelf should revert privileges.' { + { Get-System -Technique Token } | Should Not Throw + { Get-System -RevToSelf } | Should Not Throw + "$([Environment]::UserName)" | Should Not Match 'SYSTEM' + } + + It 'Token impersonation should throw with incompatible parameters.' { + { Get-System -Technique Token -WhoAmI } | Should Throw + } +} |