Advertisement
Guest User

Scan for CryptoLocker

a guest
Oct 13th, 2013
4,078
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #
  2. # What this does:
  3. #   Finds out if CryptoLocker has infected pc's on the network by looking for a registery in the HKEY_USER hive. Maybe able to use for terminal servers too.
  4. #   If you find it:
  5. #      Go to the machine and extract the registry [HKEY_CURRENT_USER\Software\CryptoLocker\Files]. This gives you a list of files that have been encrypted.
  6. #      Use combo fix to clean it
  7. #      Recover files that have been affected from backups.
  8. #
  9. # How to use this script:
  10. #    Create a file called C:\listofcomputers.txt with a list of pc names
  11. #    You need to be an administrator on the pc's
  12. #    Remote Registry service needs to be running on the PC
  13. #
  14. # Output:
  15. #   Computer name, Status
  16. #   Status Values
  17. #         Null  - Machine is not available
  18. #         True  - Machine has the register entry we are looking for
  19. #         False - Changes are we are safe.
  20. #
  21. #
  22. # Tested on:
  23. #    Windows 7
  24. #
  25.  
  26. $Type = [Microsoft.Win32.RegistryHive]::Users
  27.  
  28. $ComputerNames = Get-content C:\listofcomputers.txt
  29. foreach($ComputerName in $ComputerNames)
  30. {
  31.     $Status = $null  #if machine is not available
  32.     if(Test-Connection $ComputerName -Quiet)
  33.     {
  34.         $Status = $false
  35.         $SubKeyNames = $null
  36.         $regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($Type, $ComputerName)
  37.         $subKeys = $regKey.GetSubKeyNames()
  38.  
  39.         $subKeys | %{
  40.             $key = "$_\software"
  41.  
  42.             Try
  43.             {
  44.                 $regSubKey = $regKey.OpenSubKey($Key)
  45.                 $SubKeyNames = $regSubKey.GetSubKeyNames()
  46.                 if($SubKeyNames -match "CryptoLocker")
  47.                 {
  48.                     $Status = $true
  49.                 }
  50.  
  51.             }
  52.             Catch{}        
  53.         }
  54.     }
  55.    
  56.     $log = New-Object PSObject -Property @{
  57.         ComputerName = $ComputerName
  58.         Status = $Status
  59.     }  
  60.    
  61.     $log     
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement