From d5d5868cc4fb6ddff6ee73d9582a629b170ced64 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Sun, 21 Oct 2018 16:58:03 -0700 Subject: initial version, randomizing just tutorial --- WitnessRandomizer/Memory.cpp | Bin 0 -> 4288 bytes WitnessRandomizer/Memory.h | 39 +++++ WitnessRandomizer/WitnessRandomizer.cpp | Bin 0 -> 2468 bytes WitnessRandomizer/WitnessRandomizer.vcxproj | 170 +++++++++++++++++++++ .../WitnessRandomizer.vcxproj.filters | 36 +++++ WitnessRandomizer/pch.cpp | Bin 0 -> 430 bytes WitnessRandomizer/pch.h | Bin 0 -> 1262 bytes 7 files changed, 245 insertions(+) create mode 100644 WitnessRandomizer/Memory.cpp create mode 100644 WitnessRandomizer/Memory.h create mode 100644 WitnessRandomizer/WitnessRandomizer.cpp create mode 100644 WitnessRandomizer/WitnessRandomizer.vcxproj create mode 100644 WitnessRandomizer/WitnessRandomizer.vcxproj.filters create mode 100644 WitnessRandomizer/pch.cpp create mode 100644 WitnessRandomizer/pch.h (limited to 'WitnessRandomizer') diff --git a/WitnessRandomizer/Memory.cpp b/WitnessRandomizer/Memory.cpp new file mode 100644 index 0000000..b15685b Binary files /dev/null and b/WitnessRandomizer/Memory.cpp differ diff --git a/WitnessRandomizer/Memory.h b/WitnessRandomizer/Memory.h new file mode 100644 index 0000000..2453cf0 --- /dev/null +++ b/WitnessRandomizer/Memory.h @@ -0,0 +1,39 @@ +#pragma once +#include +#include +#include + +// https://github.com/erayarslan/WriteProcessMemory-Example +// http://stackoverflow.com/q/32798185 +// http://stackoverflow.com/q/36018838 +// http://stackoverflow.com/q/1387064 +class Memory +{ +public: + Memory(const std::string& processName); + ~Memory(); + + template + std::vector ReadData(const std::vector& offsets, int numItems) { + std::vector data; + data.resize(numItems); + if (!ReadProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * numItems, NULL)) { + ThrowError(); + } + return data; + } + + template + void WriteData(const std::vector& offsets, const std::vector& data) { + if (!WriteProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * data.size(), NULL)) { + ThrowError(); + } + } + +private: + void ThrowError(); + + uintptr_t ComputeOffset(std::vector offsets); + uintptr_t _baseAddress; + HANDLE _handle; +}; \ No newline at end of file diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp new file mode 100644 index 0000000..6d00a26 Binary files /dev/null and b/WitnessRandomizer/WitnessRandomizer.cpp differ diff --git a/WitnessRandomizer/WitnessRandomizer.vcxproj b/WitnessRandomizer/WitnessRandomizer.vcxproj new file mode 100644 index 0000000..efcd38c --- /dev/null +++ b/WitnessRandomizer/WitnessRandomizer.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {1563D1E2-0A18-4AFC-8D6F-9F8D9A433F31} + Win32Proj + WitnessRandomizer + 10.0.17134.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + + + + + Use + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + + + + + Use + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + + + + + Use + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + + + + + + + + + + Create + Create + Create + Create + + + + + + + \ No newline at end of file diff --git a/WitnessRandomizer/WitnessRandomizer.vcxproj.filters b/WitnessRandomizer/WitnessRandomizer.vcxproj.filters new file mode 100644 index 0000000..dc08442 --- /dev/null +++ b/WitnessRandomizer/WitnessRandomizer.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/WitnessRandomizer/pch.cpp b/WitnessRandomizer/pch.cpp new file mode 100644 index 0000000..a38f8a3 Binary files /dev/null and b/WitnessRandomizer/pch.cpp differ diff --git a/WitnessRandomizer/pch.h b/WitnessRandomizer/pch.h new file mode 100644 index 0000000..d87432d Binary files /dev/null and b/WitnessRandomizer/pch.h differ -- cgit 1.4.1