Skip to content

Commit 924103a

Browse files
author
Matt Graeber
committed
Invoke-DllInjection Pester test improvement
The test dll I now use is advpack.dll since that is present in all versions of windows.
1 parent e144be7 commit 924103a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Tests/CodeExecution.tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,19 @@ Describe 'Invoke-Shellcode' {
125125
}
126126

127127
Describe 'Invoke-DllInjection' {
128-
$Accessibilitycpl = 'accessibilitycpl.dll'
129-
$AccessibilitycplPath = "$($Env:SystemRoot)\System32\$Accessibilitycpl"
128+
$Advpack = 'advpack.dll'
129+
$AdvpackPath = "$($Env:SystemRoot)\System32\$Advpack"
130130

131131
It 'should inject a known system DLL' {
132-
if (-not (Test-Path $AccessibilitycplPath)) {
133-
throw "$AccessibilitycplPath does not exist on disk."
132+
if (-not (Test-Path $AdvpackPath)) {
133+
throw "$AdvpackPath does not exist on disk."
134134
}
135135

136-
$LoadedModule = Invoke-DllInjection -ProcessID $PID -Dll $AccessibilitycplPath
136+
$LoadedModule = Invoke-DllInjection -ProcessID $PID -Dll $AdvpackPath
137137
$LoadedModule | Should Not BeNullOrEmpty
138138

139139
$LoadedModule -is [System.Diagnostics.ProcessModule] | Should Be $True
140-
$LoadedModule.ModuleName | Should Be $Accessibilitycpl
140+
$LoadedModule.ModuleName | Should Be $Advpack
141141
}
142142

143143
It 'should not inject a non-existent DLL' {
@@ -149,7 +149,7 @@ Describe 'Invoke-DllInjection' {
149149
}
150150

151151
It 'should not inject to a non-existent process' {
152-
{ Invoke-DllInjection -ProcessID 0 -Dll $AccessibilitycplPath } | Should Throw
152+
{ Invoke-DllInjection -ProcessID 0 -Dll $AdvpackPath } | Should Throw
153153
}
154154
}
155155

0 commit comments

Comments
 (0)