前言:

当我们进行后渗透的时候,进行提权的时候

要识别被未打补丁的漏洞。来进行提权,从而

拿到管理员权限。

思路:

1.让使用者在cmd中打systeminfo命令。将补丁号

放入一个txt。

2.与list.txt进行对比。没有的则打出来

对漏洞进行区分

代码:

import os
import optparse
import re
def main():
parser=optparse.OptionParser()
parser.add_option('-j',dest='jiance',help='-j[file] Check all')
parser.add_option('-7',dest='windows7',help='-7[file] inspect windows7')
parser.add_option('-8',dest='windowsserver2008',help='-8 [file] inspect windows server 2008')
parser.add_option('-2',dest='windowserver2012',help='-2 [file] inspect windows server 2012')
parser.add_option('-3',dest='windowsserver2003',help='-3 [file] inspect windows server 2003')
parser.add_option('-x',dest='windowsXP',help='-x [file] inspect windows XP')
parser.add_option('-0',dest='windows10',help='0 [file] inspect windows 10')
(options,args)=parser.parse_args()
if options.jiance:
file=options.jiance
jiance(file)
elif options.windows7:
file2=options.windows7
windows7(file2)
elif options.windowsserver2008:
file3=options.windowsserver2008
windowsserver2008(file3)
elif options.windowserver2012:
file4=options.windowserver2012
windowsserver2012(file4)
elif options.windowsserver2003:
file5=options.windowsserver2003
windowsserver2003(file5)
elif options.windowsXP:
file6=options.windowsXP
windowsxp(file6)
elif options.windows10:
file7=options.windows10
windows10(file7)
else:
parser.print_help()
exit() def jiance(file):
pd=os.path.exists(file)
if pd == True:
print('[*]{}existence'.format(file))
else:
print('[-]Sorry{}not existence'.format(file))
exit() pd2=os.path.exists('list.txt')
if pd2==True:
print('[*]list.txt existence')
else:
print('[-]not existence list.txt')
exit() lists=open('list.txt','r').read()
fg=open('{}'.format(file),'r').read()
pow="{}".format(fg)
lgw=re.findall('KB\d+',lists)
print('[*]There are no patched patches')
for v in lgw:
if v in str(pow):
pass
else:
print("[*]",v) def windows7(file2):
pd = os.path.exists(file2)
if pd == True:
print('[*]{}existence'.format(file2))
else:
print('[-]Sorry{}not existence'.format(file2))
exit() pd2 = os.path.exists('windows7.txt')
if pd2 == True:
print('[*]windows 7.txt existence')
else:
print('[-]not existence windows 7.txt')
exit() lists = open('windows7.txt', 'r').read()
fg = open('{}'.format(file2), 'r').read()
pow = "{}".format(fg)
lgw = re.findall('KB\d+', lists)
print('[*]There are no patched patches')
for v in lgw:
if v in str(pow):
pass
else:
print("[*]", v) def windowsserver2008(file3):
pd = os.path.exists(file3)
if pd == True:
print('[*]{}existence'.format(file3))
else:
print('[-]Sorry{}not existence'.format(file3))
exit() pd2 = os.path.exists('windows server 2008.txt')
if pd2 == True:
print('[*]windows server 2008.txt existence')
else:
print('[-]not existence windows server 2008.txt')
exit() lists = open('windows server 2008.txt', 'r').read()
fg = open('{}'.format(file3), 'r').read()
pow = "{}".format(fg)
lgw = re.findall('KB\d+', lists)
print('[*]There are no patched patches')
for v in lgw:
if v in str(pow):
pass
else:
print("[*]", v) def windowsserver2012(file4):
pd = os.path.exists(file4)
if pd == True:
print('[*]{}existence'.format(file4))
else:
print('[-]Sorry{}not existence'.format(file4))
exit() pd2 = os.path.exists('windows server 2012.txt')
if pd2 == True:
print('[*]windows server 2012.txt existence')
else:
print('[-]not existence windows server 2012.txt')
exit() lists = open('windows server 2012.txt', 'r').read()
fg = open('{}'.format(file4), 'r').read()
pow = "{}".format(fg)
lgw = re.findall('KB\d+', lists)
print('[*]There are no patched patches')
for v in lgw:
if v in str(pow):
pass
else:
print("[*]", v) def windowsserver2003(file5):
pd = os.path.exists(file5)
if pd == True:
print('[*]{}existence'.format(file5))
else:
print('[-]Sorry{}not existence'.format(file5))
exit() pd2 = os.path.exists('windows server 2003.txt')
if pd2 == True:
print('[*]windows server 2003.txt existence')
else:
print('[-]not existence windows server 2003.txt')
exit() lists = open('windows server 2003.txt', 'r').read()
fg = open('{}'.format(file5), 'r').read()
pow = "{}".format(fg)
lgw = re.findall('KB\d+', lists)
print('[*]There are no patched patches')
for v in lgw:
if v in str(pow):
pass
else:
print("[*]", v) def windowsxp(file6):
pd = os.path.exists(file6)
if pd == True:
print('[*]{}existence'.format(file6))
else:
print('[-]Sorry{}not existence'.format(file6))
exit() pd2 = os.path.exists('windows XP.txt')
if pd2 == True:
print('[*]windows XP.txt existence')
else:
print('[-]not existence windows XP.txt')
exit() lists = open('windows XP.txt', 'r').read()
fg = open('{}'.format(file6), 'r').read()
pow = "{}".format(fg)
lgw = re.findall('KB\d+', lists)
print('[*]There are no patched patches')
for v in lgw:
if v in str(pow):
pass
else:
print("[*]", v) def windows10(file7):
pd = os.path.exists(file7)
if pd == True:
print('[*]{}existence'.format(file7))
else:
print('[-]Sorry{}not existence'.format(file7))
exit() pd2 = os.path.exists('windows 10.txt')
if pd2 == True:
print('[*]windows 10.txt existence')
else:
print('[-]not existence windows 10.txt')
exit() lists = open('windows 10.txt', 'r').read()
fg = open('{}'.format(file7), 'r').read()
pow = "{}".format(fg)
lgw = re.findall('KB\d+', lists)
print('[*]There are no patched patches')
for v in lgw:
if v in str(pow):
pass
else:
print("[*]", v)
if __name__ == '__main__':
main()

