cleaned the code up, merged the bypass into the cheat

workingdir/cra0-upated
xerox 4 years ago
parent 80f423b011
commit dda020a72a

@ -1,36 +0,0 @@
#pragma once
#include <dlfcn.h>
#include <mutex>
#include <android/log.h>
#include <sys/system_properties.h>
#include "../ligma.h"
#define HWID_VALUE "what do you call nuts on your chin? a dick down your throat you fucking retard!"
#define offset_emulator_check 0x000D7B4
#define offset_ischeat_packet 0x00128E0
#define offset_mshook_function 0x0010358
#define offset_fopen_got 0x23ECC
namespace ligma
{
namespace bypass
{
inline void* fopen_ptr = nullptr;
inline void* system_prop_get = nullptr;
inline void* loadbufferx = nullptr;
inline void* loader_dlopen_ptr = nullptr;
// every shithook you make you will need a mutex.
inline std::mutex fopen_mutex;
inline std::mutex system_prop_mutex;
inline std::mutex loadbufferx_mutex;
inline std::mutex dlopen_mutex;
inline std::function<void(std::uintptr_t)> il2cpp_callback;
void init(const std::function<void(std::uintptr_t)>& callback);
void* dlopen_hook(const char* filename, int flags);
FILE* fopen_hook(const char* path, const char* mode);
int system_property_hook(const char* name, char* value);
int loadbufferx_hook(void* L, const char* buff, size_t sz, const char* name, const char* mode);
}
}

@ -1,46 +0,0 @@
#include <elf.h>
#include <cstdint>
#include <dlfcn.h>
#include <map>
#include <android/log.h>
#define LOGI(...) ((void)__android_log_print(4, "ligma", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(5, "ligma", __VA_ARGS__))
namespace ligma
{
namespace hook
{
//
// TODO this doesnt work yet, needs to be debugged!
//
inline void* got_hook(elf32_hdr* module_base, const std::pair<const char*, const char*>& module_info, void* new_ptr)
{
if (!module_base || !module_info.first || !module_info.second || !new_ptr)
return {};
const auto orig_module_base = dlopen(module_info.first, RTLD_NOW);
const auto orig_ptr = dlsym(orig_module_base, module_info.second);
const auto shstrtab_header_offset = module_base->e_shoff + module_base->e_shstrndx * sizeof(elf32_shdr);
const auto shstr_header = reinterpret_cast<elf32_shdr*>(reinterpret_cast<std::uintptr_t>(module_base) + shstrtab_header_offset);
const auto shstr_section = reinterpret_cast<const char*>(module_base) + shstr_header->sh_offset;
auto section_header = reinterpret_cast<elf32_shdr*>(reinterpret_cast<std::uintptr_t>(module_base) + module_base->e_shoff);
for (auto idx = 0u; idx < module_base->e_shnum; ++idx)
{
if (strcmp(shstr_section + section_header->sh_name, ".got"))
{
for (auto section_value = reinterpret_cast<std::uintptr_t>(module_base) + section_header->sh_offset;
section_value < reinterpret_cast<std::uintptr_t>(module_base) + section_header->sh_size; section_value += 0x8)
if (*reinterpret_cast<void**>(section_value) == orig_ptr)
*reinterpret_cast<void**>(section_value) = new_ptr;
break;
}
section_header++;
}
return orig_ptr;
}
}
}

