#

在平常的工作和學習中幾乎每個人都會註冊一些平台,在PC端登陸的時候需要用鍵盤輸入對應的帳號和密碼,其中密碼通常都是暗文(如:******),但暗文真的就安全了嗎? 今天帶給大家兩個讓你瞬間「裸奔
」
##1.1 安裝pynput #pip install pynput
1.2 #使用pynput
from pynput.keyboard import Key,Listener
Key:
#按下鍵時:
# 按下键时 def on_press(key): try: # 普通按键 print('按下键: {0} '.format(key.char)) except : # 特殊按键 print('按下键: {0} '.format(key))
#鬆開鍵時:
# 松开键时: def on_release(key): print('松开: {0} '.format(key)) # 可要可不要 if key == Key.esc: return False
Listener:
# 监听键盘按键 with Listener(on_press=on_press, on_release=on_release) as listener: listener.join()
注意:如果需要同时进行监听和控制操作,需要使用多线程
本範例只展示了pynput的鍵盤監聽模組,##pynput 還有鍵盤控制以及滑鼠監控功能,有興趣的夥伴可以看看官網:
https://pypi.org /project/pynput/#description
##PyHook3的安裝要相對複雜一些: #2.1.1 安裝swig.exe: 2.1.2 安裝Microsoft Visual C 14: ##所需空間比較大(4G左右),安裝套件直接安裝即可(若電腦上安裝的有vscode,vstudio等軟體則不需要安裝),本機已安裝vscode,這裡不再展示。 2.1.3 安裝 PyHook3: 失败:
#pip install PyHook3
2.2 使用PyHook3
import PyHook3 import pythoncom
def onMouseEvent(event): # 鼠标移动过滤 if (event.MessageName != "mouse move"): print(event.MessageName) return True
def onKeyboardEvent(event): # 返回按下的键 print(event.Key) return True
# 创建一个钩子管理器 hm = PyHook3.HookManager() # 监听键盘时间 hm.KeyDown = onKeyboardEvent # 键盘钩子 hm.HookKeyboard() # 监听鼠标事件 hm.MouseAll = onMouseEvent # 鼠标钩子 hm.HookMouse() # 循环监听 pythoncom.PumpMessages()

以上是收藏 | 不要再用陌生人的電腦了,這兩個Python庫可以讓你瞬間'裸奔”的詳細內容。更多資訊請關注PHP中文網其他相關文章!

Arraysinpython,尤其是Vianumpy,ArecrucialInsCientificComputingfortheireftheireffertheireffertheirefferthe.1)Heasuedfornumerericalicerationalation,dataAnalysis和Machinelearning.2)Numpy'Simpy'Simpy'simplementIncressionSressirestrionsfasteroperoperoperationspasterationspasterationspasterationspasterationspasterationsthanpythonlists.3)inthanypythonlists.3)andAreseNableAblequick

你可以通過使用pyenv、venv和Anaconda來管理不同的Python版本。 1)使用pyenv管理多個Python版本:安裝pyenv,設置全局和本地版本。 2)使用venv創建虛擬環境以隔離項目依賴。 3)使用Anaconda管理數據科學項目中的Python版本。 4)保留系統Python用於系統級任務。通過這些工具和策略,你可以有效地管理不同版本的Python,確保項目順利運行。

numpyarrayshaveseveraladagesoverandastardandpythonarrays:1)基於基於duetoc的iMplation,2)2)他們的aremoremoremorymorymoremorymoremorymoremorymoremoremory,尤其是WithlargedAtasets和3)效率化,效率化,矢量化函數函數函數函數構成和穩定性構成和穩定性的操作,製造

數組的同質性對性能的影響是雙重的:1)同質性允許編譯器優化內存訪問,提高性能;2)但限制了類型多樣性,可能導致效率低下。總之,選擇合適的數據結構至關重要。

到CraftCraftExecutablePythcripts,lollow TheSebestPractices:1)Addashebangline(#!/usr/usr/bin/envpython3)tomakethescriptexecutable.2)setpermissionswithchmodwithchmod xyour_script.3)

numpyArraysareAreBetterFornumericalialoperations andmulti-demensionaldata,而learthearrayModuleSutableforbasic,內存效率段

numpyArraySareAreBetterForHeAvyNumericalComputing,而lelethearRayModulesiutable-usemoblemory-connerage-inderabledsswithSimpleDatateTypes.1)NumpyArsofferVerverVerverVerverVersAtility andPerformanceForlargedForlargedAtatasetSetsAtsAndAtasEndCompleXoper.2)

ctypesallowscreatingingangandmanipulatingc-stylarraysinpython.1)usectypestoInterfacewithClibrariesForperfermance.2)createc-stylec-stylec-stylarraysfornumericalcomputations.3)passarraystocfunctions foreforfunctionsforeffortions.however.however,However,HoweverofiousofmemoryManageManiverage,Pressiveo,Pressivero


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

SublimeText3 Linux新版
SublimeText3 Linux最新版

記事本++7.3.1
好用且免費的程式碼編輯器

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中