Guest User

Untitled

a guest
May 21st, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. installedSoftware = []
  2.  
  3. for key in reg:
  4.     try:
  5.         count = 0 # int variable for iterating through registry keys
  6.         while True:
  7.             subKeyName = EnumKey(key, count) # name of registry key at given index
  8.             isKB = subKeyName.find('KB') # check if string contains KB number (-1 if not)
  9.             if isKB != -1:
  10.                 keySplit = subKeyName.split('_') # split key name at underscores
  11.                 for s in keySplit:
  12.                     if 'KB' in s:
  13.                         installedSoftware.append(s) # add substring to list if it contains a KB number
  14.             count += 1
  15.     except WindowsError:
  16.         pass
  17.  
  18. kbNumbers = set(installedSoftware)
Add Comment
Please, Sign In to add comment