Wednesday, 3 February 2016

PyKeylogger A Pure-Python Keylogger For Linux



Definition: PyKeylogger is a pure-python keylogger for Linux that uses Xlib by which it can monitor the state of the keyboard. The main purpose is backup process and stealth keylogger too. It is available under the GNU General Public License. 

Features:
  • It can easily log all keystrokes to disk
  • It automatically archives log files according to its dated zips
  • It also provides automatic log rotation
  • Zipped log archives are sent out automatically to the specified email address[es] 
  • It works with any SMTP server, including Gmail and Yahoo Mail secure SMTP servers
  • Upload zipped log archives to a specified FTP server automatically
  • At centered location of every mouse click, it takes a partial screenshot
  • If the computer is running it takes screenshots at fixed time interval
  • To ensure the minimization of data loss during crash, it automatically flush write buffer to disk 
  • It provides the features of customization, through configuration with a .ini text file
  • It also provides some features of GUI (graphical) control panel for settings and actions 
  • It also provides features of password protection of control panel
  • To prevent casual snooping passwords are obfuscated in the configuration file
  • If the log files become older than specified age then it automatically deletes it.


Here is the example of its usage:

import keylogger
import time

now = time.time()

done = lambda: time.time() > now + 60

def print_keys(t, modifiers, keys): 
  print "%.2f   %r   %r" % (t, keys, modifiers)
  keylogger.log(done, print_keys)

This will print key events to stdout for 60 seconds. If you wanted to be evil, instead of passing in a print callback, you could pass in a remote logging procedure.

Sample output:

1314238675.42   'o'   {'left shift': False, 'right alt': False, 'right shift': False, 'left 
alt': False, 'left ctrl': False, 'right ctrl': False}
1314238675.51   'm'   {'left shift': False, 'right alt': False, 'right shift': False, 'left 
alt': False, 'left ctrl': False, 'right ctrl': False}
1314238675.65   'g'   {'left shift': False, 'right alt': False, 'right shift': False, 'left 
alt': False, 'left ctrl': False