go check out irongeeks page he has a keylogger code that he posted to his page he also has hardware reviews on some of the hardware dongles that capture keystrokes you can also find code examples in the unoffical guide to ethical hacking second edition its by ankit fadia and put out by thomson course technology isbn number is 1-59863-062-8
you should probaly be able to find a keylogger in kali distro tools as well