效果:

Github下载地址:https://github.com/422926799/python

python打造漏洞补丁缺少检测的更多相关文章

  1. python打造漏洞数据导出工具

    功能 [x] 支持导出的数据:IP地址.漏洞名称.风险等级.整改建议.漏洞描述.漏洞CVE编号.漏洞对应端口.漏洞对应协议.漏洞对应服务等. [x] 导出不同端口的同一个漏洞,也就是一个端口对应一个漏 ...

  2. phantomjs + python 打造一个微信机器人

    phantomjs + python 打造一个微信机器人 1.前奏   媳妇公司不能上网,但经常需要在公众号上找一些文章做一些参考,需要的时候就把文章链接分享给我,然后我在浏览器打开网页,一点点复制过 ...

  3. python常见漏洞总结

    总结一下python里面常见安全问题,文章大部分内容来自MisakiKata师傅的python_code_audit项目,对原文进行了一些修改,后续会使用编写了规则对代码里面是否用到这些危险函数进行相 ...

  4. Weblogic反序列化漏洞补丁更新解决方案

    Weblogic反序列化漏洞的解决方案基于网上给的方案有两种: 第一种方案如下 使用SerialKiller替换进行序列化操作的ObjectInputStream类; 在不影响业务的情况下,临时删除掉 ...

  5. python脚本实现集群检测和管理

    python脚本实现集群检测和管理 场景是这样的:一个生产机房,会有很多的测试机器和生产机器(也就是30台左右吧),由于管理较为混乱导致了哪台机器有人用.哪台机器没人用都不清楚,从而产生了一个想法-- ...

  6. 教你用python打造WiFiddos

    本文来源于i春秋学院,未经允许严禁转载. 0x00 前言因为在百度上很难找到有关于用python打造WiFidos的工具的,而且不希望大家成为一名脚本小子,所以我打算写一篇,需要的工具有scapy,i ...

  7. 【python】10分钟教你用python打造贪吃蛇超详细教程

    10分钟教你用python打造贪吃蛇超详细教程 在家闲着没妹子约, 刚好最近又学了一下python,听说pygame挺好玩的.今天就在家研究一下, 弄了个贪吃蛇出来.希望大家喜欢. 先看程序效果: 0 ...

  8. 10分钟教你用Python打造微信天气预报机器人

    01 前言 最近武汉的天气越来越恶劣了.动不动就下雨,所以,拥有一款好的天气预报工具,对于我们大学生来说,还真是挺重要的了.好了,自己动手,丰衣足食,我们来用Python打造一个天气预报的微信机器人吧 ...

  9. 第11章:使用Python打造MySQL专家系统

    1.Python语言高级特性 1).深入浅出Python生成器 1).生成器函数:与普通函数定义类似,使用yield语句而不是return语句返回结果.yield语句一次返回一个结果,在每个结果中间挂 ...

