Compare commits

..

No commits in common. "keylogger" and "master" have entirely different histories.

2 changed files with 18 additions and 77 deletions

View File

@ -7,21 +7,18 @@ namespace FemboyWatchdog
{ {
static class GlobalHooks static class GlobalHooks
{ {
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam); public delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam);
public static IntPtr SetHook(int idHook, HookProc proc) public static IntPtr SetHook(LowLevelMouseProc proc)
{ {
using (Process curProcess = Process.GetCurrentProcess()) using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule) using (ProcessModule curModule = curProcess.MainModule)
{ {
return SetWindowsHookEx(idHook, proc, return SetWindowsHookEx(WH_MOUSE_LL, proc,
GetModuleHandle(curModule.ModuleName), 0); GetModuleHandle(curModule.ModuleName), 0);
} }
} }
public const int WH_KEYBOARD = 2;
public const int WH_KEYBOARD_LL = 13;
public const int WH_MOUSE = 7;
public const int WH_MOUSE_LL = 14; public const int WH_MOUSE_LL = 14;
public enum MouseMessages public enum MouseMessages
@ -34,11 +31,6 @@ namespace FemboyWatchdog
WM_RBUTTONUP = 0x0205 WM_RBUTTONUP = 0x0205
} }
public enum KeyboardMessages
{
WM_CHAR = 0x0102
}
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct POINT public struct POINT
{ {
@ -58,7 +50,7 @@ namespace FemboyWatchdog
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SetWindowsHookEx(int idHook, public static extern IntPtr SetWindowsHookEx(int idHook,
HookProc lpfn, IntPtr hMod, uint dwThreadId); LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]

View File

@ -9,7 +9,6 @@ using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Speech.Synthesis; using System.Speech.Synthesis;
using System.Text; using System.Text;
using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using AForge.Video; using AForge.Video;
using AForge.Video.DirectShow; using AForge.Video.DirectShow;
@ -27,39 +26,27 @@ namespace FemboyWatchdog
private VideoCaptureDevice videoDevice; private VideoCaptureDevice videoDevice;
private VideoCapabilities[] videoCapabilities; private VideoCapabilities[] videoCapabilities;
private System.Windows.Forms.Timer labelBlinkTimer; private Timer labelBlinkTimer;
private System.Windows.Forms.Timer ttsTimer; private Timer ttsTimer;
private System.Windows.Forms.Timer mousemvmtTimer; private Timer mousemvmtTimer;
private int mousemvmtCount = 0; private int mousemvmtCount = 0;
/* mouse movements come in as a stream, so we'll say a mouse movement is "over" by waiting /* mouse movements come in as a stream, so we'll say a mouse movement is "over" by waiting
a certain time with no movement */ a certain time with no movement */
private System.Windows.Forms.Timer lastmousemvmtTimer; private Timer lastmousemvmtTimer;
private SpeechSynthesizer ss; private SpeechSynthesizer ss;
private SolidBrush brush = new SolidBrush(Color.Red); private SolidBrush brush = new SolidBrush(Color.Red);
private Font font = new Font(FontFamily.GenericSansSerif, 24); private Font font = new Font(FontFamily.GenericSansSerif, 24);
private GlobalHooks.HookProc _mouseProc; private GlobalHooks.LowLevelMouseProc _proc;
private static IntPtr _mouseHookID = IntPtr.Zero; private static IntPtr _hookID = IntPtr.Zero;
private GlobalHooks.HookProc _kbProc;
private static IntPtr _kbHookID = IntPtr.Zero;
private string keyloggerBuffer;
private static string[] keyloggerKeywords = {
"fembooru", "femboyfinancial", "femboywatchdog", "accounts payable",
"femboycliquere", "femboybanking", "femboygeometry"
};
public Monitor() public Monitor()
{ {
_mouseProc = OnMouseMessage; _proc = OnMouseMessage;
GlobalHooks.SetHook(GlobalHooks.WH_MOUSE_LL, _mouseProc); GlobalHooks.SetHook(_proc);
_kbProc = OnKeyboardMessage;
GlobalHooks.SetHook(GlobalHooks.WH_KEYBOARD_LL, _kbProc);
InitializeComponent(); InitializeComponent();
ss = new SpeechSynthesizer(); ss = new SpeechSynthesizer();
@ -67,14 +54,14 @@ namespace FemboyWatchdog
tracker = new LocationProvider(); tracker = new LocationProvider();
spammer = new SpamProvider(); spammer = new SpamProvider();
ttsTimer = new System.Windows.Forms.Timer(); ttsTimer = new Timer();
ttsTimer.Interval = 15000; ttsTimer.Interval = 15000;
labelBlinkTimer = new System.Windows.Forms.Timer(); labelBlinkTimer = new Timer();
labelBlinkTimer.Interval = 1000; labelBlinkTimer.Interval = 1000;
mousemvmtTimer = new System.Windows.Forms.Timer(); mousemvmtTimer = new Timer();
mousemvmtTimer.Interval = 60000; mousemvmtTimer.Interval = 60000;
mousemvmtTimer.Start(); mousemvmtTimer.Start();
lastmousemvmtTimer = new System.Windows.Forms.Timer(); lastmousemvmtTimer = new Timer();
lastmousemvmtTimer.Interval = 500; lastmousemvmtTimer.Interval = 500;
// hook events // hook events
@ -88,44 +75,6 @@ namespace FemboyWatchdog
ttsTimer.Start(); ttsTimer.Start();
} }
private IntPtr OnKeyboardMessage(Int32 code, IntPtr wParam, IntPtr lParam)
{
Int32 msgType = wParam.ToInt32();
Int32 charCode = wParam.ToInt32();
Int32 repeatCount = lParam.ToInt32() & 0xFFFF;
string key = "";
if (code >= 0 && msgType == GlobalHooks.WM_CHAR)
{
charCode = Marshal.ReadInt32(lParam);
}
buf += keys.ToString();
foreach (string keyword in keywords)
{
if (buf.ToLower().Contains(keyword))
{
ShowBonusBalloon(keyword);
buf = "";
break;
}
}
}
private void ShowBonusBalloon(string keyword)
{
NotifyIcon ni = new NotifyIcon();
ni.Visible = true;
ni.Icon = SystemIcons.Application;
ni.BalloonTipTitle = "Bonus earned!";
ni.BalloonTipText = string.Format(
"Thank you for discussing {0}! +0.05 USD has been deposited into your account.",
keyword
);
ni.ShowBalloonTip(10000);
Thread.Sleep(15000);
ni.Dispose();
}
private void lastmousemvmtTimer_Tick(object sender, EventArgs e) private void lastmousemvmtTimer_Tick(object sender, EventArgs e)
{ {
++mousemvmtCount; ++mousemvmtCount;
@ -168,7 +117,7 @@ namespace FemboyWatchdog
if (!lastmousemvmtTimer.Enabled) if (!lastmousemvmtTimer.Enabled)
lastmousemvmtTimer.Start(); lastmousemvmtTimer.Start();
} }
return GlobalHooks.CallNextHookEx(_mouseHookID, nCode, wParam, lParam); return GlobalHooks.CallNextHookEx(_hookID, nCode, wParam, lParam);
} }
private void OpenCamera() private void OpenCamera()