Página 1 de 1

Antis

Publicado: 26 Jul 2014, 16:55
por Blau
Hola,

he estado mirando el blog de McAfee y como son tan listos muestran trocitos de códigos de piezas de malware que analizan. He traducido algunos a AutoIt.

Código: Seleccionar todo

#include <WinAPI.au3>
Func SampleName()
   If StringCompare(@ScriptName, "sample.exe") Then
	  Exit
   EndIf
EndFunc

Func AntiThreatExpert()
   $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2")
   $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk")
   For $objItem In $colItems
	  If $objItem.VolumeSerialNumber = 0xCD1A40 Or $objItem.VolumeSerialNumber = 0x70144646  Then
		 Exit
	  EndIf
   Next
EndFunc

Func AntiVMWare()
   $regRead = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Disk\Enum", "0")
   If StringInStr(StringLower($regRead), "vmware") > 0 Then
	  Exit
   EndIf
EndFunc

Func FindWindows()
   Local $sWindows = "gdkWindowTopLevel|PROCEXPL|PROCMON_WINDOW_CLASS|TCPViewClass|ThunderRT6FormDC|OllyDBG|Autoruns"
   Local $sWindowsArray = StringSplit($sWindows, "|")
   For $i = 1 To $sWindowsArray[0]
	  If WinGetTitle ($sWindowsArray[$i]) Then
		 Exit
	  EndIf
   Next
EndFunc

Func IsDebugging() ;http://www.autoitscript.com/forum/topic/17259-would-this-dll-call-work/
   Local $Ret = DLLCall('Kernel32.dll', 'Int', 'IsDebuggerPresent')
   If $Ret > 0 Then
	  Exit
   EndIf
EndFunc

Func ModuleHandle()
   Local $sModules = "sbiedll|dbghelp|api_log|dir_watch|pstorec|vmcheck|wpespy"
   Local $sModulesArray = StringSplit($sModules, "|")
   For $i = 1 To $sModulesArray[0]
	  If _WinAPI_GetModuleHandle($sModulesArray[$i] & ".dll")> 0 Then
		 Exit
	  EndIf
   Next
EndFunc
Los he hecho un poco rápido así que seguramente se puedan mejorar/optimizar.