Hack Forums
[Python] Keylogger - Capturing keystrokes and get screenshot - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Keylogger - Capturing keystrokes and get screenshot (/showthread.php?tid=5666955)



Keylogger - Capturing keystrokes and get screenshot - ASlopaR - Jul 11, 2017

Hello guys! :)

I want in my keylogger for Windows, feature, which every press Return key create screenshot, and send the screen to email + get the file path of active window.

If I compile the script i get (syntax) error

https://pastebin.com/36Fy22Fg


* - Malentor - Jul 11, 2017

i didn't ran the script but I can see a indentation error, probably thats why.

edit: just noticed there are other errors

elif:


you can't use elif like that.


* - ASlopaR - Jul 14, 2017

Ok.. That error is resolved.

New script:
https://pastebin.com/PCfurFpk
Error in line: hooks_manager = pyHook.HookManager()


* - Vanagander - Jul 14, 2017

Code
f.write(GetWindowText(GetForegroundWindow())

Missing a closing parentheses are we not?


* - MindOfLogic - Jul 18, 2017

Good god son, you need to try harder than this.


* - koolkid - Jul 20, 2017

(Jul 11, 2017 06:06 AM)ASlopaR Wrote:  Hello guys! :)

I want in my keylogger for Windows, feature, which every press Return key create screenshot, and send the screen to email + get the file path of active window.

If I compile the script i get (syntax) error

https://pastebin.com/36Fy22Fg

🤝 seeing a few things thats wrong

PHP Code

<?php 
def Keylogee
():
    
def OnKeyboardEvent(event):
        
f = open(log_file, 'a')
        
f.write(event.Key)
        
f.close()
    if 
event.Key == 'Return':
        
f.write('\n')
        
f.write(GetWindowText(GetForegroundWindow()) 

my issue is here:

PHP Code

<?php 
f
.close()
    if 
event.Key == 'Return':
        
f.write('\n')
        
f.write(GetWindowText(GetForegroundWindow()) 

you close the file and then attempt to write to it,


* - ASlopaR - Aug 7, 2017

Problem has been solved.. (I'm sorry I did not say so long)
Compilation runs smoothly, without errors
My new problem is mail sending and writing info to log_file..
Code is here: https://pastebin.com/MvGVjHDV
If I run this script on my computer, log_file is created, If I open the log_file, shows only first line and nothing more..
If I press Return nothing (no screen, no change in log_file, no new mails sended to my mail)