aboutsummaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorHarmj0y <will@harmj0y.net>2016-06-23 17:51:17 -0400
committerHarmj0y <will@harmj0y.net>2016-06-23 17:51:17 -0400
commit8dea905998fbebfbcc14bc08cd3dd43a0d671a97 (patch)
treebb7dbf03daf163c1316cd57882178e8891f60b5f /Tests
parent4b40e8609c75b00a6ccbf58fc121882975854f59 (diff)
downloadPowerSploit-8dea905998fbebfbcc14bc08cd3dd43a0d671a97.tar.gz
PowerSploit-8dea905998fbebfbcc14bc08cd3dd43a0d671a97.zip
Fixed bug in Get-ModifiablePath that resulted in spaces being expanded to the current directory location
Fixed other logic bugs in Get-ModifiablePath Fixed bug in Add-ServiceDacl when the [ServiceProcess.ServiceController] wasn't loaded yet by Get-Service Error handling for Get-CachedGPPPassword Changed some Write-Warnings to Write-Verbose Updated Privesc Pester tests for PowerUp
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Privesc.tests.ps153
1 files changed, 47 insertions, 6 deletions
diff --git a/Tests/Privesc.tests.ps1 b/Tests/Privesc.tests.ps1
index a36338e..9b9872b 100644
--- a/Tests/Privesc.tests.ps1
+++ b/Tests/Privesc.tests.ps1
@@ -129,7 +129,7 @@ Describe 'Get-ModifiablePath' {
Describe 'Get-CurrentUserTokenGroupSid' {
if(-not $(Test-IsAdmin)) {
- Throw "'Add-ServiceDacl' Pester test needs local administrator privileges."
+ Throw "'Get-CurrentUserTokenGroupSid' Pester test needs local administrator privileges."
}
It 'Should not throw.' {
@@ -167,21 +167,62 @@ Describe 'Add-ServiceDacl' {
{Get-Service | Add-ServiceDacl} | Should Not Throw
}
- It 'Should accept a service as a parameter argument.' {
- $Service = Get-Service | Select-Object -First 1
- $ServiceWithDacl = Add-ServiceDacl -Service $Service
+ It 'Should fail for a non-existent service.' {
+ $ServiceName = Get-RandomName
+ {$Result = Add-ServiceDacl -Name $ServiceName} | Should Throw
+ }
+
+ It 'Should accept a service name as a parameter argument.' {
+ $ServiceName = Get-Service | Select-Object -First 1 | Select-Object -ExpandProperty Name
+ $ServiceWithDacl = Add-ServiceDacl -Name $ServiceName
if(-not $ServiceWithDacl.Dacl) {
Throw "'Add-ServiceDacl' doesn't return a Dacl for a service passed as parameter."
}
}
+ It 'Should accept an array of service names as a parameter argument.' {
+ $ServiceNames = Get-Service | Select-Object -First 5 | Select-Object -ExpandProperty Name
+ $ServicesWithDacl = Add-ServiceDacl -Name $ServiceNames
+
+ if(-not $ServicesWithDacl.Dacl) {
+ Throw "'Add-ServiceDacl' doesn't return Dacls for an array of service names as a parameter."
+ }
+ }
+
It 'Should accept a service object on the pipeline.' {
$Service = Get-Service | Select-Object -First 1
$ServiceWithDacl = $Service | Add-ServiceDacl
if(-not $ServiceWithDacl.Dacl) {
- Throw "'Add-ServiceDacl' doesn't return a Dacl for a service passed as parameter."
+ Throw "'Add-ServiceDacl' doesn't return a Dacl for a service object on the pipeline."
+ }
+ }
+
+ It 'Should accept a service name on the pipeline.' {
+ $ServiceName = Get-Service | Select-Object -First 1 | Select-Object -ExpandProperty Name
+ $ServiceWithDacl = $ServiceName | Add-ServiceDacl
+
+ if(-not $ServiceWithDacl.Dacl) {
+ Throw "'Add-ServiceDacl' doesn't return a Dacl for a service name on the pipeline."
+ }
+ }
+
+ It 'Should accept multiple service objects on the pipeline.' {
+ $Services = Get-Service | Select-Object -First 5
+ $ServicesWithDacl = $Services | Add-ServiceDacl
+
+ if(-not $ServicesWithDacl.Dacl) {
+ Throw "'Add-ServiceDacl' doesn't return Dacls for multiple service objects on the pipeline."
+ }
+ }
+
+ It 'Should accept multiple service names on the pipeline.' {
+ $ServiceNames = Get-Service | Select-Object -First 5 | Select-Object -ExpandProperty Name
+ $ServicesWithDacl = $ServiceNames | Add-ServiceDacl
+
+ if(-not $ServicesWithDacl.Dacl) {
+ Throw "'Add-ServiceDacl' doesn't return Dacls for multiple service names on the pipeline."
}
}
@@ -407,7 +448,7 @@ Describe 'Test-ServiceDaclPermission' {
Describe 'Get-ServiceUnquoted' {
if(-not $(Test-IsAdmin)) {
- Throw "'Get-ServicePermission' Pester test needs local administrator privileges."
+ Throw "'Get-ServiceUnquoted' Pester test needs local administrator privileges."
}
It "Should not throw." {