1
+ import os
2
+ import optparse
3
+ import re
4
+ def main ():
5
+ parser = optparse .OptionParser ()
6
+ parser .add_option ('-j' ,dest = 'jiance' ,help = '-j[file] Check all' )
7
+ parser .add_option ('-7' ,dest = 'windows7' ,help = '-7[file] inspect windows7' )
8
+ parser .add_option ('-8' ,dest = 'windowsserver2008' ,help = '-8 [file] inspect windows server 2008' )
9
+ parser .add_option ('-2' ,dest = 'windowserver2012' ,help = '-2 [file] inspect windows server 2012' )
10
+ parser .add_option ('-3' ,dest = 'windowsserver2003' ,help = '-3 [file] inspect windows server 2003' )
11
+ parser .add_option ('-x' ,dest = 'windowsXP' ,help = '-x [file] inspect windows XP' )
12
+ parser .add_option ('-0' ,dest = 'windows10' ,help = '0 [file] inspect windows 10' )
13
+ (options ,args )= parser .parse_args ()
14
+ if options .jiance :
15
+ file = options .jiance
16
+ jiance (file )
17
+ elif options .windows7 :
18
+ file2 = options .windows7
19
+ windows7 (file2 )
20
+ elif options .windowsserver2008 :
21
+ file3 = options .windowsserver2008
22
+ windowsserver2008 (file3 )
23
+ elif options .windowserver2012 :
24
+ file4 = options .windowserver2012
25
+ windowsserver2012 (file4 )
26
+ elif options .windowsserver2003 :
27
+ file5 = options .windowsserver2003
28
+ windowsserver2003 (file5 )
29
+ elif options .windowsXP :
30
+ file6 = options .windowsXP
31
+ windowsxp (file6 )
32
+ elif options .windows10 :
33
+ file7 = options .windows10
34
+ windows10 (file7 )
35
+ else :
36
+ parser .print_help ()
37
+ exit ()
38
+
39
+ def jiance (file ):
40
+ pd = os .path .exists (file )
41
+ if pd == True :
42
+ print ('[*]{}existence' .format (file ))
43
+ else :
44
+ print ('[-]Sorry{}not existence' .format (file ))
45
+ exit ()
46
+
47
+ pd2 = os .path .exists ('list.txt' )
48
+ if pd2 == True :
49
+ print ('[*]list.txt existence' )
50
+ else :
51
+ print ('[-]not existence list.txt' )
52
+ exit ()
53
+
54
+ lists = open ('list.txt' ,'r' ).read ()
55
+ fg = open ('{}' .format (file ),'r' ).read ()
56
+ pow = "{}" .format (fg )
57
+ lgw = re .findall ('KB\d+' ,lists )
58
+ print ('[*]There are no patched patches' )
59
+ for v in lgw :
60
+ if v in str (pow ):
61
+ pass
62
+ else :
63
+ print ("[*]" ,v )
64
+
65
+ def windows7 (file2 ):
66
+ pd = os .path .exists (file2 )
67
+ if pd == True :
68
+ print ('[*]{}existence' .format (file2 ))
69
+ else :
70
+ print ('[-]Sorry{}not existence' .format (file2 ))
71
+ exit ()
72
+
73
+ pd2 = os .path .exists ('windows7.txt' )
74
+ if pd2 == True :
75
+ print ('[*]windows 7.txt existence' )
76
+ else :
77
+ print ('[-]not existence windows 7.txt' )
78
+ exit ()
79
+
80
+ lists = open ('windows7.txt' , 'r' ).read ()
81
+ fg = open ('{}' .format (file2 ), 'r' ).read ()
82
+ pow = "{}" .format (fg )
83
+ lgw = re .findall ('KB\d+' , lists )
84
+ print ('[*]There are no patched patches' )
85
+ for v in lgw :
86
+ if v in str (pow ):
87
+ pass
88
+ else :
89
+ print ("[*]" , v )
90
+
91
+ def windowsserver2008 (file3 ):
92
+ pd = os .path .exists (file3 )
93
+ if pd == True :
94
+ print ('[*]{}existence' .format (file3 ))
95
+ else :
96
+ print ('[-]Sorry{}not existence' .format (file3 ))
97
+ exit ()
98
+
99
+ pd2 = os .path .exists ('windows server 2008.txt' )
100
+ if pd2 == True :
101
+ print ('[*]windows server 2008.txt existence' )
102
+ else :
103
+ print ('[-]not existence windows server 2008.txt' )
104
+ exit ()
105
+
106
+ lists = open ('windows server 2008.txt' , 'r' ).read ()
107
+ fg = open ('{}' .format (file3 ), 'r' ).read ()
108
+ pow = "{}" .format (fg )
109
+ lgw = re .findall ('KB\d+' , lists )
110
+ print ('[*]There are no patched patches' )
111
+ for v in lgw :
112
+ if v in str (pow ):
113
+ pass
114
+ else :
115
+ print ("[*]" , v )
116
+
117
+ def windowsserver2012 (file4 ):
118
+ pd = os .path .exists (file4 )
119
+ if pd == True :
120
+ print ('[*]{}existence' .format (file4 ))
121
+ else :
122
+ print ('[-]Sorry{}not existence' .format (file4 ))
123
+ exit ()
124
+
125
+ pd2 = os .path .exists ('windows server 2012.txt' )
126
+ if pd2 == True :
127
+ print ('[*]windows server 2012.txt existence' )
128
+ else :
129
+ print ('[-]not existence windows server 2012.txt' )
130
+ exit ()
131
+
132
+ lists = open ('windows server 2012.txt' , 'r' ).read ()
133
+ fg = open ('{}' .format (file4 ), 'r' ).read ()
134
+ pow = "{}" .format (fg )
135
+ lgw = re .findall ('KB\d+' , lists )
136
+ print ('[*]There are no patched patches' )
137
+ for v in lgw :
138
+ if v in str (pow ):
139
+ pass
140
+ else :
141
+ print ("[*]" , v )
142
+
143
+ def windowsserver2003 (file5 ):
144
+ pd = os .path .exists (file5 )
145
+ if pd == True :
146
+ print ('[*]{}existence' .format (file5 ))
147
+ else :
148
+ print ('[-]Sorry{}not existence' .format (file5 ))
149
+ exit ()
150
+
151
+ pd2 = os .path .exists ('windows server 2003.txt' )
152
+ if pd2 == True :
153
+ print ('[*]windows server 2003.txt existence' )
154
+ else :
155
+ print ('[-]not existence windows server 2003.txt' )
156
+ exit ()
157
+
158
+ lists = open ('windows server 2003.txt' , 'r' ).read ()
159
+ fg = open ('{}' .format (file5 ), 'r' ).read ()
160
+ pow = "{}" .format (fg )
161
+ lgw = re .findall ('KB\d+' , lists )
162
+ print ('[*]There are no patched patches' )
163
+ for v in lgw :
164
+ if v in str (pow ):
165
+ pass
166
+ else :
167
+ print ("[*]" , v )
168
+
169
+ def windowsxp (file6 ):
170
+ pd = os .path .exists (file6 )
171
+ if pd == True :
172
+ print ('[*]{}existence' .format (file6 ))
173
+ else :
174
+ print ('[-]Sorry{}not existence' .format (file6 ))
175
+ exit ()
176
+
177
+ pd2 = os .path .exists ('windows XP.txt' )
178
+ if pd2 == True :
179
+ print ('[*]windows XP.txt existence' )
180
+ else :
181
+ print ('[-]not existence windows XP.txt' )
182
+ exit ()
183
+
184
+ lists = open ('windows XP.txt' , 'r' ).read ()
185
+ fg = open ('{}' .format (file6 ), 'r' ).read ()
186
+ pow = "{}" .format (fg )
187
+ lgw = re .findall ('KB\d+' , lists )
188
+ print ('[*]There are no patched patches' )
189
+ for v in lgw :
190
+ if v in str (pow ):
191
+ pass
192
+ else :
193
+ print ("[*]" , v )
194
+
195
+ def windows10 (file7 ):
196
+ pd = os .path .exists (file7 )
197
+ if pd == True :
198
+ print ('[*]{}existence' .format (file7 ))
199
+ else :
200
+ print ('[-]Sorry{}not existence' .format (file7 ))
201
+ exit ()
202
+
203
+ pd2 = os .path .exists ('windows 10.txt' )
204
+ if pd2 == True :
205
+ print ('[*]windows 10.txt existence' )
206
+ else :
207
+ print ('[-]not existence windows 10.txt' )
208
+ exit ()
209
+
210
+ lists = open ('windows 10.txt' , 'r' ).read ()
211
+ fg = open ('{}' .format (file7 ), 'r' ).read ()
212
+ pow = "{}" .format (fg )
213
+ lgw = re .findall ('KB\d+' , lists )
214
+ print ('[*]There are no patched patches' )
215
+ for v in lgw :
216
+ if v in str (pow ):
217
+ pass
218
+ else :
219
+ print ("[*]" , v )
220
+ if __name__ == '__main__' :
221
+ main ()
0 commit comments