zoukankan      html  css  js  c++  java
  • python禁用键鼠与提权

    要求

    利用python实现禁用键盘鼠标

    思路

    经过查阅资料目前最好的办法是采用ctypes中的dll文件进行编写

    from ctypes import *
    improt time
    
    print(winll.shell32.IsUserAnAdmin())  #判断是否有管理员权限
    
    
    user32 = windll.LoadLibrary("C:\Windows\System32\user32.dll")
    user32.BlockInput(True)  #该功能需要管理员权限 True  禁用
    time.sleep(5)
    user32.BlockInput(Flase)  #该功能需要管理员权限 
    time.sleep(5)         
    

    提权

    def requireAdministrator(f):
        def inner(*args, **kwargs):
            if windll.shell32.IsUserAnAdmin():
                f()
            else:
                # Re-run the program with admin rights
                windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 0)
                f()
        return inner
    

    官方文档

  • 相关阅读:
    怎么在myeclipse中怎么集成Tomcat。
    JSP .基础概念
    继承
    封装
    什么是面向对象
    数据排序
    开发的套路
    Javabean规范
    转发和重定向
    md5加密
  • 原文地址:https://www.cnblogs.com/jokerBi/p/10945449.html
Copyright © 2011-2022 走看看