我慢慢地,但肯定地教自己Python.我做得最好.我正在寻找一些整洁的系统生产力程序,我可以尝试制作你发现对自己有用的程序.我成功制作和使用的一些模块如下:
但我现在有点卡住了.我还能做什么?
我写了一个脚本,它使用我手机的蓝牙ID作为一种物理安全令牌.当PC(Windows)从睡眠状态恢复时,它会扫描附近的蓝牙设备,如果找不到我的手机,则锁定工作站.
Corny,并不是很安全,但服务于它的目的.
"""
Intended to run on Windows resume. Scans for bluetooth devices and if a
particular device is not present, locks the computer.
"""
import bluetooth
import ctypes
import sys
# Bluetooth UID of "token" device
wanted = "XX:XX:XX:XX:XX:XX"
print "performing inquiry..."
# Hack.... if 0 devices are present, pybluez throws an exception
passed = False
try:
discovered = bluetooth.discover_devices()
if wanted in discovered:
print "Found phone"
passed = True
else:
passed = False
except:
passed = False
if not passed:
print "Locking"
ctypes.windll.user32.LockWorkStation()
Run Code Online (Sandbox Code Playgroud)
要求:
归档时间: |
|
查看次数: |
2858 次 |
最近记录: |