feat(Security): Added RageSecurity class (#79)
This commit is contained in:
parent
6d8c0e6ede
commit
257115997e
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../rage/rlMetric.hpp"
|
#include "../rage/rlMetric.hpp"
|
||||||
#include "../security/Obf32.hpp"
|
#include "../security/ObfVar.hpp"
|
||||||
#include "CNetComplaintMgr.hpp"
|
#include "CNetComplaintMgr.hpp"
|
||||||
#include "snSession.hpp"
|
#include "snSession.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -171,8 +171,8 @@ class Network
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class rage::rlSessionInfo m_session_info; //0x0000
|
class rage::rlSessionInfo m_session_info; //0x0000
|
||||||
class Obf32 m_num_dinput8_instances; //0x0070
|
rage::Obf32 m_num_dinput8_instances; //0x0070
|
||||||
class Obf32 m_last_time_dinput8_checked; //0x0080
|
rage::Obf32 m_last_time_dinput8_checked; //0x0080
|
||||||
class rage::snSession* m_game_session_ptr; //0x0090
|
class rage::snSession* m_game_session_ptr; //0x0090
|
||||||
class rage::snSession* m_transition_session_ptr; //0x0098
|
class rage::snSession* m_transition_session_ptr; //0x0098
|
||||||
char pad_00A0[24]; //0x00A0
|
char pad_00A0[24]; //0x00A0
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
class Obf32
|
|
||||||
{
|
|
||||||
std::uint32_t a;
|
|
||||||
std::uint32_t b;
|
|
||||||
std::uint32_t c;
|
|
||||||
std::uint32_t d;
|
|
||||||
|
|
||||||
public:
|
|
||||||
inline void operator=(std::uint32_t val)
|
|
||||||
{
|
|
||||||
a = val & d;
|
|
||||||
b = val & ~d;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline operator std::uint32_t()
|
|
||||||
{
|
|
||||||
return (a & d) | (b & ~d);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
static_assert(sizeof(Obf32) == 0x10);
|
|
||||||
#pragma pack(pop)
|
|
51
security/ObfVar.hpp
Normal file
51
security/ObfVar.hpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace rage
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
class ObfVar
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
T m_unk1;
|
||||||
|
T m_unk2;
|
||||||
|
T m_unk3;
|
||||||
|
T m_unk4;
|
||||||
|
|
||||||
|
public:
|
||||||
|
T getData()
|
||||||
|
{
|
||||||
|
auto v105 = m_unk4;
|
||||||
|
auto v28 = m_unk1 & v105;
|
||||||
|
auto v94 = m_unk2 & ~v105;
|
||||||
|
return v28 | v94;
|
||||||
|
}
|
||||||
|
|
||||||
|
operator T ()
|
||||||
|
{
|
||||||
|
return getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
void setData(T val)
|
||||||
|
{
|
||||||
|
auto seed = time(nullptr);
|
||||||
|
m_unk3 = seed;
|
||||||
|
seed = time(nullptr);
|
||||||
|
m_unk4 = seed;
|
||||||
|
|
||||||
|
auto v48 = val & ~seed;
|
||||||
|
m_unk1 = seed & val;
|
||||||
|
m_unk2 = v48;
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator =(T val)
|
||||||
|
{
|
||||||
|
setData(val);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
using Obf16 = ObfVar<unsigned short>;
|
||||||
|
using Obf32 = ObfVar<unsigned int>;
|
||||||
|
}
|
12
security/RageSecurity.hpp
Normal file
12
security/RageSecurity.hpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ObfVar.hpp"
|
||||||
|
|
||||||
|
namespace rage
|
||||||
|
{
|
||||||
|
class RageSecurity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Obf32 m_lastRun;
|
||||||
|
Obf32 m_interval;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user