[Only registered and activated users can see links. Click Here To Register...]
^Better UDF ( my opinion )
^This include also better Function and support AoBs with jmps,calls..etc.
Code:
SetPrivilege("Sedebugprivilege", 1)
Func SetPrivilege( $privilege, $bEnable )
Local $hToken, $SP_auxret, $SP_ret, $hCurrProcess, $nTokens, $nTokenIndex, $priv
$nTokens = 1
$LUID = DLLStructCreate("dword;int")
If IsArray($privilege) Then $nTokens = UBound($privilege)
$TOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
$NEWTOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
$hCurrProcess = DLLCall("kernel32.dll","hwnd","GetCurrentProcess")
$SP_auxret = DLLCall("advapi32.dll","int","OpenProcessToken","hwnd",$hCurrProcess[0], _
"int",BitOR($TOKEN_ADJUST_PRIVILEGESS,$TOKEN_QUERYY),"int_ptr",0)
If $SP_auxret[0] Then
$hToken = $SP_auxret[3]
DLLStructSetData($TOKEN_PRIVILEGES,1,1)
$nTokenIndex = 1
While $nTokenIndex <= $nTokens
If IsArray($privilege) Then
$priv = $privilege[$nTokenIndex-1]
Else
$priv = $privilege
EndIf
$ret = DLLCall("advapi32.dll","int","LookupPrivilegeValue","str","","str",$priv, _
"ptr",DLLStructGetPtr($LUID))
If $ret[0] Then
If $bEnable Then
DLLStructSetData($TOKEN_PRIVILEGES,2,$SE_PRIVILEGE_ENABLEDD,(3 * $nTokenIndex))
Else
DLLStructSetData($TOKEN_PRIVILEGES,2,0,(3 * $nTokenIndex))
EndIf
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,1),(3 * ($nTokenIndex-1)) + 1)
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,2),(3 * ($nTokenIndex-1)) + 2)
DLLStructSetData($LUID,1,0)
DLLStructSetData($LUID,2,0)
EndIf
$nTokenIndex += 1
WEnd
$ret = DLLCall("advapi32.dll","int","AdjustTokenPrivileges","hwnd",$hToken,"int",0, _
"ptr",DllStructGetPtr($TOKEN_PRIVILEGES),"int",DllStructGetSize($NEWTOKEN_PRIVILEGES), _
"ptr",DllStructGetPtr($NEWTOKEN_PRIVILEGES),"int_ptr",0)
$f = DLLCall("kernel32.dll","int","GetLastError")
EndIf
$NEWTOKEN_PRIVILEGES=0
$TOKEN_PRIVILEGES=0
$LUID=0
If $SP_auxret[0] = 0 Then Return 0
$SP_auxret = DLLCall("kernel32.dll","int","CloseHandle","hwnd",$hToken)
If Not $ret[0] And Not $SP_auxret[0] Then Return 0
return $ret[0]
EndFunc ;==>SetPrivilege
You didn't should use 4 Bytes for writing assembler..
[Only registered and activated users can see links. Click Here To Register...]
^Quelle :
[Only registered and activated users can see links. Click Here To Register...]
If you need to write one byte you don't need to use four bytes..
Array of Bytes
Array of Bytes = sequence of bytes
Example :
(Show HP of Mates)
C6 41 14 00 83 7D E8 00 0F 85
Bytes = duh ?
Opcode = Operation Code ( Assembly Code )
[Only registered and activated users can see links. Click Here To Register...]
The Jmp don't need because this sequence of bytes give us only one result.
This mean this sequence of bytes is only one time in the assembly code.
If we want to include this jmp ( jne = jump if not equal ) we need to ignore the bytes of the jmp
[Only registered and activated users can see links. Click Here To Register...]
it will change after a patch.
C6 41 14 00 83 7D E8 00 0F 85 ?? ?? ?? ?? 8B 55 EC
[Only registered and activated users can see links. Click Here To Register...]
^to this i don't need to say more ( the most will not understand )
Usage ( Autoit )
[Only registered and activated users can see links. Click Here To Register...]
In this Function you got one change
Code:
_MemoryScanEx($ah_Handle, $pattern, $mask , $after = False, $iv_addrStart = 0x00400000, $iv_addrEnd = 0x00FFFFFF, $step = 51200)
huh ? wut is mask ?
$handle = huh ? brain afk ?
$pattern = '\xC6\x41\x14\x00\x83\x7D\xE8\x00\x0F\x85\x00\x00\ x00\x00 \x8B\x55\xEC'
$mask = 'xxxxxxxxxx????xxx'
..
i hope you can understand. i am sorry for my bad english :)