--x86 and x64 compatible
--this script was intended to be private, where the fuck did you get it?
--well, I guess you're one of the guys whom I trust, don't fail me

import_meth=2;

oepbreaks=1;
unhookarray={};

function UnhookArrayList()
	ClearUnhookList();
	local z=1;
	while true do
		if unhookarray[z]==nil then
			break;
		end;
		AddModuleToUnhookList(unhookarray[z]);
		z=z+1;
	end;
end;

UnhookArrayList();
Start(false);
local breaksatoep=0;
AddBreak(jmp_to_oep+victim_base,3,0); EnableBreak(jmp_to_oep+victim_base);

--Win XP VMP detect VM
--WriteMem(GetProcAddress("ntdll.dll","NtOpenSection"),0x90000cc2,4);
--EmulateCPUID(1);
while true do
	Continue(false);
	if break_where==0xf40 then
		breaksatoep=breaksatoep+1;
		if breaksatoep==oepbreaks then
			break;
		else
			TraceAndReplace(EIP);
		end;
	elseif break_where==0xf12 then
		WriteLog(string.format("CPUID 0x%08X from 0x%08X ("..IdentifyAddressLib(EIP)..")",EAX,EIP));
		EmulateCPUID(0);
		Trace();
		EmulateCPUID(1);
	elseif break_where==0xf20 then
		local current_func=ReadMem(ESP,platform/8);
		WriteLog(string.format("Import function "..IdentifyFuncLib(current_func).."."..IdentifyFuncName(current_func).." from 0x%08X",ReadMem(ESP+platform/8,platform/8)));
	elseif break_where==0xf00 then
		break;
	end;
end;
Terminate();