随机推荐

  1. 理解 Git 的基本概念 ( Merging Collaborating Rebasing)

    合并 Merging 在分支上开发新功能后,如何把新功能加入到主分支,让其它人得到你的修改呢?你需要使用命令 git merge 或 git pull. 这两个命令的语法如下: git merge [ ...

  2. 从 TWAIN 设备中扫描图像

    转自(http://yonsm.net/scan-images-from-a-twain-device/) 一.简介 TWAIN 数据源管理程序 (DSM) 工业标准的软件库,用于从静态图像设备提取图 ...

  3. 1元抢卡巴KAV_不限量疯抢即日起至2013.10.31截止

    活动地址:http://img.kaba365.com/mail_files/kaba1yuan.html

  4. Python基础学习----公共方法及运算符

    # 公共方法:在python高级数据类型通用的方法 # 常见的:max() min() len() del() # 列表 list=[1,2,3] print(len(list)) print(min ...

  5. python原生的日志模块

    Python中有个logging模块可以完成相关信息的记录,在debug时用它往往事半功倍 1. 日志级别 日志一共分成5个等级,从低到高分别是: DEBUG INFO WARNING ERROR C ...

  6. window 更新 nodejs

    一直号称js程序员,结果发现自己机器的node版本才到 4.x.赶紧升级下. 在window下可以直接去nodejs.org下载最新的稳定版装上就行.同时也可以通过 powershell 命令行更新. ...

  7. 细思极恐-你真的会写java吗?

    文章核心 其实,本不想把标题写的那么恐怖,只是发现很多人干了几年java以后,都自认为是一个不错的java程序员了,可以拿着上万的工资都处宣扬自己了,写这篇文章的目的并不是嘲讽和我一样做java的同行 ...

  8. 首次运行tensorflow-gpu 1.0 报错 failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED

    发现博客: https://blog.csdn.net/u010752600/article/details/79534910 于是找到解决方法. sudo rm -rf ~/.nv/ 

  9. imshow(K)和imshow(K,[]) 的区别

    参考文献 imshow(K)直接显示K:imshow(K,[])显示K,并将K的最大值和最小值分别作为纯白(255)和纯黑(0),中间的K值映射为0到255之间的标准灰度值.

  10. Hibernate对象的三种状态,瞬时态、持久态、游离态

    1.瞬时态.(new完一个对象,突然断电,内存中没有此对象) hibernate中什么时候的对象为瞬时态呢,当我们new 一个对象时,还没有save时,它就是瞬时态的,当我们delete一个对象时,它 ...