Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##RegChangeNotify Model.
- ##Script is run while loop and read current key.
- ##If key is changed scipt is gives \beep alert and change information.
- ##This is script is Model version.For helping big projects.
- ##For any issues please contact me:freebyte at bx dot az
- ##To distribute the code is prohbited.exception to the indicate address.
- import winreg as R
- import sys,time
- ##Konstantlar.
- ##Default key const is HKEY_LOCAL_MACHINE
- ##Default access rights is (KeyRead)
- Access = (R.KEY_READ);
- ##Default subkey is (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run)
- subKey = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run';
- ##Global variable.
- ##This variable is receiving change notification.
- reserved = 0;
- surveillancebox_N = [];
- __values__integer = 0;
- hKey = R.OpenKey(R.HKEY_LOCAL_MACHINE,subKey,reserved,Access);
- def none_main():
- global hKey
- global __values__integer
- number_of_sbkey = R.QueryInfoKey(hKey);
- __values__integer = number_of_sbkey[1];
- ##print(__values__integer) 3
- def Enumeration():
- global __values__integer;
- global surveillancebox_N;
- surveillancebox_N = [];
- for _ in range(0, __values__integer):
- surveillancebox_N.append(R.EnumValue(hKey,_)[0])
- none_main()
- Enumeration()
- #print(surveillancebox_N) ['KernelFaultCheck', 'USB Antivirus', 's']
- ##while (True > False):
- """
- test sector
- """
- print(surveillancebox_N)
- while (1 > 0): #1 0 dan boyuk oldugu hallarda while loop davam etdirilsin.
- i = 0
- none_main()
- Enumeration()
- while (i == 0):
- if R.QueryInfoKey(hKey)[1] > __values__integer:
- time.sleep(0.5) ##Float deyer 0 onda 5 saniye
- none_main()
- ##Enumeration()
- for _ in range(0, __values__integer):
- ##print(R.EnumValue(hKey,_)[0])
- if not R.EnumValue(hKey,_)[0] in surveillancebox_N:
- print(time.asctime() + '\t\aChanged.new value is:\t' + R.EnumValue(hKey,_)[0])
- Enumeration()
- i += 1
- else:
- if R.QueryInfoKey(hKey)[1] < __values__integer:
- time.sleep(0.5) ##Float deyer 0 onda 5 saniye
- #Enumeration()
- tmp = (surveillancebox_N) ##['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1', 'Новый параметр #2']
- none_main()
- Enumeration()
- #print(surveillancebox_N) ##['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1']
- '''
- ['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1', 'Новый параметр #3', 'Новый параметр #4']
- ['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1', 'Новый параметр #4']
- ['KernelFaultCheck', 'USB Antivirus', 'Новый параметр #1', 'Новый параметр #3', 'Новый параметр #4']
- '''
- for x in range(0, len(tmp)):
- if not tmp[x] in surveillancebox_N:
- print(time.asctime() + '\t\aChanged.deleted value is:\t' + tmp[x])
- i += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement