Hola, es interesante el tema de modificar variables de un programa desde otro, accediendo y retocando "on the fly" la memoria que usa este programa "servidor" mientras está trabajando, con el NOMADMemory.au3. Al final puede ser como modificar un doc del Word, pero más delicado claro, y con otras consecuencias.
Igual si deseas comentar que cambios concretos en las variables se hacen, y como afecta al bucle o función original del programa que está corriendo y en que lo cambia, podría ser interesante para informar a los users para poder mejorar programas con funcionamiento no deseado, o para retocar otros en funcionamiento.
Aqui el código principal:
Código: Seleccionar todo
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.0.0
Author: BugCraft (Also Karliky) [email protected]
<ADT Class | An "Autoit Script" made for change some things into WarHammer>
Copyright (C) <2010> <BugCraft> Also Karliky ([email protected])
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Note about the Author:
Please don't use this app to obtain benefits better than other players
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#ce ----------------------------------------------------------------------------
;===============================================================================
;Includes
;===============================================================================
#RequireAdmin
#include <functions.au3>
#include <nomadmemory.au3>
#include <GDIPlus.au3>
#include <misc.au3>
#include <guilistbox.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
SetPrivilege("SeDebugPrivilege", 1)
$DLL = DllOpen("user32.dll")
Global $Proceso = _MemoryOpen(ProcessExists("war.exe"))
#include <offsets.au3>
;===============================================================================
;Funciones
;===============================================================================
Global $State_Speed = 0,$State_Fly = 0,$State_SuperJump = 0,$State_Transparency = 0,$State_Ninja = 0,$LastPos = "9900990"
;===============================================================================
;Funciones
;===============================================================================
HotKeySet("{F1}","PlayerScale")
HotKeySet("{F2}","PlayerZPosition")
HotKeySet("{F3}","PlayerXPosition")
HotKeySet("{F4}","PlayerYPosition")
HotKeySet("{F5}","Speedhack")
HotKeySet("{F6}","SuperJump")
HotKeySet("{F7}","Fly")
HotKeySet("{F8}","Ninja")
HotKeySet("{F9}","Transparency")
HotKeySet("{F10}","CameraZ")
HotKeySet("{F11}","CameraDist")
;===============================================================================
;USER INTERFACE
;===============================================================================
_GDIPlus_Startup()
$BackGround = "images/gui.png"
$Image_Handle = _GDIPlus_ImageLoadFromFile($BackGround)
$Width = _GDIPlus_ImageGetWidth($Image_Handle)
$Height = _GDIPlus_ImageGetHeight($Image_Handle)
$GUI = GUICreate("BugCraft's WarHacker Tool", $Width, $Height,-1,-1, $WS_POPUP, $WS_EX_LAYERED)
SetBitmap($GUI, $Image_Handle, 0)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()
For $i = 0 To 255 Step 10
SetBitmap($GUI, $Image_Handle, $i)
Next
$controlGui = GUICreate("ControlGUI", $Width, $Height,0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)
GUICtrlCreatePic("images/grey.gif", 0, 0, $Width, $Height)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetColor(-1, 0xFFFFFF)
;=====================================================
$List_Information = GUICtrlCreateList("", 16, 88, 321, 84,BitOR($WS_VSCROLL,$WS_BORDER,$LBS_NOSEL,$LBS_DISABLENOSCROLL ))
GUICtrlSetLimit(-1, 9999)
Global $Button_Speed = GUICtrlCreateCheckbox("Speed Hack",352, 88, 81, 17,bitor($BS_PUSHLIKE,$BS_FLAT))
GUICtrlSetBkColor(-1,0xffffff)
Global $Button_Jump = GUICtrlCreateCheckbox("Super Jump", 352, 104, 81, 17,bitor($BS_PUSHLIKE,$BS_FLAT))
GUICtrlSetBkColor(-1,0xffffff)
Global $Button_Fly = GUICtrlCreateCheckbox("Fly", 352, 120, 81, 17,bitor($BS_PUSHLIKE,$BS_FLAT))
GUICtrlSetBkColor(-1,0xffffff)
Global $Button_Transparency = GUICtrlCreateCheckbox("Transparency", 352, 136, 81, 17,bitor($BS_PUSHLIKE,$BS_FLAT))
GUICtrlSetBkColor(-1,0xffffff)
Global $Button_Ninja = GUICtrlCreateCheckbox("Ninja!", 352, 152, 81, 17,bitor($BS_PUSHLIKE,$BS_FLAT))
GUICtrlSetBkColor(-1,0xffffff)
Global $Label_Health = GUICtrlCreateLabel("Health", 16, 64, 35, 17)
GUICtrlSetBkColor(-1,0xffffff)
Global $Label_Energy = GUICtrlCreateLabel("Energy", 192, 64, 37, 17)
GUICtrlSetBkColor(-1,0xffffff)
Global $Progress_Health = GUICtrlCreateProgress(56, 64, 105, 17)
Global $Progress_Energy = GUICtrlCreateProgress(232, 64, 105, 17)
;=====================================================
GUISetState()
Update_List("Welcome to BugCraft's WarTool")
Update_List("Check out for new updates http://www.nogg-aholic.es")
Update_List("")
Update_List("Have fun! ._ .")
While 1
;LoopFuntions
if (GUICtrlRead($Button_Fly) == 1) Then
_MemoryWrite($Player_Fly, $Proceso,150, 'float')
EndIf
if (GUICtrlRead($Button_Jump) == 1) Then
_MemoryWrite($Player_SuperJump, $Proceso,900, 'float')
EndIf
GUICtrlSetData($Progress_Health,_MemoryRead($Player_Health, $Proceso, 'Int')*100/_MemoryRead($Player_Health_Actual, $Proceso, 'int'))
GUICtrlSetData($Progress_Energy,_MemoryRead($Player_Energy, $Proceso, 'Int')*100/_MemoryRead($Player_Energy_Actual, $Proceso, 'int'))
;
$nMsg = GUIGetMsg()
Switch $nMsg
case $Button_Speed
Speedhack()
case $Button_Fly
Fly()
case $Button_Jump
SuperJump()
case $Button_Ninja
Ninja()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Aquí el código de las funciones concretas que se llaman desde el principal,
Código: Seleccionar todo
;===============================================================================
;Update list
;===============================================================================
Global $ListCount = 1
Func Update_List($String)
_GUICtrlListBox_AddString($List_Information,$String)
$LAST = _GUICtrlListBox_GetCount($List_Information)
_GUICtrlListBox_SetCaretIndex($List_Information,$LAST,True)
$iIndex = _GUICtrlListBox_GetCaretIndex($List_Information)
_GUICtrlListBox_SetCurSel($List_Information,$LAST-1)
$ListCount = $ListCount + 1
EndFunc
;===============================================================================
;SPEED HACK
;===============================================================================
Func Speedhack()
If $State_Speed == 0 Then
GUICtrlSetState($Button_Speed,$GUI_CHECKED)
_MemoryWrite($Player_Speed_Hack, $Proceso,5, 'float')
$State_Speed = 1
Update_List("SpeedHack enabled")
Else
GUICtrlSetState($Button_Speed,$GUI_UNCHECKED)
_MemoryWrite($Player_Speed_Hack, $Proceso,1, 'float')
$State_Speed = 0
Update_List("SpeedHack disabled")
EndIf
EndFunc
;===============================================================================
;NINJA
;===============================================================================
Func Ninja()
If $State_Ninja == 0 Then
GUICtrlSetState($Button_Ninja,$GUI_CHECKED)
_MemoryWrite($Ninja_Mode, $Proceso,-9000, 'float')
$State_Ninja = 1
Update_List("Ninja enabled")
Else
GUICtrlSetState($Button_Ninja,$GUI_UNCHECKED)
_MemoryWrite($Ninja_Mode, $Proceso,1, 'float')
$State_Ninja = 0
Update_List("Ninja disabled")
EndIf
EndFunc
;===============================================================================
;Fly HACK
;===============================================================================
Func Fly()
If $State_Fly == 0 Then
GUICtrlSetState($Button_Fly,$GUI_CHECKED)
$State_Fly = 1
Update_List("Fly enabled")
Else
GUICtrlSetState($Button_Fly,$GUI_UNCHECKED)
_MemoryWrite($Player_Fly, $Proceso,0, 'float')
$State_Fly = 0
Update_List("Fly disabled")
EndIf
EndFunc
;===============================================================================
;Super jump HACK
;===============================================================================
Func SuperJump()
If $State_SuperJump == 0 Then
GUICtrlSetState($Button_Jump,$GUI_CHECKED)
$State_SuperJump = 1
Update_List("Super jump enabled")
Else
GUICtrlSetState($Button_Jump,$GUI_UNCHECKED)
_MemoryWrite($Player_SuperJump, $Proceso,0, 'float')
$State_SuperJump = 0
Update_List("Super jump disabled")
EndIf
EndFunc
;===============================================================================
;PlayerScale HACK
;===============================================================================
func PlayerScale()
$Pos = MouseGetPos()
if $LastPos == "9900990" Then
Else
if $Pos[1] == $LastPos Then
Else
if $Pos[1] > $LastPos Then
$ScaleActual = _MemoryRead($Player_CONFG_Scale, $Proceso, 'float')
_MemoryWrite($Player_CONFG_Scale, $Proceso,$ScaleActual - 0.1, 'float')
Update_List("Scale "&$ScaleActual - 0.1)
Else
$ScaleActual = _MemoryRead($Player_CONFG_Scale, $Proceso, 'float')
_MemoryWrite($Player_CONFG_Scale, $Proceso,$ScaleActual + 0.1, 'float')
Update_List("Scale "&$ScaleActual + 0.1)
EndIf
EndIf
EndIf
$LastPos = $Pos[1]
EndFunc
;===============================================================================
;Player Z Position HACK
;===============================================================================
func PlayerZPosition()
$Pos = MouseGetPos()
if $LastPos == "9900990" Then
Else
if $Pos[1] == $LastPos Then
Else
if $Pos[1] > $LastPos Then
$ZActual = _MemoryRead($Player_CONFG_Z_Position, $Proceso, 'float')
_MemoryWrite($Player_CONFG_Z_Position, $Proceso,$ZActual + 10, 'float')
Update_List("Position Z "&$ZActual + 10)
Else
$ZActual = _MemoryRead($Player_CONFG_Z_Position, $Proceso, 'float')
_MemoryWrite($Player_CONFG_Z_Position, $Proceso,$ZActual -10, 'float')
Update_List("Position Z "&$ZActual - 10)
EndIf
EndIf
EndIf
$LastPos = $Pos[1]
EndFunc
;===============================================================================
;Player X Position HACK
;===============================================================================
func PlayerXPosition()
$Pos = MouseGetPos()
if $LastPos == "9900990" Then
Else
if $Pos[1] == $LastPos Then
Else
if $Pos[1] > $LastPos Then
$XActual = _MemoryRead($Player_CONFG_X_Position, $Proceso, 'float')
_MemoryWrite($Player_CONFG_X_Position, $Proceso,$XActual + 20, 'float')
Update_List("Position x "&$XActual + 20)
Else
$XActual = _MemoryRead($Player_CONFG_X_Position, $Proceso, 'float')
_MemoryWrite($Player_CONFG_X_Position, $Proceso,$XActual - 20, 'float')
Update_List("Position x "&$XActual - 20)
EndIf
EndIf
EndIf
$LastPos = $Pos[1]
EndFunc
;===============================================================================
;Player Y Position HACK
;===============================================================================
func PlayerYPosition()
$Pos = MouseGetPos()
if $LastPos == "9900990" Then
Else
if $Pos[0] == $LastPos Then
Else
if $Pos[0] > $LastPos Then
$YActual = _MemoryRead($Player_CONFG_Y_Position, $Proceso, 'float')
_MemoryWrite($Player_CONFG_Y_Position, $Proceso,$YActual - 20, 'float')
Update_List("Position y "&$YActual - 20)
Else
$YActual = _MemoryRead($Player_CONFG_Y_Position, $Proceso, 'float')
_MemoryWrite($Player_CONFG_Y_Position, $Proceso,$YActual + 20, 'float')
Update_List("Position y "&$YActual + 20)
EndIf
EndIf
EndIf
$LastPos = $Pos[0]
EndFunc
;===============================================================================
;Camera Z
;===============================================================================
func CameraZ()
$Pos = MouseGetPos()
if $LastPos == "9900990" Then
Else
if $Pos[1] == $LastPos Then
Else
if $Pos[1] > $LastPos Then
$ZActual = _MemoryRead($Camera_Altitude, $Proceso, 'float')
_MemoryWrite($Camera_Altitude, $Proceso,$ZActual - 20, 'float')
Update_List("Camera Z "&$ZActual - 30)
Else
$ZActual = _MemoryRead($Camera_Altitude, $Proceso, 'float')
_MemoryWrite($Camera_Altitude, $Proceso,$ZActual + 20, 'float')
Update_List("Camera Z "&$ZActual + 30)
EndIf
EndIf
EndIf
$LastPos = $Pos[1]
EndFunc
;===============================================================================
;Camera Distance
;===============================================================================
func CameraDist()
$Pos = MouseGetPos()
if $LastPos == "9900990" Then
Else
if $Pos[1] == $LastPos Then
Else
if $Pos[1] > $LastPos Then
$ALTActual = _MemoryRead($Camera_Z, $Proceso, 'float')
_MemoryWrite($Camera_Z, $Proceso,$ALTActual - 20, 'float')
Update_List("Cam Altitude "&$ALTActual - 20)
Else
$ALTActual = _MemoryRead($Camera_Z, $Proceso, 'float')
_MemoryWrite($Camera_Z, $Proceso,$ALTActual + 20, 'float')
Update_List("Cam Altitude "&$ALTActual + 20)
EndIf
EndIf
EndIf
$LastPos = $Pos[1]
EndFunc
;===============================================================================
;Transparency
;===============================================================================
func Transparency()
If $State_Transparency == 0 Then
GUICtrlSetState($Button_Transparency,$GUI_CHECKED)
_MemoryWrite($Camera_Transparency, $Proceso,999999, 'float')
$State_Transparency = 1
Update_List("Transparency enabled")
Else
GUICtrlSetState($Button_Transparency,$GUI_UNCHECKED)
_MemoryWrite($Camera_Transparency, $Proceso,1, 'float')
$State_Transparency = 0
Update_List("Transparency disabled")
EndIf
EndFunc
;===============================================================================
;Funciones
;===============================================================================
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;La funcion setbitmap cambia las propiedades de opacidad del GUI, en toda la aplicacion se usa mediante un bucle FOR, que es incrementado hasta 255.
;La linea que se encarga de cambiar la opacidad es DllStructSetData($tBlend, "Alpha", $iOpacity)
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func SetBitmap($hGUI, $hImage, $iOpacity)
Sleep(20)
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
Local Const $AC_SRC_ALPHA = 1
$hScrDC = _WinAPI_GetDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;Esta funcion permite mover el GUI por la pantalla
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc
Gracias por la información,
Salu22:)