Advertisement
Freebyte

Windows Registry change notification protoip

Feb 20th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.16 KB | None | 0 0
  1. ##RegChangeNotify Model.
  2. ##Script is run while loop and read current key.
  3. ##If key is changed scipt is gives \beep alert and change information.
  4. ##This is script is Model version.For helping big projects.
  5. ##For any issues please contact me:freebyte at bx dot az
  6. ##To distribute the code is prohbited.exception to the indicate address.
  7.  
  8.  
  9.  
  10. import winreg as R
  11. import sys,time
  12. ##Konstantlar.
  13. ##Default key const is HKEY_LOCAL_MACHINE
  14. ##Default access rights is (KeyRead)
  15. Access = (R.KEY_READ);
  16. ##Default subkey is (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run)
  17. subKey = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run';
  18. ##Global variable.
  19. ##This variable is receiving change notification.
  20. reserved = 0;
  21. surveillancebox_N = [];
  22. __values__integer = 0;
  23. hKey = R.OpenKey(R.HKEY_LOCAL_MACHINE,subKey,reserved,Access);
  24.  
  25.  
  26. def none_main():
  27.     global hKey
  28.     global __values__integer
  29.     number_of_sbkey = R.QueryInfoKey(hKey);
  30.     __values__integer = number_of_sbkey[1];
  31.  
  32.  
  33. ##print(__values__integer)  3
  34. def Enumeration():
  35.     global __values__integer;
  36.     global surveillancebox_N;
  37.     surveillancebox_N = [];
  38.     for _ in range(0, __values__integer):
  39.             surveillancebox_N.append(R.EnumValue(hKey,_)[0])
  40. none_main()
  41. Enumeration()
  42. #print(surveillancebox_N)   ['KernelFaultCheck', 'USB Antivirus', 's']
  43.  
  44. ##while (True > False):
  45. """
  46. test sector
  47. """
  48. print(surveillancebox_N)
  49. while (1 > 0)#1 0 dan boyuk oldugu hallarda while loop davam etdirilsin.
  50.     i = 0
  51.     none_main()
  52.     Enumeration()
  53.        
  54.     while (i == 0):
  55.         if R.QueryInfoKey(hKey)[1] > __values__integer:
  56.             time.sleep(0.5) ##Float deyer 0 onda 5 saniye
  57.             none_main()
  58.             ##Enumeration()
  59.             for _ in range(0, __values__integer):
  60.                 ##print(R.EnumValue(hKey,_)[0])
  61.                 if not R.EnumValue(hKey,_)[0] in surveillancebox_N:
  62.                     print(time.asctime() + '\t\aChanged.new value is:\t' + R.EnumValue(hKey,_)[0])
  63.             Enumeration()
  64.             i += 1
  65.         else:
  66.                 if R.QueryInfoKey(hKey)[1] < __values__integer:
  67.                     time.sleep(0.5) ##Float deyer 0 onda 5 saniye
  68.                     #Enumeration()
  69.                     tmp = (surveillancebox_N)   ##['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1', 'Новый параметр #2']
  70.                     none_main()
  71.                     Enumeration()
  72.                     #print(surveillancebox_N)   ##['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1']
  73.                     '''
  74.                     ['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1', 'Новый параметр #3', 'Новый параметр #4']
  75. ['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1', 'Новый параметр #4']
  76. ['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1', 'Новый параметр #3', 'Новый параметр #4']
  77. '''
  78.                     for x in range(0, len(tmp)):
  79.                         if not tmp[x] in surveillancebox_N:
  80.                             print(time.asctime() + '\t\aChanged.deleted value is:\t' + tmp[x])
  81.                     i += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement