美文网首页Windows程序员运维空间
【原创】查局域网电脑补丁安装情况的py脚本

【原创】查局域网电脑补丁安装情况的py脚本

作者: p73661 | 来源:发表于2018-04-18 22:49 被阅读2次

    使用方法:
    (使用本脚本web版必须保证你的两台电脑可以连通。而且必须在同一局域网下)

    功能说明:
    scanKBbox Web版:可以查看同一局域网下的某个计算机安装的补丁,简单粗暴

    # execute command, and return the output
    def execCmd(cmd):
        r = os.popen(cmd)
        text = r.read()
        r.close()
        return text
    
    # 获取安装的kb号
    IPadress = raw_input("请输入内网ip,看看我能不能找到(eg:192.168.1.1):")
    UserName = raw_input("请输入用户名")
    PassWord = raw_input("请输入密码,没有请留空")
    if PassWord:
        cmd = "Systeminfo /s "+IPadress+" /u "+UserName+" /p "+PassWord
    else:
        cmd = "Systeminfo /s " + IPadress + " /u " + UserName
    result = execCmd(cmd)
    pat1 = re.compile("KB[0-9]{5,8}")
    KBId = re.findall(pat1,result)  # 找到kbid
    kbhao=str(KBId)
    print "安装的补丁号为:"+kbhao

    相关文章

      网友评论

        本文标题:【原创】查局域网电脑补丁安装情况的py脚本

        本文链接:https://www.haomeiwen.com/subject/mvtikftx.html