作弊引擎偏移计算如何工作?

逆向工程 记忆 十六进制 地址 抵消 作弊引擎
2021-06-21 18:24:57

我有这个内存地址0F58F478和这个偏移量5C我正在使用内存锐利,当我添加这个数字时它工作得很好。

IntPtr address = _mSharp.Read<IntPtr>(0F58F478, false) + 0x5C;
// address output: 035F4E60

根据作弊引擎这将是结果035F4E60但我试过使用十六进制计算器,结果却大不相同。我想知道 MemorySharp 或 CheatEngine 如何计算这个总和。

在此处输入图片说明

请注意,当我向指针添加 0 时,它会更改其值,这是如何工作的?为什么 0 在那里增加价值?

在此处输入图片说明

1个回答

正如我评论的,如果您将 0x5c 添加到 0x0F58F478 并获得 0xf58f4d4,
这不是内存锐利或作弊引擎所做的

0x0xf58f4d4 是一个指针,是内存空间中的一个地址,
他们取消引用该指针并将 0x5c 添加到结果中

您的其他查询为什么添加 0 也属于同一类别添加 0 或 10 或 5c 或 100 或 987 并取消引用它们将始终提供基础值

还要注意方括号 [] 表示
没有方括号的取消引用表示直接添加,
如屏幕截图中的第一个条目所示

&a  = 0x0F58F478                            &a = __addressof(a);
*a  = 0x3454e04                             *a = value of a
 a  + 0x5c = 0xf58f4d4                      direct addition 
[a] + 0x5c = 0x3454e04+0x5c ==  0x3454e60   dereferenced addition
[a+ 0x5c] = [f58f4d4] = *f58f4d4 = some other value that is got by 
first adding  and then  dereferencing

由于这似乎是 c#,您应该尝试阅读有关不安全/装箱/拆箱等的信息,因为您似乎不知道指针、内存、取消引用等

这是powershell中的拳击示例

PS C:\> $a = 123                                                                                                        
PS C:\> $b = $a     b contains what was in $a viz 123                                                                                                    
PS C:\> $a = 456    a gets a new value and a new address                                                                                                      
PS C:\> $a,$b                                                                                                            
456
123
PS C:\>  

或在 c# 不安全构造中

:\>dir /b
unsafe.cs

:\>type unsafe.cs
using System;
class Program
{
static unsafe void Main()
{
   int var = 32;
   int* p = &var;
   Console.WriteLine("value is 0x{0:x}" , var);
   Console.WriteLine("address is 0x{0:x}" , (int)p);
   Console.WriteLine("dereferenced is 0x{0:x}" , (*p + 0x5c));
   Console.WriteLine("undereferenced is 0x{0:x}" , ((int)p + 0x5c));
   Console.WriteLine("somegarbage  is 0x{0:x}" , *((p + 0x5c)));
}
}
:\>csc unsafe.cs /unsafe
Microsoft (R) Visual C# Compiler version 2.10.0.0 (b9fb1610)
Copyright (C) Microsoft Corporation. All rights reserved.


:\>unsafe.exe
value is 0x20
address is 0x4feac4
dereferenced is 0x7c
undereferenced is 0x4feb20
somegarbage  is 0x0