Guest User

Detecting Cryptolocker

a guest
Nov 6th, 2013
1,489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' This VBS will search recursively from the StartKey downwards.
  2. ' This will not search upwards in the registry tree
  3. ' Use care when searching a large tree as it may consume CPU to do a large search.
  4. ' Output will be interactive, use cscript.exe if running locally in test
  5. ' Prior to load to iTWatch, change the value of SearchValue and the StartKey to ensure resources are not over utilized.
  6. ' Author: kstokes
  7. ' Version: 10.29.2013 9:24am
  8. ' Resources:
  9. ' http://www.cleanpcguide.com/remove-cryptolocker-ransomware-removal-guide-how-to-remove-cryptolocker-ransomware/
  10. ' http://stackoverflow.com/questions/15344498/search-registry-for-value-if-match-found-delete-parent-key
  11.  
  12. WScript.Echo ""
  13. WScript.Echo "START"
  14. Const HKCU = &H80000001  
  15. Const HKLM = &H80000002  
  16. Const HKU =  &H80000003
  17.  
  18. Const StartKey    = ""
  19. Const SearchKey = "System"
  20.  
  21. Set reg = GetObject("winmgmts://./root/default:StdRegProv")
  22. Set reg1 = GetObject("winmgmts://./root/default:StdRegProv")
  23. ' Gets a list of the top level of HKEY_USERs, and then looks in each for the directory
  24. ' Stored in array rootSIDs
  25. reg.EnumKey HKU, StartKey, rootSIDs
  26.  
  27.  
  28. If Not IsNull(rootSIDs) Then
  29.     For Each SID in rootSIDs
  30.         combined = SID & "\Software\"
  31.         WScript.Echo "Key: " & combined
  32.         'Get all subkeys of this key
  33.         reg1.enumKey HKU, combined, SIDSubKeys
  34.         If Not IsNull (SIDSubKeys) Then
  35.             For Each SubKey in SIDSubKeys
  36.                 WScript.Echo "-Subkey is: " & SubKey
  37.                     If SubKey = "CryptoLocker" Then
  38.                     WScript.Echo "------------------"
  39.                     WScript.Echo "ALERT, CRYPTOLOCKER FOUND"
  40.                     WScript.Echo "------------------"
  41.                     End If
  42.             Next
  43.         End If
  44.         If IsNull (SIDSubKeys) Then
  45.             WScript.Echo "SIDSubKeys is null"
  46.         End If     
  47.     Next
  48. End If
  49.  
  50. WScript.Echo "END"
Advertisement
Add Comment
Please, Sign In to add comment