[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 # -*- coding: utf-8 -*- 2 from struct import pack 3 4 REG_NONE=0 5 REG_SZ=1 6 REG_EXPAND_SZ=2 7 REG_BINARY=3 8 REG_DWORD=4 9 REG_DWORD_BIG_ENDIAN=5 10 REG_LINK=6 11 REG_MULTI_SZ=7 12 REG_RESOURCE_LIST=8 13 REG_FULL_RESOURCE_DESCRIPTOR=9 14 REG_RESOURCE_REQUIREMENTS_LIST=10 15 REG_QWORD=11; 16 17 REGFILE_SIGNATURE="67655250" 18 REGFILE_VERSION="00000001" 19 20 folder_keys = [('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\{374DE290-123F-4565-9164-39C4925E467B}', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\Bureau'), 21 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Local AppData', 'REG_EXPAND_SZ', '2000,XP', '%USERPROFILE%\Application Data'), 22 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Local AppData', 'REG_EXPAND_SZ', 'Vista,Seven', '%USERPROFILE%\Appdata\Local'), 23 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Local Settings', 'REG_EXPAND_SZ', '2000,XP', '%USERPROFILE%\Local Settings'), 24 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\AppData', 'REG_EXPAND_SZ', '2000,XP,Vista,Seven', 'K:\profil\\appdata'), 25 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cache', 'REG_EXPAND_SZ', 'Vista,Seven', '%USERPROFILE%\Appdata\Local\Cache'), 26 # ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cookies', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\profil\\appdata\Cookies'), 27 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Desktop', 'REG_EXPAND_SZ', '2000,XP,Vista,Seven', 'K:\profil\Bureau'), 28 # ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\profil\\appdata\Favorites'), 29 # ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\History', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\profil\\appdata\History'), 30 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\My Music', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\Musique'), 31 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\My Pictures', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\Photos'), 32 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\My Video', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\Videos'), 33 # ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\NetHood', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\profil\\appdata\NetHood'), 34 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal', 'REG_EXPAND_SZ', '2000,XP,Vista,Seven', 'K:\Docs'), 35 # ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\PrintHood', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\profil\\appdata\PrintHood'), 36 # ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Recent', 'REG_EXPAND_SZ', 'Vista,Seven', 'K:\profil\\appdata\Recent'), 37 # ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\SendTo', 'REG_EXPAND_SZ', '2000,XP','%USERPROFILE%\SendTo'), 38 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Templates', 'REG_EXPAND_SZ', '2000,XP,Vista,Seven', 'K:\profil\\appdata\Templates')] 39 40 41 default_keys = [('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\HideLegacyLogonScripts', 'REG_DWORD', 'XP', '1'), 42 ('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpNumConnections', 'REG_DWORD', '2000,XP,Vista,Seven', '5000'), 43 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableChangePassword', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 44 ('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters\DisablePasswordChange', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 45 ('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\ForceGuest', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 46 ('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DeleteRoamingCache', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 47 ('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\LocalAccountTokenFilterPolicy', 'REG_DWORD', 'Seven', '1'), 48 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\DeleteRoamingCache', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 49 ('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\RunLogonScriptSync', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 50 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\CompatibleRUPSecurity', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 51 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\ProfileErrorAction', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 52 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\WaitForNetwork', 'REG_DWORD', 'Vista,Seven', '1'), 53 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon\SyncForegroundPolicy', 'REG_DWORD', 'XP,Vista,Seven', '1'), 54 ('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\ShowLogonOptions', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 55 ('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DisableCAD', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 56 ('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\DontDisplayLastUserName', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 57 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowMyDocs', 'REG_DWORD', 'Vista,Seven', '0'), 58 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowMyPics', 'REG_DWORD', 'Vista,Seven', '0'), 59 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowMyMusic', 'REG_DWORD', 'Vista,Seven', '0'), 60 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowMyGames', 'REG_DWORD', 'Vista,Seven', '0'), 61 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowUser', 'REG_DWORD', 'Vista,Seven', '0'), 62 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{374DE290-123F-4565-9164-39C4925E467B}\NukeOnDelete', 'REG_DWORD', 'Vista,Seven', '1'), 63 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\NukeOnDelete', 'REG_DWORD', 'Vista,Seven', '1'), 64 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{FDD39AD0-238F-46AF-ADB4-6C85480369C7}\NukeOnDelete', 'REG_DWORD', 'Vista,Seven', '1'), 65 ('HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\NetCache\Enabled', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 66 ('HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\NetCache\NoConfigCache', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 67 ('HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\NetCache\FormatDataBase', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 68 ('HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\NetCache\DisableFRAdminPin', 'REG_DWORD', '2000,XP,Vista,Seven', '2'), 69 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\{645FF040-5081-101B-9F08-00AA002F954E}', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 70 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu\{645FF040-5081-101B-9F08-00AA002F954E}', 'REG_DWORD', '2000,XP,Vista,Seven', '1'), 71 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\WindowsWelcomeCenter', 'REG_SZ', 'Vista,Seven', 'SUPPR'), 72 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Power\PowerSettings\A7066653-8D6C-40A8-910E-A1F54B84C7E5\ACSettingIndex', 'REG_DWORD', 'Vista,Seven', '2'), 73 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Power\PowerSettings\A7066653-8D6C-40A8-910E-A1F54B84C7E5\DCSettingIndex', 'REG_DWORD', 'Vista,Seven', '2'), 74 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Power\PowerSettings\94ac6d29-73ce-41a6-809f-6363ba21b47e\ACSettingIndex', 'REG_DWORD', 'Vista,Seven', '0'), 75 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Power\PowerSettings\94ac6d29-73ce-41a6-809f-6363ba21b47e\DCSettingIndex', 'REG_DWORD', 'Vista,Seven', '0'), 76 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Power\PowerSettings\\abfc2519-3608-4c2a-94ea-171b0ed546ab\ACSettingIndex', 'REG_DWORD', 'Vista,Seven', '0'), 77 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Power\PowerSettings\\abfc2519-3608-4c2a-94ea-171b0ed546ab\DCSettingIndex', 'REG_DWORD', 'Vista,Seven', '0'), 78 ('HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\ExcludeProfileDirs', 'REG_SZ', '2000,XP,Vista,Seven', 'Application Data;Temporary Internet Files;Historique;Temp;Credentials;Media Player;Windows Media;SystemCertificates;CrypnetUrlCache;Internet Explorer'), 79 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\KMPrintersAreBlocked', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 80 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Driver signing\BehaviorOnFailedVerify', 'REG_DWORD', 'Vista,Seven', '0'), 81 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverSearching\DontSearchWindowsUpdate', 'REG_DWORD', 'XP,Vista,Seven', '1'), 82 ('HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint\Restricted', 'REG_DWORD', 'XP,Vista,Seven', '0'), 83 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\{42B5FAAE-6536-11d2-AE5A-0000F87571E3}\NoGPOListChanges', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 84 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\{42B5FAAE-6536-11d2-AE5A-0000F87571E3}\NoSlowLink', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 85 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\{42B5FAAE-6536-11d2-AE5A-0000F87571E3}\NoBackgroundPolicy', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 86 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\{35378EAC-683F-11D2-A89A-00C04FBBCFA2}\NoBackgroundPolicy', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 87 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\{35378EAC-683F-11D2-A89A-00C04FBBCFA2}\NoGPOListChanges', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 88 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\{35378EAC-683F-11D2-A89A-00C04FBBCFA2}\NoSlowLink', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 89 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\SlowLinkDetectEnabled', 'REG_DWORD', '2000,XP,Vista,Seven', '0'), 90 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\HideFastUserSwitching', 'REG_DWORD', 'Vista,Seven', '1'), 91 ('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\DelayedDesktopSwitchTimeout', 'REG_DWORD', 'Vista,Seven', '5'), 92 ('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Mail\ManualLaunchAllowed', 'REG_DWORD', 'Vista,Seven', '0'), 93 ('HKEY_CURRENT_USER\Control Panel\Colors\Background', 'REG_SZ', 'XP', '58 110 165'), 94 ('HKEY_CURRENT_USER\Control Panel\Colors\MenuHilight', 'REG_SZ', 'XP', '49 106 197'), 95 ('HKEY_CURRENT_USER\Control Panel\Colors\Hilight', 'REG_SZ', 'XP', '49 106 197'), 96 ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager\ColorName', 'REG_SZ', 'XP', 'NormalColor'), 97 ('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveAutoRun', 'REG_DWORD', '2000,XP,Vista,Seven', '67108863')] 98 #TODO Remove all style keys, it's now ntuser.dat default! 99 firewall_keys = [('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\DoNotAllowExceptions', 'REG_DWORD', 'XP,Vista,Seven', '0'), 100 ('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\DoNotAllowExceptions', 'REG_DWORD', 'XP,Vista,Seven', '0')] 101 102 class se3GPO: 103 104 def __init__ (self, path2BatFiles, user, computer, arch, master): 105 """ 106 Open pol file 107 """ 108 try: 109 self.__gpoC = open ("%s/machine/%s/machine.pol" % (path2BatFiles, computer), 'wb') 110 self.__gpoU = open ("%s/machine/%s/user.pol" % (path2BatFiles, computer), 'wb') 111 self.__gpoC.write (self.__getDword (REGFILE_SIGNATURE)) 112 self.__gpoC.write (self.__getDword (REGFILE_VERSION)) 113 self.__gpoU.write (self.__getDword (REGFILE_SIGNATURE)) 114 self.__gpoU.write (self.__getDword (REGFILE_VERSION)) 115 self.__user = user 116 self.__computer = computer 117 self.__master = master 118 self.__arch = arch 119 120 except OSError: 121 print "Can't create gpo for %s/%s" % (user, computer) 122 sys.exit (1) 123 124 125 def __del__ (self): 126 """ 127 Close pol files 128 """ 129 try: 130 self.__gpoC.close() 131 self.__gpoU.close() 132 133 134 except OSError: 135 print "Can't create gpo for %s/%s" % (user, computer) 136 137 138 def __getByte (self, str): 139 """ 140 Return byte from string 141 """ 142 byte="" 143 if len(str)>1: 144 byte="%c" %int(str[0:2] ,16) 145 else: 146 byte="%c" % int(str[0]+'0', 16) 147 return byte 148 149 150 def __getDByte (self, str): 151 """ 152 Return dbyte from string 153 """ 154 if len(str)>2: 155 return self.__getByte(str[0:2]) + self.__getByte(str[2:]) 156 else: 157 return self.__getByte(str[0:2]) + self.__getByte("00") 158 159 160 def __getDchar (self, str): 161 l = len (str) 162 if l>1: 163 return "%c" % ord(str[0]) + "%c" % ord(str[1]) 164 elif l == 1: 165 return pack("H", ord(str[0])) 166 else: 167 return self.__getByte("00") 168 169 170 def __getDstring (self, str): 171 """ 172 Return gpo string format 173 """ 174 dstr="" 175 for c in str: 176 dstr+=self.__getDchar (c) 177 dstr += self.__getDByte("00") 178 return dstr 179 180 181 def __getDstring_semi (self, str): 182 """ 183 Return gpo string format with semi 184 """ 185 dstr="" 186 dstr = self.__getDstring(str) 187 dstr += self.__getDchar(';') 188 return dstr 189 190 191 def __getDword (self, str): 192 """ 193 Return dword 194 """ 195 word="" 196 for i in 0, 2, 4, 6: 197 word+="%c" % int(str[i:i+2] ,16) 198 return word[::-1] 199 200 201 def __getBinaryString(self, str): 202 """ 203 Return binary string 204 """ 205 string = "" 206 ristr = "" 207 istr = "%X" % int(str) 208 i = len (istr) 209 if i == 1: 210 i=0 211 ristr = '0' + istr 212 while i > 0: 213 ristr += istr[i-2:i] 214 i -= 2 215 if i != 0: 216 ristr += '0' + istr[0] 217 218 ristr += (8 - len(ristr)) * '0' 219 for i in 0, 2, 4, 6: 220 string += "%c" % int(ristr[i:i+2], 16) 221 222 return string 223 224 225 def __getIntSemi(self, i) : 226 """ 227 Return int with semi 228 """ 229 istr = "" 230 # Assuming 2 bytes max 231 tmp = i % 256; 232 istr += chr(tmp); 233 234 i -= tmp; 235 tmp = i / 256; 236 istr += chr(tmp); 237 238 istr += self.__getDByte("00") + self.__getDchar(";") 239 return istr 240 241 242 def __polStr (self, key, value, type, data): 243 """ 244 Return policy string for key value with type and data content 245 """ 246 polStr = "" 247 polStr += self.__getDchar ('[') 248 polStr += self.__getDstring_semi (key) 249 polStr += self.__getDstring_semi (value) 250 polStr += self.__getIntSemi (type) 251 if type == REG_SZ or type == REG_EXPAND_SZ or type == REG_MULTI_SZ: 252 polStr += self.__getIntSemi ((len(data)+1)*2) 253 polStr += self.__getDstring (data) 254 else: 255 polStr += self.__getIntSemi (REG_DWORD) 256 polStr += self.__getBinaryString (data) 257 polStr += self.__getDchar (']') 258 return polStr 259 260 261 # Local Vista GPO don't have default printer option, so, not useful as this. 262 #def addPrinters (self, printers): 263 # """ 264 # Add reg rules to pol 265 # """ 266 # try: 267 # printers_key="Software\Policies\Microsoft\Windows NT\Printers\PushedConnections\\" 268 # for printer in printers: 269 # hexdata = self.__polGetAddValHex (printers_key + printer, "printAttributes", REG_DWORD, "0") 270 # hexdata += self.__polGetAddValHex (printers_key + printer, "printerName", REG_SZ, printer) 271 # hexdata += self.__polGetAddValHex (printers_key + printer, "serverName", REG_SZ, "\\\\" + self.__master) 272 # hexdata += self.__polGetAddValHex (printers_key + printer, "uNCName", REG_SZ, "\\\\" + self.__master + "\\" + printer) 273 # self.__gpoU.write (hexdata) 274 # except: pass 275 276 277 def addRest (self, restrictions): 278 """ 279 Add reg rules to pol 280 """ 281 restrictions += folder_keys + default_keys + firewall_keys 282 try: 283 for rest in restrictions: 284 if rest[2] != "TOUS": 285 if self.__arch == "Win2K" and "2000" not in rest[2] : 286 continue 287 elif self.__arch == "WinXP" and "XP" not in rest[2] : 288 continue 289 elif self.__arch == "Vista" and "Vista" not in rest[2] : 290 continue 291 elif self.__arch == "Seven" and "Seven" not in rest[2] : 292 continue 293 294 firstbackslash = rest[0].find("\\") 295 lastbackslash = rest[0].rfind("\\") 296 key = rest[0][firstbackslash+1:lastbackslash] 297 value = rest[0][lastbackslash+1:] 298 299 if rest[1] == "REG_DWORD": 300 type = REG_DWORD 301 elif rest[1] == "REG_SZ": 302 type = REG_SZ 303 elif rest[1] == "REG_EXPAND_SZ": 304 type = REG_EXPAND_SZ 305 else: 306 continue # Unknown type 307 308 try: 309 if rest[3] == "SUPPR": 310 hexdata = self.__polStr (key, "**Del."+value, type, "0") 311 elif rest[3] == "DELKEY": 312 hexdata = self.__polStr (key, "**DeleteKeys\0", REG_SZ, value) 313 elif rest[3] == "UNPROTECT": 314 hexdata = self.__polStr (key, "**SecureKey", REG_DWORD, "0") 315 elif rest[3] == "PROTECT": 316 hexdata = self.__polStr (key, "**SecureKey", REG_DWORD, "1") 317 else: 318 hexdata = self.__polStr (key, value, type, rest[3]) 319 320 if rest[0].find("CURRENT_USER") != -1: 321 self.__gpoU.write (hexdata) 322 else: 323 self.__gpoC.write (hexdata) 324 except: 325 print "La clef %s\%s est invalide!" % (key,value) 326 327 except: pass
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |