Skocz do zawartości
1 maja :: Święto Pracy / 2 maja :: Dzień Flagi / 3 maja :: Święto Konstytucji

[Rust] memory.h


Przejdź do rozwiązania Rozwiązane przez MrPejs,
# CSH External VIP Project

Masz dosyć problemów z czynnikiem zaufania w CS2 lub notorycznymi banami?

Sprawdź CSH External VIP Project.


Więcej informacji  

Rekomendowane odpowiedzi

@cruisy klasę do odczytywania pamięci musisz sobie sam napisać, aby była ona kompatybilna z twoim bypassem anticheata rusta

 

A gotowe klasy ułatwiające korzystanie z wektorów masz dostępne w Internecie na każdym kroku

class Vector2
{
public:
	float x, y;

	Vector2() { };

	Vector2(float x, float y)
	{
		this->x = x;
		this->y = y;
	};

	bool is_valid()
	{
		return (x != 0 && y != 0);
	}

	float length() const
	{
		return sqrt((x * x) + (y * y));
	}

	float distance(Vector2 b)
	{
		return sqrt(pow(b.x - x, 2) + pow(b.y - y, 2));
	}

	void normalize()
	{

		if (x < -89)
			x = -89;


		else if (x > 89)
			x = 89;


		if (y < -360)
			y += 360;


		else if (y > 360)
			y -= 360;
	}

	Vector2& operator*=(float input)
	{
		x *= input;
		y *= input;
		return *this;
	}
};

class Vector3
{
public:
	Vector3()
	{
		x = y = z = 0.f;
	}

	Vector3(float fx, float fy, float fz)
	{
		x = fx;
		y = fy;
		z = fz;
	}

	float x, y, z;

	Vector3 operator+(const Vector3& input) const
	{
		return Vector3{ x + input.x, y + input.y, z + input.z };
	}

	Vector3 operator-(const Vector3& input) const
	{
		return Vector3{ x - input.x, y - input.y, z - input.z };
	}

	Vector3 operator/(float input) const
	{
		return Vector3{ x / input, y / input, z / input };
	}

	Vector3 operator*(float input) const
	{
		return Vector3{ x * input, y * input, z * input };
	}

	Vector3& operator+=(const Vector3& v)
	{
		x += v.x;
		y += v.y;
		z += v.z;

		return *this;
	}

	Vector3& operator-=(const Vector3& v)
	{
		x -= v.x;
		y -= v.y;
		z -= v.z;

		return *this;
	}

	Vector3& operator/=(float input)
	{
		x /= input;
		y /= input;
		z /= input;
		return *this;
	}

	Vector3& operator*=(float input)
	{
		x *= input;
		y *= input;
		z *= input;
		return *this;
	}

	bool operator==(const Vector3& input) const
	{
		return x == input.x && y == input.y && z == input.z;
	}

	void make_absolute()
	{
		x = std::abs(x);
		y = std::abs(y);
		z = std::abs(z);
	}

	float clamp0to1(float value)
	{
		float result;
		if (value < 0)
		{
			result = 0;
		}
		else if (value > 1.f)
		{
			result = 1.f;
		}
		else
		{
			result = value;
		}
		return result;
	}

	float Lerp()
	{
		return x + (y - x) * clamp0to1(z);
	}

	float length_sqr() const
	{
		return (x * x) + (y * y) + (z * z);
	}

	float length() const
	{
		return (float)sqrt(length_sqr());
	}

	float length_2d() const
	{
		return (float)sqrt((x * x) + (y * y));
	}

	Vector3 normalize()
	{
		Vector3 out = *this;
		auto len = length();
		if (!len)
			return *this;

		out.x /= len;
		out.y /= len;
		out.z /= len;
		return out;
	}

	Vector3 cross(Vector3 rhs)
	{
		return Vector3(y * rhs.z - z * rhs.y, z * rhs.x - x * rhs.z, x * rhs.y - y * rhs.x);
	}

	float unity_magnitude()
	{
		return (float)sqrt((double)(x * x + y * y + z * z));
	}

	Vector3 unity_normalize()
	{
		float num = unity_magnitude();
		if (num > 1E-05f)
		{
			x /= num;
			y /= num;
			z /= num;
		}
		else
		{
			x = 0;
			y = 0;
			z = 0;
		}

		return{ x,y,z };
	}

	Vector3 normalized() const
	{
		return{ x == 0 ? 0 : x / length(), y == 0 ? 0 : y / length(), z == 0 ? 0 : z / length() };
	}

	float dot(Vector3 input) const
	{
		return (x * input.x) + (y * input.y) + (z * input.z);
	}

	float distance(Vector3 input) const
	{
		return (*this - input).length();
	}

	float distancesqr(Vector3 input) const
	{
		Vector3 dif = { x - input.x, y - input.y, z - input.z };
		return dif.x * dif.x + dif.y * dif.y + dif.z * dif.z;
	}

	float distance_2d(Vector3 input) const
	{
		return (*this - input).length_2d();
	}

	float Length() {
		return sqrtf(x * x + y * y + z * z);
	}

	bool is_valid() const
	{
		return !(x == 0.f && y == 0.f && z == 0.f) || (x == -1.f && y == -1.f && z == -1.f);
	}

	bool is_empty() { return x == 0 && y == 0 && z == 0; }
};

class Vector4
{
public:
	Vector4()
	{
		x = y = z = w = 0.f;
	}

	Vector4(float fx, float fy, float fz, float fw)
	{
		x = fx;
		y = fy;
		z = fz;
		w = fw;
	}

	float x, y, z, w;

	Vector4 operator+(const Vector4& input) const
	{
		return Vector4{ x + input.x, y + input.y, z + input.z, w + input.w };
	}

	Vector4 operator-(const Vector4& input) const
	{
		return Vector4{ x - input.x, y - input.y, z - input.z, w - input.w };
	}

	Vector4 operator/(float input) const
	{
		return Vector4{ x / input, y / input, z / input, w / input };
	}

	Vector4 operator*(float input) const
	{
		return Vector4{ x * input, y * input, z * input, w * input };
	}

	Vector4& operator-=(const Vector4& v)
	{
		x -= v.x;
		y -= v.y;
		z -= v.z;
		w -= v.w;

		return *this;
	}

	Vector4& operator/=(float input)
	{
		x /= input;
		y /= input;
		z /= input;
		w /= input;
		return *this;
	}

	Vector4& operator*=(float input)
	{
		x *= input;
		y *= input;
		z *= input;
		w *= input;
		return *this;
	}

	bool operator==(const Vector4& input) const
	{
		return x == input.x && y == input.y && z == input.z && w == input.w;
	}

	void make_absolute()
	{
		x = std::abs(x);
		y = std::abs(y);
		z = std::abs(z);
		w = std::abs(w);
	}

	float length_sqr() const
	{
		return (x * x) + (y * y) + (z * z) + (w * w);
	}

	float length() const
	{
		return (float)sqrt(length_sqr());
	}

	float length_2d() const
	{
		return (float)sqrt((x * x) + (y * y));
	}

	Vector4 normalized() const
	{
		return{ x / length(), y / length(), z / length(), w / length() };
	}

	float dot(Vector4 input) const
	{
		return (x * input.x) + (y * input.y) + (z * input.z) + (w * input.w);
	}

	float distance(Vector4 input) const
	{
		return (*this - input).length();
	}

	float distance_2d(Vector4 input) const
	{
		return (*this - input).length_2d();
	}

	static Vector4 QuaternionLookRotation(Vector3 forward, Vector3 up)
	{
		Vector3 vector = forward.unity_normalize();
		Vector3 Vector2 = (up).cross(vector).unity_normalize();
		Vector3 Vector3 = (vector).cross(Vector2);
		auto m00 = Vector2.x;
		auto m01 = Vector2.y;
		auto m02 = Vector2.z;
		auto m10 = Vector3.x;
		auto m11 = Vector3.y;
		auto m12 = Vector3.z;
		auto m20 = vector.x;
		auto m21 = vector.y;
		auto m22 = vector.z;


		float num8 = (m00 + m11) + m22;
		auto quaternion = Vector4();
		if (num8 > 0.f)
		{
			auto num = (float)sqrt(num8 + 1.f);
			quaternion.w = num * 0.5f;
			num = 0.5f / num;
			quaternion.x = (m12 - m21) * num;
			quaternion.y = (m20 - m02) * num;
			quaternion.z = (m01 - m10) * num;
			return quaternion;
		}
		if ((m00 >= m11) && (m00 >= m22))
		{
			auto num7 = (float)sqrt(((1.f + m00) - m11) - m22);
			auto num4 = 0.5f / num7;
			quaternion.x = 0.5f * num7;
			quaternion.y = (m01 + m10) * num4;
			quaternion.z = (m02 + m20) * num4;
			quaternion.w = (m12 - m21) * num4;
			return quaternion;
		}
		if (m11 > m22)
		{
			auto num6 = (float)sqrt(((1.f + m11) - m00) - m22);
			auto num3 = 0.5f / num6;
			quaternion.x = (m10 + m01) * num3;
			quaternion.y = 0.5f * num6;
			quaternion.z = (m21 + m12) * num3;
			quaternion.w = (m20 - m02) * num3;
			return quaternion;
		}
		auto num5 = (float)sqrt(((1.f + m22) - m00) - m11);
		auto num2 = 0.5f / num5;
		quaternion.x = (m20 + m02) * num2;
		quaternion.y = (m21 + m12) * num2;
		quaternion.z = 0.5f * num5;
		quaternion.w = (m01 - m10) * num2;
		return quaternion;
	}

	bool is_valid() const
	{
		return !((x == 0.f && y == 0.f && z == 0.f && w == 0.f) || (x == -1.f && y == -1.f && z == -1.f && w == -1.f));
	}
};

Pomogłem i chcesz podziękować? Zostaw up.png przy poście

CSHEx4.png

 

Szukasz taniego i bardzo dobrego cheata na legit? Wypróbuj CSH External VIP Project.

Odnośnik do komentarza
  • Rozwiązanie

Moja klasa do odczytywania pamieci, moze ci sie przyda

#pragma once
#include <Windows.h>
#include <TlHelp32.h>
#include <iostream>
#include <memory>
#include <vector>

struct module_t
{
	std::string module_name;
	uint32_t module_address;
};

class c_mem_rex
{
private:
	std::string process_name;
	uint32_t process_id;
	HANDLE process_handle;
	std::vector<module_t> modules;

	bool get_process_id()
	{
		PROCESSENTRY32 entry;
		entry.dwSize = sizeof(entry);

		const auto snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);

		if (Process32First(snapshot, &entry))
		{
			while (Process32Next(snapshot, &entry))
			{
				if (entry.szExeFile == process_name)
				{
					process_id = entry.th32ProcessID;
					CloseHandle(snapshot);
					return true;
				}
			}
		}

		CloseHandle(snapshot);
		throw std::exception("Couldn't get process id. Is proccess runing?");
		return false;
	}

	bool get_handle()
	{

		process_handle = OpenProcess(PROCESS_ALL_ACCESS, false, process_id);

		if (!process_handle)
		{
			CloseHandle(process_handle);
			throw std::exception("Couldn't get process handle.");
			return false;
		}

		return true;
	}

	bool get_modules()
	{
		MODULEENTRY32 entry;
		entry.dwSize = sizeof(entry);
		module_t current_module;
		const auto snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, process_id);

		if (Module32First(snapshot, &entry))
		{
			while (Module32Next(snapshot, &entry))
			{
				current_module.module_name = entry.szModule;
				current_module.module_address = reinterpret_cast<uint32_t>(entry.modBaseAddr);
				modules.push_back(current_module);
			}
		}
		else
		{
			CloseHandle(snapshot);
			throw std::exception("Couldn't find any modules in process.");
			return false;
		}

		CloseHandle(snapshot);
		return true;
	}
public:
	c_mem_rex(const std::string process)
	{
		process_name = process;
		process_id = NULL;
		process_handle = nullptr;
		try
		{
			if (get_process_id())
				if (get_handle())
					get_modules();
		}
		catch (std::exception& e)
		{
			throw std::exception(e.what());
		}
	}

	~c_mem_rex()
	{
		CloseHandle(process_handle);
	}

	bool free_memory(const uint32_t address, const size_t size)
	{
		return VirtualFreeEx(process_handle, reinterpret_cast<LPVOID>(address), size, MEM_RELEASE);
	}

	uint32_t allocate_memory(const size_t size)
	{
		return reinterpret_cast<uint32_t>(VirtualAllocEx(process_handle, 0, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE));
	}

	uint32_t get_module(const std::string module_name)
	{
		for (auto& s: modules)
		{
			if (s.module_name == module_name)
				return s.module_address;
		}
	}

	template<typename t>
	t read(const uint32_t address)
	{
		t out;

		ReadProcessMemory(process_handle, reinterpret_cast<LPCVOID>(address), &out, sizeof(t), NULL);

		return out;
	}

	template<typename t>
	void write(const uint32_t address, const t in)
	{
		WriteProcessMemory(process_handle, reinterpret_cast<LPVOID>(address), &in, sizeof(t), NULL);
	}

	template<typename t>
	void write_protected(const uint32_t address, const t in)
	{
		uint32_t old;
		VirtualProtectEx(process_handle, reinterpret_cast<LPCVOID>(address), sizeof(t), PAGE_EXECUTE_READWRITE, &old);
		write(address, in);
		VirtualProtectEx(process_handle, reinterpret_cast<LPCVOID>(address), sizeof(t), old, NULL);
	}
};
extern std::unique_ptr<c_mem_rex> mem_rex;

 

Odnośnik do komentarza

Dołącz do dyskusji

Możesz dodać zawartość już teraz a zarejestrować się później. Jeśli posiadasz już konto, zaloguj się aby dodać zawartość za jego pomocą.

Gość
Dodaj odpowiedź do tematu...

×   Wklejono zawartość z formatowaniem.   Usuń formatowanie

  Dozwolonych jest tylko 75 emoji.

×   Odnośnik został automatycznie osadzony.   Przywróć wyświetlanie jako odnośnik

×   Przywrócono poprzednią zawartość.   Wyczyść edytor

×   Nie możesz bezpośrednio wkleić grafiki. Dodaj lub załącz grafiki z adresu URL.

  Tagi

×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę. Regulamin. Polityka prywatności