@ -1,137 +0,0 @@
/*
MIT License
Copyright (c) 2020 xerox
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include <map>
#include <atomic>
#include <memory>
#include <unistd.h>
#include <sys/mman.h>
#define PAGE_START(ptr) reinterpret_cast<void*>(reinterpret_cast<std::uintptr_t>(ptr) >> 12 << 12)
#define ARM_JMP_CODE 0xE51FF004
namespace ligma
{
namespace hook
{
class detour
{
public:
detour(void* addr_to_hook, void* jmp_to, bool enable = true)
:
hook_addr(addr_to_hook),
detour_addr(jmp_to),
hook_installed(false)
{
reinterpret_cast<std::uint32_t*>(jmp_code)[0] = ARM_JMP_CODE; // LDR PC, [PC, #-4]
reinterpret_cast<void**>(jmp_code)[1] = jmp_to;
memcpy(org_bytes, hook_addr, sizeof(org_bytes));
if (enable) install();
}
void install()
{
if (hook_installed.load())
return;
if (!mprotect(PAGE_START(hook_addr), getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC))
{
memcpy((void*)((long)hook_addr), jmp_code, sizeof(jmp_code));
mprotect(PAGE_START(hook_addr), getpagesize(), PROT_READ | PROT_EXEC);
cacheflush(reinterpret_cast<long>(hook_addr), reinterpret_cast<long>(hook_addr) + getpagesize(), NULL);
hook_installed.exchange(true);
}
}
void uninstall()
{
if (!hook_installed.load())
return;
if (!mprotect(PAGE_START(hook_addr), getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC))
{
memcpy(hook_addr, org_bytes, sizeof(jmp_code));
mprotect(PAGE_START(hook_addr), getpagesize(), PROT_READ | PROT_EXEC);
cacheflush(reinterpret_cast<long>(hook_addr), reinterpret_cast<long>(hook_addr) + getpagesize(), NULL);
hook_installed.exchange(false);
}
}
~detour() { uninstall(); }
bool installed() { return hook_installed; }
void* hook_address() { return hook_addr; }
void* detour_address() { return detour_addr; }
private:
std::atomic<bool> hook_installed;
void* hook_addr, * detour_addr;
unsigned char jmp_code[8]{};
std::uint8_t org_bytes[sizeof(jmp_code)];
};
// this is jank, but needed because the OS isnt initalizing statics/inlined globals... :|
inline std::map<void*, std::unique_ptr<detour>>* get_hooks()
{
static std::map<void*, std::unique_ptr<detour>> hooks{};
return &hooks;
}
inline void make_hook(void* addr_to_hook, void* jmp_to_addr, bool enable = true)
{
if (!addr_to_hook)
return;
get_hooks()->insert({
addr_to_hook,
std::make_unique<detour>(
addr_to_hook,
jmp_to_addr,
enable
) }
);
}
inline void enable(void* addr)
{
if (!addr)
return;
get_hooks()->at(addr)->install();
}
inline void disable(void* addr)
{
if (!addr)
return;
get_hooks()->at(addr)->uninstall();
}
inline void remove(void* addr)
{
if (!addr)
return;
get_hooks()->erase(addr);
}
}
}

@ -1,8 +0,0 @@
#pragma once
#include <android/log.h>
#include "utils/utils.h"
#include "hooks/shithook.h"
#include "hooks/got_hook.h"
#define LOGI(...) ((void)__android_log_print(4, "ligma", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(5, "ligma", __VA_ARGS__))

@ -1,224 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{15c1c992-4566-4d40-a856-b536b81299e4}</ProjectGuid>
<Keyword>Android</Keyword>
<RootNamespace>ligma</RootNamespace>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<ApplicationType>Android</ApplicationType>
<ApplicationTypeRevision>3.0</ApplicationTypeRevision>
<ProjectName>ligma-bypass</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel>android-22</AndroidAPILevel>
<ThumbMode>ARM</ThumbMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel>android-22</AndroidAPILevel>
<ThumbMode>ARM</ThumbMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel>android-22</AndroidAPILevel>
<ThumbMode>ARM</ThumbMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel>android-22</AndroidAPILevel>
<ThumbMode>ARM</ThumbMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel>android-22</AndroidAPILevel>
<ThumbMode>ARM</ThumbMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel>android-22</AndroidAPILevel>
<ThumbMode>ARM</ThumbMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel>android-22</AndroidAPILevel>
<ThumbMode>ARM</ThumbMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel>android-22</AndroidAPILevel>
<ThumbMode>ARM</ThumbMode>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="bypass\bypass.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="bypass\bypass.h" />
<ClInclude Include="hooks\got_hook.h" />
<ClInclude Include="hooks\shithook.h" />
<ClInclude Include="ligma.h" />
<ClInclude Include="utils\utils.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="source">
<UniqueIdentifier>{8fc1c384-bc0c-40ad-91fd-d12eb8f15083}</UniqueIdentifier>
</Filter>
<Filter Include="headers">
<UniqueIdentifier>{a802d5b1-4373-45ec-9899-a56dcab8effb}</UniqueIdentifier>
</Filter>
<Filter Include="headers\bypass">
<UniqueIdentifier>{d02af610-3abc-497e-8875-d1f51f60a27d}</UniqueIdentifier>
</Filter>
<Filter Include="source\bypass">
<UniqueIdentifier>{3a6ff0eb-0b42-4eae-a5c7-3dad52e2c026}</UniqueIdentifier>
</Filter>
<Filter Include="headers\hooks">
<UniqueIdentifier>{e62eb3d6-ce1d-418e-8ea3-264cb68767c5}</UniqueIdentifier>
</Filter>
<Filter Include="headers\utils">
<UniqueIdentifier>{388138af-158e-4b7c-9eae-98b54b9d4146}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="bypass\bypass.cpp">
<Filter>source\bypass</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="bypass\bypass.h">
<Filter>headers\bypass</Filter>
</ClInclude>
<ClInclude Include="hooks\got_hook.h">
<Filter>headers\hooks</Filter>
</ClInclude>
<ClInclude Include="hooks\shithook.h">
<Filter>headers\hooks</Filter>
</ClInclude>
<ClInclude Include="utils\utils.h">
<Filter>headers\utils</Filter>
</ClInclude>
<ClInclude Include="ligma.h">
<Filter>headers</Filter>
</ClInclude>
</ItemGroup>
</Project>

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

@ -1,23 +0,0 @@
#pragma once
#include <functional>
#include <fstream>
#include <map>
namespace ligma
{
namespace utils
{
inline void iterate_memory(const std::function<void(const std::pair<std::uintptr_t, std::uintptr_t>&, const std::string& protection)>& callback)
{
std::fstream maps("/proc/self/maps");
std::pair<std::uintptr_t, std::uintptr_t> memory_range;
std::string page_perms;
while (maps >> memory_range.first >> memory_range.second >> page_perms)
{
maps.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // skip to next line :)
callback(memory_range, page_perms);
}
maps.close();
}
}
}

@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ligma-cheat", "ligma-cheat\ligma-cheat.vcxproj", "{C563FAFC-30B9-43A1-ACEE-33CCD40FA562}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ligma-bypass", "ligma-bypass\ligma.vcxproj", "{15C1C992-4566-4D40-A856-B536B81299E4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@ -35,22 +33,6 @@ Global
{C563FAFC-30B9-43A1-ACEE-33CCD40FA562}.Release|x64.Build.0 = Release|x64
{C563FAFC-30B9-43A1-ACEE-33CCD40FA562}.Release|x86.ActiveCfg = Release|x86
{C563FAFC-30B9-43A1-ACEE-33CCD40FA562}.Release|x86.Build.0 = Release|x86
{15C1C992-4566-4D40-A856-B536B81299E4}.Debug|ARM.ActiveCfg = Debug|ARM
{15C1C992-4566-4D40-A856-B536B81299E4}.Debug|ARM.Build.0 = Debug|ARM
{15C1C992-4566-4D40-A856-B536B81299E4}.Debug|ARM64.ActiveCfg = Debug|ARM64
{15C1C992-4566-4D40-A856-B536B81299E4}.Debug|ARM64.Build.0 = Debug|ARM64
{15C1C992-4566-4D40-A856-B536B81299E4}.Debug|x64.ActiveCfg = Debug|x64
{15C1C992-4566-4D40-A856-B536B81299E4}.Debug|x64.Build.0 = Debug|x64
{15C1C992-4566-4D40-A856-B536B81299E4}.Debug|x86.ActiveCfg = Debug|x86
{15C1C992-4566-4D40-A856-B536B81299E4}.Debug|x86.Build.0 = Debug|x86
{15C1C992-4566-4D40-A856-B536B81299E4}.Release|ARM.ActiveCfg = Release|ARM
{15C1C992-4566-4D40-A856-B536B81299E4}.Release|ARM.Build.0 = Release|ARM
{15C1C992-4566-4D40-A856-B536B81299E4}.Release|ARM64.ActiveCfg = Release|ARM64
{15C1C992-4566-4D40-A856-B536B81299E4}.Release|ARM64.Build.0 = Release|ARM64
{15C1C992-4566-4D40-A856-B536B81299E4}.Release|x64.ActiveCfg = Release|x64
{15C1C992-4566-4D40-A856-B536B81299E4}.Release|x64.Build.0 = Release|x64
{15C1C992-4566-4D40-A856-B536B81299E4}.Release|x86.ActiveCfg = Release|x86
{15C1C992-4566-4D40-A856-B536B81299E4}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -12,12 +12,12 @@ namespace ligma
{
il2cpp_callback = callback;
fopen_ptr = dlsym(dlopen("libc.so", RTLD_NOLOAD), "fopen");
loader_dlopen_ptr = dlsym(dlopen("libdl.so", RTLD_NOLOAD), "__loader_dlopen");
dlopen_ptr = dlsym(dlopen("libdl.so", RTLD_NOLOAD), "dlopen");
system_prop_get = dlsym(dlopen("libc.so", RTLD_NOLOAD), "__system_property_get");
loadbufferx = dlsym(dlopen("libxlua.so", RTLD_NOW), "luaL_loadbufferx");
LOGI("loader_dlopen_ptr = %p", loader_dlopen_ptr);
ligma::hook::make_hook(loader_dlopen_ptr, reinterpret_cast<void*>(&dlopen_hook));
LOGI("loader_dlopen_ptr = %p", dlopen_ptr);
ligma::hook::make_hook(dlopen_ptr, reinterpret_cast<void*>(&dlopen_hook));
ligma::hook::make_hook(loadbufferx, reinterpret_cast<void*>(&loadbufferx_hook));
ligma::hook::make_hook(fopen_ptr, reinterpret_cast<void*>(&fopen_hook));
ligma::hook::make_hook(system_prop_get, reinterpret_cast<void*>(&system_property_hook));
@ -55,22 +55,23 @@ namespace ligma
// this is used to gain code execution exactly when il2cpp.so is loaded...
//
__attribute__((noinline))
void* loader_dlopen_hook(const char* filename, int flags, const void* caller_addr)
void* dlopen_hook(const char* filename, int flags)
{
LOGI("dlopen called, filename = %s", filename);
dlopen_mutex.lock();
ligma::hook::disable(loader_dlopen_ptr);
ligma::hook::disable(dlopen_ptr);
// do not resolve imports, this might cause another library to be loaded.
// that means it will call dlopen which means it will be stuck in std::mutex::lock (2 lines above this comment)
const auto result = dlopen(filename, RTLD_LAZY);
const auto result = dlopen(filename, reinterpret_cast<int>(RTLD_NEXT));
if (strstr(filename, "libil2cpp.so") != NULL)
ligma::hook::enable(loader_dlopen_ptr);
{
ligma::hook::enable(dlopen_ptr);
dlopen_mutex.unlock();
}
else
{
dlopen_mutex.unlock();
il2cpp_callback(reinterpret_cast<std::uintptr_t>(result));
// wait until callback is done before we start loading anything else...
dlopen_mutex.unlock();
}
return result;
}

@ -18,7 +18,7 @@ namespace ligma
inline void* fopen_ptr = nullptr;
inline void* system_prop_get = nullptr;
inline void* loadbufferx = nullptr;
inline void* loader_dlopen_ptr = nullptr;
inline void* dlopen_ptr = nullptr;
// every shithook you make you will need a mutex.
inline std::mutex fopen_mutex;

@ -35,6 +35,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="bypass\bypass.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
@ -153,12 +154,12 @@
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>libligma.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>adb logcat -c
adb push C:\Users\xerox\source\repos\ligma-cheat\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
adb push $(SolutionDir)\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
start cmd /k "title 'ligma filter' &amp; adb logcat | findstr ligma"
@ -176,12 +177,12 @@ adb shell am start -n com.activision.callofduty.shooter/com.tencent.tmgp.cod.Per
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>libligma.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>adb logcat -c
adb push C:\Users\xerox\source\repos\ligma-cheat\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
adb push $(SolutionDir)\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
start cmd /k "title 'ligma filter' &amp; adb logcat | findstr ligma"
@ -199,12 +200,12 @@ adb shell am start -n com.activision.callofduty.shooter/com.tencent.tmgp.cod.Per
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>libligma.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>adb logcat -c
adb push C:\Users\xerox\source\repos\ligma-cheat\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
adb push $(SolutionDir)\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
start cmd /k "title 'ligma filter' &amp; adb logcat | findstr ligma"
@ -222,12 +223,12 @@ adb shell am start -n com.activision.callofduty.shooter/com.tencent.tmgp.cod.Per
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>libligma.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>adb logcat -c
adb push C:\Users\xerox\source\repos\ligma-cheat\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
adb push $(SolutionDir)\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
start cmd /k "title 'ligma filter' &amp; adb logcat | findstr ligma"
@ -245,12 +246,12 @@ adb shell am start -n com.activision.callofduty.shooter/com.tencent.tmgp.cod.Per
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>libligma.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>adb logcat -c
adb push C:\Users\xerox\source\repos\ligma-cheat\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
adb push $(SolutionDir)\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
start cmd /k "title 'ligma filter' &amp; adb logcat | findstr ligma"
@ -268,12 +269,12 @@ adb shell am start -n com.activision.callofduty.shooter/com.tencent.tmgp.cod.Per
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>libligma.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>adb logcat -c
adb push C:\Users\xerox\source\repos\ligma-cheat\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
adb push $(SolutionDir)\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
start cmd /k "title 'ligma filter' &amp; adb logcat | findstr ligma"
@ -291,12 +292,12 @@ adb shell am start -n com.activision.callofduty.shooter/com.tencent.tmgp.cod.Per
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>libligma.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>adb logcat -c
adb push C:\Users\xerox\source\repos\ligma-cheat\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
adb push $(SolutionDir)\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
start cmd /k "title 'ligma filter' &amp; adb logcat | findstr ligma"
@ -314,12 +315,12 @@ adb shell am start -n com.activision.callofduty.shooter/com.tencent.tmgp.cod.Per
<CppLanguageStandard>c++1z</CppLanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>libligma.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>adb logcat -c
adb push C:\Users\xerox\source\repos\ligma-cheat\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
adb push $(SolutionDir)\ARM\Release\libligma_cheat.so /data/app/com.activision.callofduty.shooter-1/lib/arm/libligma.so
start cmd /k "title 'ligma filter' &amp; adb logcat | findstr ligma"

@ -16,11 +16,17 @@
<Filter Include="headers\utils">
<UniqueIdentifier>{f14fc099-f6a5-4dc9-8512-320e1dbe206a}</UniqueIdentifier>
</Filter>
<Filter Include="source\bypass">
<UniqueIdentifier>{742fd78d-91c1-449a-a790-95a32404ea5d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="bypass\bypass.cpp">
<Filter>source\bypass</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="bypass\bypass.h">

Loading…
Cancel
Save