[color=rgba(58, 58, 58, 0.88)]以前写了浏览器插件禁止在计算机教室自习时通过网页刷抖音或者观看其它不适合在校内访问的网站
发现有使用者会安装其它浏览器或者直接安装软件来直接玩,所以搞个小软件,来限制不允许访问的软件运行。
打包后只有6M多,放到开机启动里面,然后同步到所有自习室机房所有电脑就行了。
1 运行进来没有图标,一般人也不知道它在运行,每5秒检测一次,发现可疑进程,立即结束。
2 可以在远程服务器上设置要禁止的进程关键字(软件每5分钟读取并更新名单)
上代码: [color=rgba(58, 58, 58, 0.88)]python [color=rgba(58, 58, 58, 0.88)] [size=0.9em]
import osimport Psutilimport timeimport threadingimport requests # 检测程序进程 def checkProcess(): global processkey if len(processKey) > 0: processes = psutil.process_iter(['name']) for proc in processes: _name = proc.name().upper() for key in processKey: key = key.upper() if key in _name: print(proc) proc.kill() else: print("没有程序需要检测") time.sleep(5) checkProcess() # 读取远程限制进程的数据 def readProcessKey(): global processKey headers = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Mobile Safari/537.36' } params = {}#我的远程匹配文件放这里了 response = requests.post(url="http://www.flash023.cn/other/stu_process.json", params=params, headers=headers) if response.status_code == 200: try: processKey = response.json()["processKey"] print(processKey) except: print("数据异常!") else: print("加载失败!") time.sleep(5*60) readProcessKey() processKey = []readThread = threading.Thread(target=readProcessKey)readThread.start()checkThread = threading.Thread(target=checkProcess)checkThread.start()[color=rgba(58, 58, 58, 0.88)]JavaScript
[size=0.9em]
{ "processKey": ["QtScrcpy", "QQ", "Fiddler","douyin"], "total": 4}[color=rgba(58, 58, 58, 0.88)]运行图片: [color=rgba(58, 58, 58, 0.88)]
[color=rgba(58, 58, 58, 0.88)]
[color=rgba(58, 58, 58, 0.88)]
[color=rgba(58, 58, 58, 0.88)]
|