'Is there a way to log (additional) keystroke information on a Cowrie honeypot?

For a thesis project, I have set up a Cowrie honeypot within an Azure VM running Debian. I am interested in, in addition to the regular logs, extracting specific keystroke information (i.e. whether delete/backspace keys are pressed and time between commands), for example:

2022-1-10 10:51:12 sudo<Key.Spacebar>somecommm<Key.Backspace>and<Key.Enter>

2022-1-10 10:51:15 sudo<Key.Spacebar>someothercommand<Key.Enter>

I have looked at the options of playing back the Cowrie TTY logs, but that does not seem to give me all the information I need. For example, function keys do not seem to be logged within said files.

Moreover, I have thought about adding some sort of keylogging element to the honeypot environment. Sadly, I am a Script Kiddie when it comes to anything other than (basic) Python (so you might say I'm a script kiddie, period), so I have no clue where to start or whether what I am trying to do is even viable. I would love to learn, but my time before the thesis deadline is limited so I figured I might as well pose the question here.

I'm hoping anyone here has experience with doing these types of things (or perhaps even this specific thing)?



Solution 1:[1]

I have a perfect working javascript api, all you need to do is write it to a file, my online version is here, just start typing and it will log the characters in decimal, but co-signs are not counted such as Shift, Ctrl, or some other alphanumeric UTF-8 characters. I had the same question, but I'm operating from a Chromebook, so no access to python or any of its uses.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 E_net4 - Krabbe mit Hüten