2 |
3 | #define PAGE_SHIFT 14
4 | .align PAGE_SHIFT
5 |
6 | .globl EXT(kernel_executable_memory_placeholder)
7 | EXT(kernel_executable_memory_placeholder):
8 | .rept 0x4000/4
9 | .long 0x41414141
10 | .endr
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/CodeBuffer/code-buffer-x86.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "MemoryAllocator/CodeBuffer/CodeBufferBase.h"
4 |
5 | class CodeBuffer : public CodeBufferBase {
6 | public:
7 | CodeBuffer() : CodeBufferBase() {
8 | }
9 |
10 | public:
11 | void FixBindLabel(int offset, int32_t disp);
12 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/dobby/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby.h"
4 | #include "dobby/types.h"
5 | #include "dobby/platform_features.h"
6 | #include "dobby/platform_detect_macro.h"
7 | #include "dobby/utility_macro.h"
8 | #include "dobby/pac_kit.h"
9 |
10 | #include "logging/logging.h"
11 | #include "logging/check_logging.h"
--------------------------------------------------------------------------------
/.idea/deploymentTargetSelector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/SymbolResolver/dobby_symbol_resolver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if defined(BUILDING_INTERNAL)
4 | #include "macho/dobby_symbol_resolver_priv.h"
5 | #endif
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | void *DobbySymbolResolver(const char *image_name, const char *symbol_name);
12 |
13 | #ifdef __cplusplus
14 | }
15 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/CodeBuffer/code_buffer_x64.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "MemoryAllocator/CodeBuffer/CodeBufferBase.h"
4 |
5 | class CodeBuffer : public CodeBufferBase {
6 | public:
7 | CodeBuffer() : CodeBufferBase() {
8 | }
9 |
10 | public:
11 | void FixBindLabel(int offset, int32_t disp) {
12 | Store(offset, disp);
13 | }
14 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/CodeBuffer/code_buffer_x86.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "MemoryAllocator/CodeBuffer/CodeBufferBase.h"
4 |
5 | class CodeBuffer : public CodeBufferBase {
6 | public:
7 | CodeBuffer() : CodeBufferBase() {
8 | }
9 |
10 | public:
11 | void FixBindLabel(int offset, int32_t disp) {
12 | Store(offset, disp);
13 | }
14 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_CODEGEN_H
2 | #define CORE_CODEGEN_H
3 |
4 | #include "core/assembler/assembler.h"
5 |
6 | using namespace zz;
7 |
8 | class CodeGenBase {
9 | public:
10 | CodeGenBase(AssemblerBase *assembler) : assembler_(assembler) {
11 | }
12 |
13 | protected:
14 | AssemblerBase *assembler_;
15 | };
16 |
17 | #endif
--------------------------------------------------------------------------------
/app/src/main/res/menu/home.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/external/deprecated/misc-helper/format_printer.cc:
--------------------------------------------------------------------------------
1 | #include "misc-helper/format_printer.h"
2 |
3 | void hexdump(const uint8_t *bytes, size_t len) {
4 | size_t ix;
5 | for (ix = 0; ix < len; ++ix) {
6 | if (ix != 0 && !(ix % 16))
7 | LOG_FUNCTION_IMPL(0, "\n");
8 | LOG_FUNCTION_IMPL(0, "%02X ", bytes[ix]);
9 | }
10 | LOG_FUNCTION_IMPL(0, "\n");
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/external/logging/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories(.)
2 |
3 | if(NOT DOBBY_BUILD_KERNEL_MODE)
4 | set(SOURCE_FILE_LIST
5 | ${CMAKE_CURRENT_SOURCE_DIR}/logging.cc
6 | )
7 | else()
8 | set(SOURCE_FILE_LIST
9 | ${CMAKE_CURRENT_SOURCE_DIR}/kernel_logging.cc
10 | )
11 | endif()
12 | add_library(logging
13 | ${SOURCE_FILE_LIST}
14 | ${SOURCE_HEADER_LIST}
15 | )
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/benchmark/js/jquery.flot.uiConstants.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | 'use strict';
3 | $.plot.uiConstants = {
4 | SNAPPING_CONSTANT: 20,
5 | PANHINT_LENGTH_CONSTANT: 10,
6 | MINOR_TICKS_COUNT_CONSTANT: 4,
7 | TICK_LENGTH_CONSTANT: 10,
8 | ZOOM_DISTANCE_MARGIN: 25
9 | };
10 | })(jQuery);
11 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InstructionRelocation/arm64/InstructionRelocationARM64.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/dobby_internal.h"
4 |
5 | #include "core/arch/arm64/constants-arm64.h"
6 |
7 | #if 0
8 | namespace zz {
9 | namespace arm64 {
10 | void GenRelocateCodeAndBranch(void *buffer, CodeMemBlock *origin, CodeMemBlock *relocated);
11 | } // namespace arm64
12 | } // namespace zz
13 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/html/bench_results/martinus_mod/index2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Benchmark Results
6 |
7 | insert 100m values in map
8 |
9 | Lookup 100m ints, all present | Lookup 100m ints, few present
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/profile_saver.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of AliuHook, a library providing XposedAPI bindings to LSPlant
3 | * Copyright (c) 2021 Juby210 & Vendicated
4 | * Licensed under the Open Software License version 3.0
5 | */
6 |
7 | #ifndef ALIUHOOK_PROFILE_SAVER_H
8 | #define ALIUHOOK_PROFILE_SAVER_H
9 |
10 | bool disable_profile_saver();
11 |
12 | #endif //ALIUHOOK_PROFILE_SAVER_H
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 176dp
7 | 16dp
8 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/AssemblyCodeBuilder.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "PlatformUnifiedInterface/MemoryAllocator.h"
4 |
5 | #include "core/assembler/assembler.h"
6 |
7 | using namespace zz;
8 |
9 | using AssemblyCode = CodeMemBlock;
10 |
11 | class AssemblyCodeBuilder {
12 | public:
13 | static AssemblyCode *FinalizeFromTurboAssembler(AssemblerBase *assembler);
14 | };
15 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/hidden_api.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of AliuHook, a library providing XposedAPI bindings to LSPlant
3 | * Copyright (c) 2021 Juby210 & Vendicated
4 | * Licensed under the Open Software License version 3.0
5 | */
6 |
7 | #ifndef ALIUHOOK_HIDDEN_API_H
8 | #define ALIUHOOK_HIDDEN_API_H
9 |
10 | #include "jni.h"
11 |
12 | bool disable_hidden_api(JNIEnv*);
13 |
14 | #endif //ALIUHOOK_HIDDEN_API_H
15 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/arch/x86/constants-x86.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_ARCH_CONSTANTS_X86_H
2 | #define CORE_ARCH_CONSTANTS_X86_H
3 |
4 | namespace zz {
5 | namespace x86 {
6 |
7 | enum ScaleFactor {
8 | TIMES_1 = 0,
9 | TIMES_2 = 1,
10 | TIMES_4 = 2,
11 | TIMES_8 = 3,
12 | TIMES_16 = 4,
13 | TIMES_HALF_WORD_SIZE = sizeof(void *) / 2 - 1
14 | };
15 |
16 | } // namespace x86
17 | } // namespace zz
18 |
19 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/.clang-format:
--------------------------------------------------------------------------------
1 | BasedOnStyle: LLVM
2 |
3 | IndentWidth: 2
4 | TabWidth: 2
5 | UseTab: Never
6 | ColumnLimit: 120
7 |
8 | FixNamespaceComments: true
9 |
10 | # default is false
11 | #AlignConsecutiveMacros: true
12 | #AlignConsecutiveAssignments: true
13 | #AlignConsecutiveDeclarations: true
14 |
15 | # default is true
16 | ReflowComments: false
17 | SortIncludes : false
18 | AllowShortFunctionsOnASingleLine: false
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/CodeBuffer/code-buffer-x64.h:
--------------------------------------------------------------------------------
1 | #ifndef CODE_BUFFER_X64_H
2 | #define CODE_BUFFER_X64_H
3 |
4 | #include "MemoryAllocator/CodeBuffer/CodeBufferBase.h"
5 |
6 | class CodeBuffer : public CodeBufferBase {
7 | public:
8 | CodeBuffer() : CodeBufferBase() {
9 | }
10 |
11 | public:
12 | void FixBindLabel(int offset, int32_t disp) {
13 | Store(offset, disp);
14 | }
15 | };
16 |
17 | #endif
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptEntry.cpp:
--------------------------------------------------------------------------------
1 | #include "InterceptEntry.h"
2 | #include "Interceptor.h"
3 |
4 | InterceptEntry::InterceptEntry(InterceptEntryType type, addr_t address) {
5 | this->type = type;
6 |
7 | #if defined(TARGET_ARCH_ARM)
8 | if (address % 2) {
9 | address -= 1;
10 | this->thumb_mode = true;
11 | }
12 | #endif
13 |
14 | this->patched_addr = address;
15 | this->id = Interceptor::SharedInstance()->count();
16 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/dobby/dobby_internal.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/common.h"
4 |
5 | #include "UnifiedInterface/platform.h"
6 |
7 | #include "PlatformUnifiedInterface/MemoryAllocator.h"
8 | #include "PlatformUnifiedInterface/ExecMemory/CodePatchTool.h"
9 | #include "PlatformUnifiedInterface/ExecMemory/ClearCacheTool.h"
10 |
11 | #include "MemoryAllocator/AssemblyCodeBuilder.h"
12 |
13 | #include "InterceptRouting/InterceptRouting.h"
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/scripts/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:focal
2 |
3 | ARG DEBIAN_FRONTEND='noninteractive'
4 |
5 | RUN apt-key adv --keyserver 'keyserver.ubuntu.com' --recv-key 'C99B11DEB97541F0' &&
6 | apt-add-repository -y -u 'https://cli.github.com/packages' &&
7 | apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
8 |
9 | ADD setup_linux_cross_compile.sh /root/setup_linux_cross_compile.sh
10 | RUN sh /root/setup_linux_cross_compile.sh
11 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/arm/helper_arm.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_ARM)
3 |
4 | #include "dobby/dobby_internal.h"
5 |
6 | void set_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address) {
7 | *reinterpret_cast(&ctx->general.regs.r12) = address;
8 | }
9 |
10 | void get_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address) {
11 | }
12 |
13 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/aliuhook.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by ven on 24/03/2022.
3 | //
4 |
5 | #ifndef ALIUHOOK_ALIUHOOK_H
6 | #define ALIUHOOK_ALIUHOOK_H
7 |
8 | #include "elf_img.h"
9 |
10 | void *InlineHooker(void *, void *);
11 |
12 | bool InlineUnhooker(void *);
13 |
14 | class AliuHook {
15 | public:
16 | static pine::ElfImg elf_img;
17 | static int android_version;
18 |
19 | static void init(int version);
20 | };
21 |
22 | #endif //ALIUHOOK_ALIUHOOK_H
23 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/art/runtime/obj_ptr.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace lsplant::art {
4 |
5 | template
6 | class ObjPtr {
7 | public:
8 | inline MirrorType *operator->() const { return Ptr(); }
9 |
10 | inline MirrorType *Ptr() const { return reference_; }
11 |
12 | inline operator MirrorType *() const { return Ptr(); }
13 |
14 | private:
15 | MirrorType *reference_;
16 | };
17 |
18 | } // namespace lsplant::art
19 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": "(lldb) Launch",
6 | "type": "cppdbg",
7 | "request": "launch",
8 | "program": "enter program name, for example ${workspaceRoot}/a.out",
9 | "args": [],
10 | "stopAtEntry": false,
11 | "cwd": "${workspaceRoot}",
12 | "environment": [],
13 | "externalConsole": true,
14 | "MIMode": "lldb"
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/invoke_constructor.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by rushii on 2024-08-27.
3 | //
4 |
5 | #ifndef ALIUHOOK_INVOKE_CONSTRUCTOR_H
6 | #define ALIUHOOK_INVOKE_CONSTRUCTOR_H
7 |
8 | #include "jni.h"
9 |
10 | bool LoadInvokeConstructorCache(JNIEnv *en, int android_version);
11 |
12 | void UnloadInvokeConstructorCache(JNIEnv*);
13 |
14 | bool InvokeConstructorWithArgs(JNIEnv* env, jobject instance, jobject constructor, jobjectArray args);
15 |
16 | #endif //ALIUHOOK_INVOKE_CONSTRUCTOR_H
17 |
--------------------------------------------------------------------------------
/app/src/test/java/com/crack/vapp/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | // @Test
14 | // public void addition_isCorrect() {
15 | // assertEquals(4, 2 + 2);
16 | // }
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/crack/vapp/Utils/lg.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp.Utils;
2 |
3 | import android.util.Log;
4 |
5 | //日志
6 |
7 | public class lg {
8 | private static final String TAG = "lg";
9 |
10 | public static void d( String msg) {
11 | Log.d(TAG, "d: " + msg);
12 | }
13 |
14 | public static void e( String msg) {
15 | Log.e(TAG, "e: " + msg);
16 | }
17 |
18 | public static void i( String msg) {
19 | Log.i(TAG, "i: " + msg);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/assembler/assembler-x86-shared.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_IA32)
3 |
4 | #include "core/assembler/assembler-x86-shared.h"
5 |
6 | using namespace zz::x86shared;
7 |
8 | void Assembler::jmp(Immediate imm) {
9 | buffer_->Emit8(0xE9);
10 | buffer_->Emit32((int)imm.value());
11 | }
12 |
13 | uint64_t TurboAssembler::CurrentIP() {
14 | return pc_offset() + (addr_t)realized_addr_;
15 | }
16 |
17 | #endif
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/art/runtime/reflective_reference.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace lsplant::art {
6 | template
7 | class ReflectiveReference {
8 | public:
9 | static_assert(std::is_same_v, "Unknown type!");
10 |
11 | ReflectiveType *Ptr() { return val_; }
12 |
13 | void Assign(ReflectiveType *r) { val_ = r; }
14 |
15 | private:
16 | ReflectiveType *val_;
17 | };
18 |
19 | } // namespace lsplant::art
20 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/RoutingPlugin/RoutingPlugin.cc:
--------------------------------------------------------------------------------
1 | #include "InterceptRouting/RoutingPlugin/RoutingPlugin.h"
2 |
3 | tinystl::vector RoutingPluginManager::plugins;
4 |
5 | RoutingPluginInterface *RoutingPluginManager::near_branch_trampoline = NULL;
6 |
7 | void RoutingPluginManager::registerPlugin(const char *name, RoutingPluginInterface *plugin) {
8 | DEBUG_LOG("register %s plugin", name);
9 |
10 | RoutingPluginManager::plugins.push_back(plugin);
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/arch/CpuFeature.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_ARCH_CPU_FEATURE_H
2 | #define CORE_ARCH_CPU_FEATURE_H
3 |
4 | #include "dobby/common.h"
5 |
6 | class CpuFeatures {
7 | private:
8 | static void FlushICache(void *start, size_t size) {
9 | ClearCache(start, (void *)((addr_t)start + size));
10 | }
11 |
12 | static void FlushICache(void *start, void *end) {
13 | ClearCache(start, end);
14 | }
15 |
16 | static void ClearCache(void *start, void *end);
17 | };
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | BasedOnStyle: Google
3 | IndentWidth: 4
4 | UseCRLF: false
5 | UseTab: false
6 | ---
7 | Language: Cpp
8 | DerivePointerAlignment: true
9 | PointerAlignment: Right
10 | ColumnLimit: 100
11 | AlignEscapedNewlines: Right
12 | Cpp11BracedListStyle: true
13 | Standard: Latest
14 | # IndentAccessModifiers: false
15 | IndentCaseLabels: false
16 | BreakStringLiterals: false
17 | IndentExternBlock: false
18 | AccessModifierOffset: -4
19 | # EmptyLineBeforeAccessModifier: true
20 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/dobby/platform_detect_macro.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if !defined(DISABLE_ARCH_DETECT)
4 | #if defined(__arm__)
5 | #define TARGET_ARCH_ARM 1
6 | #elif defined(__arm64__) || defined(__aarch64__)
7 | #define TARGET_ARCH_ARM64 1
8 | #elif defined(_M_IX86) || defined(__i386__)
9 | #define TARGET_ARCH_IA32 1
10 | #elif defined(_M_X64) || defined(__x86_64__)
11 | #define TARGET_ARCH_X64 1
12 | #else
13 | #error Target architecture was not detected as supported by Dobby
14 | #endif
15 | #endif
16 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/external/deprecated/misc-helper/misc-helper/variable_cache.h:
--------------------------------------------------------------------------------
1 | #ifndef VARIABLE_CACHE_H
2 | #define VARIABLE_CACHE_H
3 |
4 | #include
5 |
6 | #define cache_set stash
7 | void cache_set(const char *name, uint64_t value);
8 |
9 | #define cache_get(x) cache(x)
10 | #define assert_cache(x) (assert(cache(x)), cache(x))
11 | uint64_t cache_get(const char *name);
12 |
13 | int serialized_to_file(const char *filepath);
14 |
15 | int unserialized_from_file(const char *filepath);
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/external/deprecated/misc-helper/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories(.)
2 |
3 | if(NOT DOBBY_BUILD_KERNEL_MODE)
4 | set(SOURCE_FILE_LIST
5 | ${CMAKE_CURRENT_SOURCE_DIR}/variable_cache.c
6 | ${CMAKE_CURRENT_SOURCE_DIR}/async_logger.cc
7 | ${CMAKE_CURRENT_SOURCE_DIR}/format_printer.cc
8 | )
9 | else()
10 | set(SOURCE_FILE_LIST
11 | ${CMAKE_CURRENT_SOURCE_DIR}/format_printer.cc
12 | )
13 | endif()
14 |
15 | add_library(misc_helper
16 | ${SOURCE_FILE_LIST}
17 | ${SOURCE_HEADER_LIST}
18 | )
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/RoutingPlugin/NearBranchTrampoline/NearBranchTrampoline.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/dobby_internal.h"
4 |
5 | #include "InterceptRouting/RoutingPlugin/RoutingPlugin.h"
6 |
7 | class NearBranchTrampolinePlugin : public RoutingPluginInterface {
8 | bool Prepare(InterceptRouting *routing) {
9 | return false;
10 | };
11 |
12 | bool Active(InterceptRouting *routing);
13 |
14 | bool GenerateTrampolineBuffer(InterceptRouting *routing, addr_t src, addr_t dst);
15 | };
16 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Interceptor.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/dobby_internal.h"
4 | #include "InterceptEntry.h"
5 |
6 | class Interceptor {
7 | public:
8 | static Interceptor *SharedInstance();
9 |
10 | public:
11 | InterceptEntry *find(addr_t addr);
12 |
13 | void remove(addr_t addr);
14 |
15 | void add(InterceptEntry *entry);
16 |
17 | const InterceptEntry *getEntry(int i);
18 |
19 | int count();
20 |
21 | private:
22 | static Interceptor *instance;
23 |
24 | tinystl::vector entries;
25 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/x86/helper_x86.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_IA32)
3 |
4 | #include "dobby/dobby_internal.h"
5 |
6 | void set_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address) {
7 | addr_t esp = ctx->esp;
8 |
9 | addr_t entry_placeholder_stack_addr = esp - 4;
10 | *(addr_t *)entry_placeholder_stack_addr = (addr_t)address;
11 | }
12 |
13 | void get_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address) {
14 | }
15 |
16 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/ObjcRuntimeReplace/dobby_objc_runtime_repalce.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | IMP DobbyObjcReplace(Class _class, SEL _selector, IMP replacement);
11 |
12 | void DobbyObjcReplaceEx(const char *class_name, const char *selector_name, void *fake_impl, void **orig_impl);
13 |
14 | void *DobbyObjcResolveMethodImp(const char *class_name, const char *selector_name);
15 |
16 | #ifdef __cplusplus
17 | }
18 | #endif
19 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/arch/x64/constants-x64.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_ARCH_CONSTANTS_X64_H
2 | #define CORE_ARCH_CONSTANTS_X64_H
3 |
4 | namespace zz {
5 | namespace x64 {
6 |
7 | enum ScaleFactor {
8 | TIMES_1 = 0,
9 | TIMES_2 = 1,
10 | TIMES_4 = 2,
11 | TIMES_8 = 3,
12 | TIMES_16 = 4,
13 | TIMES_HALF_WORD_SIZE = sizeof(void *) / 2 - 1
14 | };
15 |
16 | enum RexBits { REX_NONE = 0, REX_B = 1 << 0, REX_X = 1 << 1, REX_R = 1 << 2, REX_W = 1 << 3, REX_PREFIX = 1 << 6 };
17 |
18 | } // namespace x64
19 | } // namespace zz
20 |
21 | #endif
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/BionicLinkerUtil/bionic_linker_util.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | typedef void *soinfo_t;
10 |
11 | soinfo_t linker_dlopen(const char *filename, int flag);
12 |
13 | char *linker_soinfo_get_realpath(soinfo_t soinfo);
14 |
15 | uintptr_t linker_soinfo_to_handle(soinfo_t soinfo);
16 |
17 | void linker_iterate_soinfo(int (*cb)(soinfo_t soinfo));
18 |
19 | void linker_disable_namespace_restriction();
20 |
21 | #ifdef __cplusplus
22 | }
23 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen-ia32.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_CODEGEN_X86_H
2 | #define CORE_CODEGEN_X86_H
3 |
4 | #include "core/codegen/codegen.h"
5 | #include "core/assembler/assembler.h"
6 | #include "core/assembler/assembler-ia32.h"
7 |
8 | namespace zz {
9 | namespace x86 {
10 |
11 | class CodeGen : public CodeGenBase {
12 | public:
13 | CodeGen(TurboAssembler *turbo_assembler) : CodeGenBase(turbo_assembler) {
14 | }
15 |
16 | void JmpNear(uint32_t address);
17 | };
18 |
19 | } // namespace x86
20 | } // namespace zz
21 |
22 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/README.md:
--------------------------------------------------------------------------------
1 | # DexBuilder
2 |
3 | c++ dex builder for replacement with [dexmaker](https://github.com/linkedin/dexmaker).
4 |
5 | Most of them are copied from [AOSP](https://cs.android.com/android/platform/superproject/+/master:frameworks/base/startop/view_compiler).
6 |
7 | Modified parts are owed by LSPosed Developers. If you would like to use it in an open source project, please submodule it.
8 |
9 | Only part of instructions used by LSPosed are implemented. If you want to add other instructions, PR is welcomed.
10 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen-arm.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_CODEGEN_ARM_H
2 | #define CORE_CODEGEN_ARM_H
3 |
4 | #include "core/codegen/codegen.h"
5 | #include "core/assembler/assembler.h"
6 | #include "core/assembler/assembler-arm.h"
7 |
8 | namespace zz {
9 | namespace arm {
10 |
11 | class CodeGen : public CodeGenBase {
12 | public:
13 | CodeGen(TurboAssembler *turbo_assembler) : CodeGenBase(turbo_assembler) {
14 | }
15 |
16 | void LiteralLdrBranch(uint32_t address);
17 | };
18 |
19 | } // namespace arm
20 | } // namespace zz
21 |
22 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/SupervisorCallMonitor/test_supervisor_call_monitor.cc:
--------------------------------------------------------------------------------
1 |
2 | #include "dobby/dobby_internal.h"
3 |
4 | #include "SupervisorCallMonitor/supervisor_call_monitor.h"
5 |
6 | #if 1
7 | __attribute__((constructor)) static void ctor() {
8 | log_set_level(2);
9 | log_switch_to_syslog();
10 |
11 | supervisor_call_monitor_init();
12 | supervisor_call_monitor_register_main_app();
13 | supervisor_call_monitor_register_syscall_call_log_handler();
14 | supervisor_call_monitor_register_mach_syscall_call_log_handler();
15 | }
16 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen-arm64.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_CODEGEN_ARM64_H
2 | #define CORE_CODEGEN_ARM64_H
3 |
4 | #include "core/codegen/codegen.h"
5 | #include "core/assembler/assembler.h"
6 | #include "core/assembler/assembler-arm64.h"
7 |
8 | namespace zz {
9 | namespace arm64 {
10 |
11 | class CodeGen : public CodeGenBase {
12 | public:
13 | CodeGen(TurboAssembler *turbo_assembler) : CodeGenBase(turbo_assembler) {
14 | }
15 | void LiteralLdrBranch(uint64_t address);
16 | };
17 |
18 | } // namespace arm64
19 | } // namespace zz
20 |
21 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen-x64.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_CODEGEN_X64_H
2 | #define CORE_CODEGEN_X64_H
3 |
4 | #include "core/codegen/codegen.h"
5 | #include "core/assembler/assembler.h"
6 | #include "core/assembler/assembler-x64.h"
7 |
8 | namespace zz {
9 | namespace x64 {
10 |
11 | class CodeGen : public CodeGenBase {
12 | public:
13 | CodeGen(TurboAssembler *turbo_assembler) : CodeGenBase(turbo_assembler) {
14 | }
15 |
16 | void JmpNearIndirect(addr_t forward_stub_addr);
17 | };
18 |
19 | } // namespace x64
20 | } // namespace zz
21 |
22 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/cmake/CMakeLists.txt.in:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 |
3 | project(googletest-download NONE)
4 |
5 | include(ExternalProject)
6 | ExternalProject_Add(googletest
7 | GIT_REPOSITORY https://github.com/google/googletest.git
8 | GIT_TAG main
9 | SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
10 | BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
11 | CONFIGURE_COMMAND ""
12 | BUILD_COMMAND ""
13 | INSTALL_COMMAND ""
14 | TEST_COMMAND ""
15 | )
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/tests/parallel_flat_hash_map_mutex_test.cc:
--------------------------------------------------------------------------------
1 | #define THIS_HASH_MAP parallel_flat_hash_map
2 | #define THIS_TEST_NAME ParallelFlatHashMap
3 |
4 | #if 1
5 | #define THIS_EXTRA_TPL_PARAMS , 4, std::mutex
6 | #else
7 | #include
8 | #include
9 | #define THIS_EXTRA_TPL_PARAMS , 4, boost::upgrade_mutex
10 | #endif
11 |
12 | #define THIS_EXTRA_TPL_PARAMS_NULLMUTEX , 4, phmap::NullMutex
13 |
14 | #include "parallel_hash_map_test.cc"
15 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/arm64/helper_arm64.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_ARM64)
3 |
4 | #include "core/assembler/assembler-arm64.h"
5 |
6 | #include "dobby/dobby_internal.h"
7 |
8 | using namespace zz::arm64;
9 |
10 | void set_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address) {
11 | *reinterpret_cast(&ctx->general.x[TMP_REG_0.code()]) = address;
12 | }
13 |
14 | void get_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address) {
15 | }
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen-arm.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_ARM)
3 |
4 | #include "core/codegen/codegen-arm.h"
5 |
6 | namespace zz {
7 | namespace arm {
8 |
9 | void CodeGen::LiteralLdrBranch(uint32_t address) {
10 | TurboAssembler *turbo_assembler_ = reinterpret_cast(this->assembler_);
11 | #define _ turbo_assembler_->
12 | _ ldr(pc, MemOperand(pc, -4));
13 | turbo_assembler_->GetCodeBuffer()->Emit32((addr_t)address);
14 | }
15 |
16 | } // namespace arm
17 | } // namespace zz
18 |
19 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/CodeBuffer/code-buffer-x86.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_IA32)
3 |
4 | #include "MemoryAllocator/CodeBuffer/code-buffer-x86.h"
5 |
6 | void CodeBuffer::Emit32(int32_t data) {
7 | ensureCapacity(GetBufferSize() + sizeof(int32_t));
8 | *reinterpret_cast(getCursor()) = data;
9 | buffer_cursor += sizeof(int32_t);
10 | return;
11 | }
12 |
13 | void CodeBuffer::FixBindLabel(int offset, int32_t disp) {
14 | *reinterpret_cast(buffer + offset) = disp;
15 | return;
16 | }
17 |
18 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/x64/helper_x64.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_X64)
3 |
4 | #include "dobby/dobby_internal.h"
5 |
6 | void set_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address) {
7 | addr_t rsp = ctx->rsp;
8 |
9 | // ClosureTrampolineEntry reserved stack
10 | addr_t entry_placeholder_stack_addr = rsp - 8;
11 | *(addr_t *)entry_placeholder_stack_addr = (addr_t)address;
12 | }
13 |
14 | void get_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address) {
15 | }
16 |
17 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/CodeBuffer/code_buffer_arm64.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "MemoryAllocator/CodeBuffer/CodeBufferBase.h"
4 |
5 | typedef int32_t arm64_inst_t;
6 |
7 | class CodeBuffer : public CodeBufferBase {
8 |
9 | public:
10 | CodeBuffer() : CodeBufferBase() {
11 | }
12 |
13 | public:
14 | arm64_inst_t LoadInst(uint32_t offset) {
15 | return *reinterpret_cast(GetBuffer() + offset);
16 | }
17 |
18 | void RewriteInst(uint32_t offset, arm64_inst_t instr) {
19 | *reinterpret_cast(GetBuffer() + offset) = instr;
20 | }
21 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/x64/dummy/closure-trampoline-template-x64.S:
--------------------------------------------------------------------------------
1 | #if defined(ENABLE_CLOSURE_BRIDGE_TEMPLATE)
2 |
3 | #if defined(__WIN32__) || defined(__APPLE__)
4 | #define cdecl(s) _##s
5 | #else
6 | #define cdecl(s) s
7 | #endif
8 |
9 | .align 4
10 |
11 | ;
12 | closure trampoline just carray the required members from the object.
13 | .globl
14 | cdecl(closure_trampoline_template) cdecl(closure_trampoline_template)
15 | : push[rip + 6 + 6] jmp[rip + 6 + 8] carry_data :.long 0.long 0 carry_handler :.long 0.long 0
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/arch/CpuRegister.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_ARCH_CPU_REGISTER_H
2 | #define CORE_ARCH_CPU_REGISTER_H
3 |
4 | class RegisterBase {
5 | public:
6 | static constexpr RegisterBase from_code(int code);
7 |
8 | static constexpr RegisterBase no_reg();
9 |
10 | virtual bool Is(const RegisterBase ®) const {
11 | return (reg.reg_code_ == this->reg_code_);
12 | }
13 |
14 | int code() const {
15 | return reg_code_;
16 | };
17 |
18 | protected:
19 | explicit constexpr RegisterBase(int code) : reg_code_(code) {
20 | }
21 |
22 | int reg_code_;
23 | };
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/SupervisorCallMonitor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(supervisor_call_monitor STATIC
2 | mach_system_call_log_handler.cc
3 | system_call_log_handler.cc
4 | supervisor_call_monitor.cc
5 | sensitive_api_monitor.cc
6 | misc_utility.cc
7 | )
8 | target_link_libraries(supervisor_call_monitor
9 | misc_helper
10 | dobby
11 | )
12 |
13 | add_library(test_supervisor_call_monitor SHARED
14 | test_supervisor_call_monitor.cc
15 | )
16 | target_link_libraries(test_supervisor_call_monitor
17 | supervisor_call_monitor
18 | )
19 |
20 | include_directories(
21 | .
22 | )
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/external/logging/kernel_logging.cc:
--------------------------------------------------------------------------------
1 | #include "logging/logging.h"
2 |
3 | #include
4 | #include "utility_macro.h"
5 |
6 | #if defined(BUILDING_KERNEL)
7 | #define abort()
8 | #else
9 | #include
10 | #endif
11 |
12 | static int _log_level = 1;
13 | PUBLIC void log_set_level(int level) {
14 | _log_level = level;
15 | }
16 |
17 | PUBLIC int log_internal_impl(int level, const char *fmt, ...) {
18 | if (level < _log_level)
19 | return 0;
20 |
21 | va_list ap;
22 | va_start(ap, fmt);
23 |
24 | vprintf(fmt, ap);
25 |
26 | va_end(ap);
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/UserMode/Thread/platform-thread-windows.cc:
--------------------------------------------------------------------------------
1 | #include "PlatformThread.h"
2 |
3 | using namespace zz;
4 |
5 | int OSThread::GetCurrentProcessId() {
6 | return 0;
7 | }
8 |
9 | int OSThread::GetCurrentThreadId() {
10 | return 0;
11 | }
12 |
13 | OSThread::LocalStorageKey OSThread::CreateThreadLocalKey() {
14 | return 0;
15 | }
16 |
17 | void OSThread::DeleteThreadLocalKey(LocalStorageKey key) {
18 | }
19 |
20 | void *OSThread::GetThreadLocal(LocalStorageKey key) {
21 | return NULL;
22 | }
23 |
24 | void OSThread::SetThreadLocal(LocalStorageKey key, void *value) {
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/xz/linux/include/linux/decompress/unxz.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Wrapper for decompressing XZ-compressed kernel, initramfs, and initrd
3 | *
4 | * Author: Lasse Collin
5 | *
6 | * This file has been put into the public domain.
7 | * You can do whatever you want with this file.
8 | */
9 |
10 | #ifndef DECOMPRESS_UNXZ_H
11 | #define DECOMPRESS_UNXZ_H
12 |
13 | int unxz(unsigned char *in, int in_size,
14 | int (*fill)(void *dest, unsigned int size),
15 | int (*flush)(void *src, unsigned int size),
16 | unsigned char *out, int *in_used,
17 | void (*error)(char *x));
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google {
4 | content {
5 | includeGroupByRegex("com\\.android.*")
6 | includeGroupByRegex("com\\.google.*")
7 | includeGroupByRegex("androidx.*")
8 | }
9 | }
10 | mavenCentral()
11 | gradlePluginPortal()
12 | }
13 | }
14 | dependencyResolutionManagement {
15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
16 | repositories {
17 | google()
18 | mavenCentral()
19 | }
20 | }
21 |
22 | rootProject.name = "Vapp"
23 | include ':app'
24 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/cmake/xcode_generator_helper.cmake:
--------------------------------------------------------------------------------
1 | if(CMAKE_GENERATOR STREQUAL Xcode)
2 | message(STATUS "[*] Detect Xcode Project")
3 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/build/Debug)
4 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/build/Release)
5 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/build/Debug)
6 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/build/Release)
7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/build/Debug)
8 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/build/Release)
9 | endif()
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/common_bridge_handler.h:
--------------------------------------------------------------------------------
1 | #ifndef CLOSURE_TRAMPOLINE_COMMON_HANDLER_H
2 | #define CLOSURE_TRAMPOLINE_COMMON_HANDLER_H
3 |
4 | #include "dobby/dobby_internal.h"
5 |
6 | #include "Interceptor.h"
7 | #include "TrampolineBridge/ClosureTrampolineBridge/ClosureTrampoline.h"
8 |
9 | extern "C" {
10 | void common_closure_bridge_handler(DobbyRegisterContext *ctx, ClosureTrampolineEntry *entry);
11 | }
12 |
13 | void get_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address);
14 |
15 | void set_routing_bridge_next_hop(DobbyRegisterContext *ctx, void *address);
16 |
17 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/art/runtime/reflective_handle.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "reflective_reference.hpp"
6 | #include "value_object.hpp"
7 |
8 | namespace lsplant::art {
9 |
10 | class ArtMethod;
11 |
12 | template
13 | class ReflectiveHandle : public ValueObject {
14 | public:
15 | static_assert(std::is_same_v, "Expected ArtField or ArtMethod");
16 |
17 | T *Get() { return reference_->Ptr(); }
18 |
19 | void Set(T *val) { reference_->Assign(val); }
20 |
21 | protected:
22 | ReflectiveReference *reference_;
23 | };
24 |
25 | } // namespace lsplant::art
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/include/slicer/sha1.h:
--------------------------------------------------------------------------------
1 | /* ================ sha1.h ================ */
2 | /*
3 | SHA-1 in C
4 | By Steve Reid
5 | 100% Public Domain
6 | */
7 |
8 | #include
9 | #define u_int32_t uint32_t
10 |
11 | typedef struct {
12 | u_int32_t state[5];
13 | u_int32_t count[2];
14 | unsigned char buffer[64];
15 | } SHA1_CTX;
16 |
17 | void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64]);
18 | void SHA1Init(SHA1_CTX* context);
19 | void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len);
20 | void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if (Plugin.ImportTableReplace AND SYSTEM.Darwin)
2 | message(STATUS "[Dobby] Enable got hook")
3 | include_directories(builtin-plugin/ImportTableReplace)
4 | add_subdirectory(builtin-plugin/ImportTableReplace)
5 | endif ()
6 |
7 | if (Plugin.Android.BionicLinkerUtil)
8 | if (NOT SYSTEM.Android)
9 | message(FATAL_ERROR "[!] Plugin.Android.BionicLinkerUtil only works on Android.")
10 | endif ()
11 | message(STATUS "[Dobby] Enable Plugin.Android.BionicLinkerUtil")
12 | set(dobby.plugin.SOURCE_FILE_LIST ${dobby.plugin.SOURCE_FILE_LIST}
13 | BionicLinkerUtil/bionic_linker_util.cc
14 | )
15 | endif ()
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/CodeBuffer/code-buffer-arm64.h:
--------------------------------------------------------------------------------
1 | #ifndef CODE_BUFFER_ARM64_H
2 | #define CODE_BUFFER_ARM64_H
3 |
4 | #include "MemoryAllocator/CodeBuffer/CodeBufferBase.h"
5 |
6 | typedef int32_t arm64_inst_t;
7 |
8 | class CodeBuffer : public CodeBufferBase {
9 |
10 | public:
11 | CodeBuffer() : CodeBufferBase() {
12 | }
13 |
14 | public:
15 | arm64_inst_t LoadInst(uint32_t offset) {
16 | return *reinterpret_cast(GetBuffer() + offset);
17 | }
18 |
19 | void RewriteInst(uint32_t offset, arm64_inst_t instr) {
20 | *reinterpret_cast(GetBuffer() + offset) = instr;
21 | }
22 | };
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/UserMode/Thread/PlatformThread.cc:
--------------------------------------------------------------------------------
1 | #include "./PlatformThread.h"
2 |
3 | namespace zz {
4 | int OSThread::GetThreadLocalInt(LocalStorageKey key) {
5 | return static_cast(reinterpret_cast(GetThreadLocal(key)));
6 | }
7 |
8 | void OSThread::SetThreadLocalInt(LocalStorageKey key, int value) {
9 | SetThreadLocal(key, reinterpret_cast(static_cast(value)));
10 | }
11 |
12 | bool OSThread::HasThreadLocal(LocalStorageKey key) {
13 | return GetThreadLocal(key) != nullptr;
14 | }
15 |
16 | void *OSThread::GetExistingThreadLocal(LocalStorageKey key) {
17 | return GetThreadLocal(key);
18 | }
19 | } // namespace zz
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen-ia32.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_IA32)
3 |
4 | #include "core/codegen/codegen-ia32.h"
5 |
6 | namespace zz {
7 | namespace x86 {
8 |
9 | void CodeGen::JmpNear(uint32_t address) {
10 | TurboAssembler *turbo_assembler_ = reinterpret_cast(this->assembler_);
11 | #define _ turbo_assembler_->
12 | #define __ turbo_assembler_->GetCodeBuffer()->
13 | uint32_t currIP = turbo_assembler_->CurrentIP() + 5;
14 | int32_t offset = (int32_t)(address - currIP);
15 |
16 | __ Emit8(0xe9);
17 | __ Emit32(offset);
18 | }
19 |
20 | } // namespace x86
21 | } // namespace zz
22 |
23 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/benchmark/BENCHMARK.md:
--------------------------------------------------------------------------------
1 | # parallel-hashmap
2 |
3 | How to run these benchmarks
4 | ===========================
5 |
6 | These bencharks were run on windows using Visual Studio 2017, in a cygwin window with the VC++ 2017 compiler env vars (add something like this in your Cygwin.bat:
7 |
8 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
9 |
10 | Running them on linux would require Makefile changes.
11 |
12 | To build and run the tests, just update the path to the abseil libraries in the makefile, and run make.
13 |
14 | Your charts are now in charts.html.
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InstructionRelocation/x86/InstructionRelocationX86Shared.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/common.h"
4 |
5 | #include "MemoryAllocator/AssemblyCodeBuilder.h"
6 |
7 | #include "x86_insn_decode/x86_insn_decode.h"
8 |
9 | int GenRelocateCodeFixed(void *buffer, CodeMemBlock *origin, CodeMemBlock *relocated, bool branch);
10 |
11 | void GenRelocateCodeX86Shared(void *buffer, CodeMemBlock *origin, CodeMemBlock *relocated, bool branch);
12 |
13 | int GenRelocateSingleX86Insn(addr_t curr_orig_ip, addr_t curr_relo_ip, uint8_t *buffer_cursor, AssemblerBase *assembler,
14 | CodeBufferBase *code_buffer, x86_insn_decode_t &insn, int8_t mode);
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/Routing/FunctionInlineHook/FunctionInlineHookRouting.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/dobby_internal.h"
4 |
5 | #include "InterceptRouting/InterceptRouting.h"
6 |
7 | #include "TrampolineBridge/ClosureTrampolineBridge/ClosureTrampoline.h"
8 |
9 | class FunctionInlineHookRouting : public InterceptRouting {
10 | public:
11 | FunctionInlineHookRouting(InterceptEntry *entry, dobby_dummy_func_t replace_func) : InterceptRouting(entry) {
12 | this->replace_func = replace_func;
13 | }
14 |
15 | void DispatchRouting() override;
16 |
17 | private:
18 | void BuildRouting();
19 |
20 | private:
21 | dobby_dummy_func_t replace_func;
22 | };
23 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/Application.mk:
--------------------------------------------------------------------------------
1 | APP_CFLAGS := -Wall -Wextra
2 | APP_CFLAGS += -fno-stack-protector -fomit-frame-pointer
3 | APP_CFLAGS += -Wno-builtin-macro-redefined -D__FILE__=__FILE_NAME__ -Wno-gnu-string-literal-operator-template
4 | APP_CPPFLAGS := -std=c++20
5 | APP_CONLYFLAGS := -std=c18
6 | APP_STL := c++_shared
7 |
8 | ifneq ($(NDK_DEBUG),1)
9 | APP_CFLAGS += -Oz
10 | APP_CFLAGS += -Wno-unused -Wno-unused-parameter -Werror
11 | APP_CFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
12 | APP_CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables
13 | APP_LDFLAGS += -Wl,--exclude-libs,ALL -Wl,--gc-sections -Wl,--strip-all
14 | endif
15 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/xz/linux/scripts/xz_wrap.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # This is a wrapper for xz to compress the kernel image using appropriate
4 | # compression options depending on the architecture.
5 | #
6 | # Author: Lasse Collin
7 | #
8 | # This file has been put into the public domain.
9 | # You can do whatever you want with this file.
10 | #
11 |
12 | BCJ=
13 | LZMA2OPTS=
14 |
15 | case $SRCARCH in
16 | x86) BCJ=--x86 ;;
17 | powerpc) BCJ=--powerpc ;;
18 | ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;;
19 | arm) BCJ=--arm ;;
20 | sparc) BCJ=--sparc ;;
21 | esac
22 |
23 | exec xz --check=crc32 $BCJ --lzma2=$LZMA2OPTS,dict=32MiB
24 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen-arm64.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_ARM64)
3 |
4 | #include "dobby/dobby_internal.h"
5 | #include "core/codegen/codegen-arm64.h"
6 |
7 | namespace zz {
8 | namespace arm64 {
9 |
10 | void CodeGen::LiteralLdrBranch(uint64_t address) {
11 | auto turbo_assembler_ = reinterpret_cast(this->assembler_);
12 | #define _ turbo_assembler_->
13 |
14 | auto label = RelocLabel::withData(address);
15 | turbo_assembler_->AppendRelocLabel(label);
16 |
17 | _ Ldr(TMP_REG_0, label);
18 | _ br(TMP_REG_0);
19 |
20 | #undef _
21 | }
22 |
23 | } // namespace arm64
24 | } // namespace zz
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/f1.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Make sure that the phmap.h header builds fine when included in two separate
3 | * source files
4 | */
5 | #include
6 | #include
7 |
8 | using phmap::flat_hash_map;
9 |
10 | int main()
11 | {
12 | // Create an unordered_map of three strings (that map to strings)
13 | using Map = flat_hash_map;
14 | Map email =
15 | {
16 | { "tom", "tom@gmail.com"},
17 | { "jeff", "jk@gmail.com"},
18 | { "jim", "jimg@microsoft.com"}
19 | };
20 |
21 | extern void f2(Map&);
22 | f2(email);
23 |
24 | return 0;
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptEntry.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "dobby/common.h"
5 |
6 | typedef enum { kFunctionInlineHook, kInstructionInstrument } InterceptEntryType;
7 |
8 | class InterceptRouting;
9 |
10 | typedef struct InterceptEntry {
11 | uint32_t id;
12 | InterceptEntryType type;
13 | InterceptRouting *routing;
14 |
15 | union {
16 | addr_t addr;
17 | addr_t patched_addr;
18 | };
19 | uint32_t patched_size;
20 |
21 | addr_t relocated_addr;
22 | uint32_t relocated_size;
23 |
24 | uint8_t origin_insns[256];
25 | uint32_t origin_insn_size;
26 |
27 | bool thumb_mode;
28 |
29 | InterceptEntry(InterceptEntryType type, addr_t address);
30 | } InterceptEntry;
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/art/runtime/thread.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.hpp"
4 |
5 | namespace lsplant::art {
6 |
7 | class Thread {
8 | CREATE_FUNC_SYMBOL_ENTRY(Thread *, CurrentFromGdb) {
9 | if (CurrentFromGdbSym) [[likely]]
10 | return CurrentFromGdbSym();
11 | else
12 | return nullptr;
13 | }
14 |
15 | public:
16 | static Thread *Current() { return CurrentFromGdb(); }
17 |
18 | static bool Init(const HookHandler &handler) {
19 | if (!RETRIEVE_FUNC_SYMBOL(CurrentFromGdb, "_ZN3art6Thread14CurrentFromGdbEv"))
20 | [[unlikely]] {
21 | return false;
22 | }
23 | return true;
24 | }
25 | };
26 | } // namespace lsplant::art
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Vapp
3 | HomeActivity
4 | Open navigation drawer
5 | Close navigation drawer
6 | Android Studio
7 | android.studio@android.com
8 | Navigation header
9 | Settings
10 |
11 | Home
12 | Gallery
13 | Slideshow
14 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/f2.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Make sure that the phmap.h header builds fine when included in two separate
3 | * source files
4 | */
5 | #include
6 | #include
7 | #include
8 |
9 | using phmap::flat_hash_map;
10 | using Map = flat_hash_map;
11 |
12 | void f2(Map& email)
13 | {
14 | // Iterate and print keys and values
15 | for (const auto& n : email)
16 | std::cout << n.first << "'s email is: " << n.second << "\n";
17 |
18 | // Add a new entry
19 | email["bill"] = "bg@whatever.com";
20 |
21 | // and print it
22 | std::cout << "bill's email is: " << email["bill"] << "\n";
23 | }
24 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Vapp - 安卓12插件化开发框架 ---- 仅仅供初学者 学习 项目 还有很多不完善 可以说是乞丐中的乞丐 下面的话纯 装逼
2 |
3 | 简介
4 |
5 | Vapp是专为Android 12设计的轻量级插件化框架,支持动态加载Activity/Service组件、资源合并与Dex合并技术,实现应用多开功能。通过创新性的模块解耦方案,帮助开发者突破系统限制,打造高效灵活的插件化应用。
6 |
7 | 核心功能 ✨
8 |
9 | 1. 组件动态加载
10 | Activity/Service插件化:支持热插拔式加载未安装的插件组件
11 | 生命周期管理:完整代理宿主与插件的生命周期交互
12 | Intent兼容:支持显式/隐式Intent启动插件组件
13 |
14 | 3. 资源智能合并
15 | 多维度资源整合:自动合并drawable/layout/values等资源目录
16 | 资源冲突解决:基于哈希算法的智能资源覆盖策略
17 | 动态主题适配:支持插件与宿主主题的无缝融合
18 |
19 | 5. Dex优化方案
20 | 增量合并Dex:采用D8/R8优化器提升运行时性能
21 | 类加载隔离:定制ClassLoader防止类冲突
22 | 内存优化:实现插件Dex文件的按需加载
23 |
24 | 兼容性说明
25 |
26 | 特性 支持版本 备注
27 |
28 | Android API 12 (API 31) 仅适配Android 12+系统
29 | 架构 x86_64/arm64 暂不支持32位架构
30 | 安全机制 SELinux兼容 通过SELinux策略白名单
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/arch/CpuUtils.h:
--------------------------------------------------------------------------------
1 | #ifndef CPU_UTILITY_H
2 | #define CPU_UTILITY_H
3 |
4 | /* Define the default attributes for the functions in this file. */
5 | #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
6 |
7 | #if defined(__i386__) || defined(__x86_64__)
8 | static __inline__ void __DEFAULT_FN_ATTRS __cpuid(int __info[4], int __level) {
9 | __asm__("cpuid" : "=a"(__info[0]), "=b"(__info[1]), "=c"(__info[2]), "=d"(__info[3]) : "a"(__level));
10 | }
11 |
12 | static __inline__ void __DEFAULT_FN_ATTRS __cpuidex(int __info[4], int __level, int __ecx) {
13 | __asm__("cpuid" : "=a"(__info[0]), "=b"(__info[1]), "=c"(__info[2]), "=d"(__info[3]) : "a"(__level), "c"(__ecx));
14 | }
15 | #endif
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/cmake/DetectVersion.cmake:
--------------------------------------------------------------------------------
1 |
2 | file(READ "${CMAKE_CURRENT_SOURCE_DIR}/parallel_hashmap/phmap_config.h" _PHMAP_H_CONTENTS)
3 | string(REGEX REPLACE ".*#define PHMAP_VERSION_MAJOR ([0-9]+).*" "\\1" DETECTED_PHMAP_VERSION_MAJOR "${_PHMAP_H_CONTENTS}")
4 | string(REGEX REPLACE ".*#define PHMAP_VERSION_MINOR ([0-9]+).*" "\\1" DETECTED_PHMAP_VERSION_MINOR "${_PHMAP_H_CONTENTS}")
5 | string(REGEX REPLACE ".*#define PHMAP_VERSION_PATCH ([0-9]+).*" "\\1" DETECTED_PHMAP_VERSION_PATCH "${_PHMAP_H_CONTENTS}")
6 | set(DETECTED_PHMAP_VERSION "${DETECTED_PHMAP_VERSION_MAJOR}.${DETECTED_PHMAP_VERSION_MINOR}.${DETECTED_PHMAP_VERSION_PATCH}")
7 |
8 | message(STATUS "Detected PHMAP Version - ${DETECTED_PHMAP_VERSION}")
9 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/codegen/codegen-x64.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_X64)
3 |
4 | #include "core/codegen/codegen-x64.h"
5 |
6 | namespace zz {
7 | namespace x64 {
8 |
9 | void CodeGen::JmpNearIndirect(addr_t forward_stub_addr) {
10 | TurboAssembler *turbo_assembler_ = reinterpret_cast(this->assembler_);
11 | #define _ turbo_assembler_->
12 | #define __ turbo_assembler_->GetCodeBuffer()->
13 | uint64_t currIP = turbo_assembler_->CurrentIP() + 6;
14 | int32_t offset = (int32_t)(forward_stub_addr - currIP);
15 |
16 | // jmp *(rip + disp32)
17 | __ Emit8(0xFF);
18 | __ Emit8(0x25); // ModR/M: 00 100 101
19 | __ Emit32(offset);
20 | }
21 |
22 | } // namespace x64
23 | } // namespace zz
24 |
25 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/html/latex_macros:
--------------------------------------------------------------------------------
1 | \newcommand{\andalso}{\quad\quad}
2 | \newcommand{\infabbrev}[2]{\infax{#1 \quad\eqdef\quad #2}}
3 | \newcommand{\infrule}[2]{\displaystyle \dfrac{#1}{#2}}
4 | \newcommand{\ar}{\rightarrow}
5 | \newcommand{\Int}{\mathtt{Int}}
6 | \newcommand{\Bool}{\mathtt{Bool}}
7 | \newcommand{\becomes}{\Downarrow}
8 | \newcommand{\trule}[1]{(\textbf{#1})}
9 | \newcommand{\FV}[1]{\mathtt{fv}(#1)}
10 | \newcommand{\FTV}[1]{\mathtt{ftv}(#1)}
11 | \newcommand{\BV}[1]{\mathtt{bv}(#1)}
12 | \newcommand{\compiles}[1]{\text{C}\llbracket{#1}\rrbracket}
13 | \newcommand{\exec}[1]{\text{E}\llbracket{#1}\rrbracket}
14 | \renewcommand{\t}[1]{\mathtt{#1}}
15 | \newcommand{\ite}[3]{\text{if }#1\text{ then }#2\text{ else }#3}
16 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/cmake/Util.cmake:
--------------------------------------------------------------------------------
1 | # Check files list exist
2 | function(check_files_exist CHECK_FILES)
3 | foreach(file ${CHECK_FILES})
4 | if(NOT EXISTS "${file}")
5 | message(FATAL_ERROR "${file} NOT EXISTS!")
6 | endif()
7 | endforeach()
8 | endfunction(check_files_exist CHECK_FILES)
9 |
10 | # Search suffix files
11 | function(search_suffix_files suffix INPUT_VARIABLE OUTPUT_VARIABLE)
12 | set(ResultFiles )
13 | foreach(filePath ${${INPUT_VARIABLE}})
14 | # message(STATUS "[*] searching *.${suffix} from ${filePath}")
15 | file(GLOB files ${filePath}/*.${suffix})
16 | set(ResultFiles ${ResultFiles} ${files})
17 | endforeach()
18 | set(${OUTPUT_VARIABLE} ${ResultFiles} PARENT_SCOPE)
19 | endfunction()
20 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/SupervisorCallMonitor/supervisor_call_monitor.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | typedef uintptr_t addr_t;
5 |
6 | #include "dobby.h"
7 |
8 | void supervisor_call_monitor_init();
9 |
10 | void supervisor_call_monitor_register_handler(DBICallTy handler);
11 |
12 | void supervisor_call_monitor_register_svc(addr_t svc_addr);
13 |
14 | void supervisor_call_monitor_register_image(void *header);
15 |
16 | void supervisor_call_monitor_register_main_app();
17 |
18 | void supervisor_call_monitor_register_system_kernel();
19 |
20 | void supervisor_call_monitor_register_syscall_call_log_handler();
21 |
22 | void supervisor_call_monitor_register_mach_syscall_call_log_handler();
23 |
24 | void supervisor_call_monitor_register_sensitive_api_handler();
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/external/deprecated/misc-helper/deprecated/unistd_helper.h:
--------------------------------------------------------------------------------
1 | #ifdef _WIN32
2 |
3 | #include
4 | #define open _open
5 | #define read _read
6 | #define O_RDONLY _O_RDONLY
7 | #define O_WRONLY _O_WRONLY
8 | #define O_CREAT _O_CREAT
9 | #define O_TRUNC _O_TRUNC
10 |
11 | #define ssize_t int
12 |
13 | #define STDIN_FILENO 0
14 | #define STDOUT_FILENO 1
15 | #define STDERR_FILENO 2
16 | /* should be in some equivalent to */
17 | typedef __int8 int8_t;
18 | typedef __int16 int16_t;
19 | typedef __int32 int32_t;
20 | typedef __int64 int64_t;
21 | typedef unsigned __int8 uint8_t;
22 | typedef unsigned __int16 uint16_t;
23 | typedef unsigned __int32 uint32_t;
24 | typedef unsigned __int64 uint64_t;
25 |
26 | #else
27 |
28 | #include
29 |
30 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/dobby/pac_kit.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #if defined(__arm64e__) && __has_feature(ptrauth_calls)
6 | #include
7 | #endif
8 |
9 | static inline void *pac_strip(void *addr) {
10 | if (addr == NULL) {
11 | return NULL;
12 | }
13 | #if __has_feature(ptrauth_calls)
14 | addr = ptrauth_strip(addr, ptrauth_key_asia);
15 | #endif
16 | return addr;
17 | }
18 |
19 | static inline void *pac_sign(void *addr) {
20 | if (addr == NULL) {
21 | return NULL;
22 | }
23 | #if __has_feature(ptrauth_calls)
24 | addr = ptrauth_sign_unauthenticated((void *)addr, ptrauth_key_asia, 0);
25 | #endif
26 | return addr;
27 | }
28 |
29 | static inline void *pac_strip_and_sign(void *addr) {
30 | return pac_sign(pac_strip(addr));
31 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/KernelMode/PlatformUtil/ProcessRuntimeUtility.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "PlatformUnifiedInterface/MemoryAllocator.h"
4 |
5 | #include "UnifiedInterface/platform.h"
6 |
7 | typedef struct _RuntimeModule {
8 | char path[1024];
9 | void *load_address;
10 | } RuntimeModule;
11 |
12 | struct MemRegion : MemRange {
13 | MemoryPermission permission;
14 | MemRegion(addr_t addr, size_t size, MemoryPermission perm) : MemRange(addr, size), permission(perm) {
15 | }
16 | };
17 |
18 | class ProcessRuntimeUtility {
19 | public:
20 | static const tinystl::vector &GetProcessMemoryLayout();
21 |
22 | static const tinystl::vector *GetProcessModuleMap();
23 |
24 | static RuntimeModule GetProcessModule(const char *name);
25 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/UserMode/PlatformUtil/ProcessRuntimeUtility.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "PlatformUnifiedInterface/MemoryAllocator.h"
4 |
5 | #include "UnifiedInterface/platform.h"
6 |
7 | typedef struct _RuntimeModule {
8 | char path[1024];
9 | void *load_address;
10 | } RuntimeModule;
11 |
12 | struct MemRegion : MemRange {
13 | MemoryPermission permission;
14 |
15 | MemRegion(addr_t addr, size_t size, MemoryPermission perm) : MemRange(addr, size), permission(perm) {
16 | }
17 | };
18 |
19 | class ProcessRuntimeUtility {
20 | public:
21 | static const tinystl::vector &GetProcessMemoryLayout();
22 |
23 | static const tinystl::vector &GetProcessModuleMap();
24 |
25 | static RuntimeModule GetProcessModule(const char *name);
26 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/hash_std.cc:
--------------------------------------------------------------------------------
1 | #include "hash_std.h" // defines Person with std::hash specialization
2 |
3 | #include
4 | #include
5 |
6 | int main()
7 | {
8 | // As we have defined a specialization of std::hash() for Person,
9 | // we can now create sparse_hash_set or sparse_hash_map of Persons
10 | // ----------------------------------------------------------------
11 | phmap::flat_hash_set persons =
12 | { { "John", "Mitchell", 35 },
13 | { "Jane", "Smith", 32 },
14 | { "Jane", "Smith", 30 },
15 | };
16 |
17 | for (auto& p: persons)
18 | std::cout << p._first << ' ' << p._last << " (" << p._age << ")" << '\n';
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/crack/vapp/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp;
2 |
3 | import android.content.Context;
4 |
5 |
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | //@RunWith(AndroidJUnit4.class)
18 | //public class ExampleInstrumentedTest {
19 | // @Test
20 | // public void useAppContext() {
21 | // // Context of the app under test.
22 | // Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23 | // assertEquals("com.crack.vapp", appContext.getPackageName());
24 | // }
25 | //}
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/Routing/FunctionInlineHook/RoutingImpl.cc:
--------------------------------------------------------------------------------
1 | #include "dobby/dobby_internal.h"
2 | #include "InterceptRouting/Routing/FunctionInlineHook/FunctionInlineHookRouting.h"
3 |
4 | void FunctionInlineHookRouting::BuildRouting() {
5 | SetTrampolineTarget((addr_t)replace_func);
6 |
7 | // generate trampoline buffer, run before GenerateRelocatedCode
8 | addr_t from = entry_->patched_addr;
9 | #if defined(TARGET_ARCH_ARM)
10 | if (entry_->thumb_mode)
11 | from += 1;
12 | #endif
13 | addr_t to = GetTrampolineTarget();
14 | GenerateTrampolineBuffer(from, to);
15 | }
16 |
17 | void FunctionInlineHookRouting::DispatchRouting() {
18 | BuildRouting();
19 |
20 | // generate relocated code which size == trampoline size
21 | GenerateRelocatedCode();
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/assembler/assembler-arch.h:
--------------------------------------------------------------------------------
1 | #ifndef CORE_ASSEMBLER_ARCH_H
2 | #define CORE_ASSEMBLER_ARCH_H
3 |
4 | #include "src/assembler.h"
5 |
6 | #if 0
7 | #if TARGET_ARCH_IA32
8 | #include "src/ia32/assembler-ia32.h"
9 | #elif TARGET_ARCH_X64
10 | #include "src/x64/assembler-x64.h"
11 | #elif TARGET_ARCH_ARM64
12 | #include "src/arm64/assembler-arm64.h"
13 | #elif TARGET_ARCH_ARM
14 | #include "src/arm/assembler-arm.h"
15 | #elif TARGET_ARCH_PPC
16 | #include "src/ppc/assembler-ppc.h"
17 | #elif TARGET_ARCH_MIPS
18 | #include "src/mips/assembler-mips.h"
19 | #elif TARGET_ARCH_MIPS64
20 | #include "src/mips64/assembler-mips64.h"
21 | #elif TARGET_ARCH_S390
22 | #include "src/s390/assembler-s390.h"
23 | #else
24 | #error Unknown architecture.
25 | #endif
26 | #endif
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/hash_value.cc:
--------------------------------------------------------------------------------
1 | #include "hash_value.h" // defines Person with std::hash specialization
2 |
3 | #include
4 | #include
5 |
6 | int main()
7 | {
8 | // As we have defined a specialization of std::hash() for Person,
9 | // we can now create sparse_hash_set or sparse_hash_map of Persons
10 | // ----------------------------------------------------------------
11 | phmap::flat_hash_set persons =
12 | { { "John", "Mitchell", 35 },
13 | { "Jane", "Smith", 32 },
14 | { "Jane", "Smith", 30 },
15 | };
16 |
17 | for (auto& p: persons)
18 | std::cout << p._first << ' ' << p._last << " (" << p._age << ")" << '\n';
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/.github/workflows/linux.yml:
--------------------------------------------------------------------------------
1 | name: Linux
2 |
3 | on:
4 | push:
5 | pull_request:
6 | branches: [ master ]
7 |
8 | jobs:
9 | build:
10 | runs-on: ${{ matrix.os }}
11 | strategy:
12 | matrix:
13 | os: [ubuntu-latest]
14 | compiler: [g++, clang++]
15 | flags: [-std=c++11, -std=c++17]
16 | optimize: [-O2]
17 | steps:
18 | - name: Checkout
19 | uses: actions/checkout@v2.0.0
20 | - name: Build and test
21 | env:
22 | CXX: ${{ matrix.compiler }}
23 | CXXFLAGS: ${{ matrix.flags }} ${{ matrix.optimize }}
24 | run: |
25 | mkdir build && cd build && cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release .. && cmake --build . && make test
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/.github/workflows/macos.yml:
--------------------------------------------------------------------------------
1 | name: MacOS
2 |
3 | on:
4 | push:
5 | pull_request:
6 | branches: [ master ]
7 |
8 | jobs:
9 | build:
10 | runs-on: ${{ matrix.os }}
11 | strategy:
12 | matrix:
13 | os: [macos-latest]
14 | compiler: [g++, clang++]
15 | flags: [-std=c++11, -std=c++17]
16 | optimize: [-O2]
17 | steps:
18 | - name: Checkout
19 | uses: actions/checkout@v2.0.0
20 | - name: Build and test
21 | env:
22 | CXX: ${{ matrix.compiler }}
23 | CXXFLAGS: ${{ matrix.flags }} ${{ matrix.optimize }}
24 | run: |
25 | mkdir build && cd build && cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release .. && cmake --build . && make test
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/SymbolResolver/pe/dobby_symbol_resolver.cc:
--------------------------------------------------------------------------------
1 | #include "SymbolResolver/dobby_symbol_resolver.h"
2 | #include "dobby/common.h"
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | #include "PlatformUtil/ProcessRuntimeUtility.h"
10 |
11 | #include
12 |
13 | #undef LOG_TAG
14 | #define LOG_TAG "DobbySymbolResolver"
15 |
16 | PUBLIC void *DobbySymbolResolver(const char *image_name, const char *symbol_name_pattern) {
17 | void *result = NULL;
18 |
19 | HMODULE hMod = LoadLibraryExA(image_name, NULL, DONT_RESOLVE_DLL_REFERENCES);
20 | result = GetProcAddress(hMod, symbol_name_pattern);
21 | if (result)
22 | return result;
23 |
24 | //result = resolve_elf_internal_symbol(image_name, symbol_name_pattern);
25 | return result;
26 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/assembler/assembler-arm64.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if TARGET_ARCH_ARM64
3 |
4 | #include "core/assembler/assembler-arm64.h"
5 |
6 | void AssemblerPseudoLabel::link_confused_instructions(CodeBufferBase *buffer_) {
7 | auto buffer = (CodeBuffer *)buffer_;
8 |
9 | for (auto &ref_label_insn : ref_label_insns_) {
10 | int64_t fixup_offset = pos() - ref_label_insn.pc_offset;
11 |
12 | arm64_inst_t inst = buffer->LoadInst(ref_label_insn.pc_offset);
13 | arm64_inst_t new_inst = 0;
14 |
15 | if (ref_label_insn.link_type == kLabelImm19) {
16 | new_inst = encode_imm19_offset(inst, fixup_offset);
17 | }
18 |
19 | buffer->RewriteInst(ref_label_insn.pc_offset, new_inst);
20 | }
21 | }
22 |
23 | using namespace zz::arm64;
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/UserMode/MultiThreadSupport/ThreadSupport.cpp:
--------------------------------------------------------------------------------
1 | #include "MultiThreadSupport/ThreadSupport.h"
2 |
3 | using namespace zz;
4 |
5 | OSThread::LocalStorageKey ThreadSupport::thread_callstack_key_ = 0;
6 |
7 | // Get current CallStack
8 | CallStack *ThreadSupport::CurrentThreadCallStack() {
9 |
10 | // TODO: __attribute__((destructor)) is better ?
11 | if (!thread_callstack_key_) {
12 | thread_callstack_key_ = OSThread::CreateThreadLocalKey();
13 | }
14 |
15 | if (OSThread::HasThreadLocal(thread_callstack_key_)) {
16 | return static_cast(OSThread::GetThreadLocal(thread_callstack_key_));
17 | } else {
18 | CallStack *callstack = new CallStack();
19 | OSThread::SetThreadLocal(thread_callstack_key_, callstack);
20 | return callstack;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/UserMode/ExecMemory/code-patch-tool-windows.cc:
--------------------------------------------------------------------------------
1 | #include "dobby/dobby_internal.h"
2 |
3 | #include
4 |
5 | using namespace zz;
6 |
7 | PUBLIC int DobbyCodePatch(void *address, uint8_t *buffer, uint32_t buffer_size) {
8 | DWORD oldProtect;
9 | int page_size;
10 |
11 | // Get page size
12 | SYSTEM_INFO si;
13 | GetSystemInfo(&si);
14 | page_size = si.dwPageSize;
15 |
16 | void *addressPageAlign = (void *)ALIGN(address, page_size);
17 |
18 | if (!VirtualProtect(addressPageAlign, page_size, PAGE_EXECUTE_READWRITE, &oldProtect))
19 | return kMemoryOperationError;
20 |
21 | memcpy(address, buffer, buffer_size);
22 |
23 | if (!VirtualProtect(addressPageAlign, page_size, oldProtect, &oldProtect))
24 | return kMemoryOperationError;
25 |
26 | return 0;
27 | }
28 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_add_app.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/.github/workflows/windows.yml:
--------------------------------------------------------------------------------
1 | name: Windows
2 |
3 | on:
4 | push:
5 | pull_request:
6 | branches: [ master ]
7 |
8 | jobs:
9 | build:
10 | runs-on: ${{ matrix.os }}
11 | strategy:
12 | matrix:
13 | os: [windows-latest]
14 | flags: ["/std:c++11", "/std:c++latest"]
15 | optimize: [/O2]
16 | steps:
17 | - name: Checkout
18 | uses: actions/checkout@v2.0.0
19 | - name: Build and test
20 | env:
21 | CXX: ${{ matrix.compiler }}
22 | CXXFLAGS: ${{ matrix.flags }} ${{ matrix.optimize }}
23 | CTEST_OUTPUT_ON_FAILURE: 1
24 | run: |
25 | cmake -Bbuild -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release && cmake --build build --target ALL_BUILD && cmake --build build --target RUN_TESTS
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/UserMode/Thread/PlatformThread.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/common.h"
4 |
5 | namespace zz {
6 |
7 | class OSThread {
8 | public:
9 | typedef int LocalStorageKey;
10 |
11 | static int GetCurrentProcessId();
12 |
13 | static int GetCurrentThreadId();
14 |
15 | static LocalStorageKey CreateThreadLocalKey();
16 |
17 | static void DeleteThreadLocalKey(LocalStorageKey key);
18 |
19 | static void *GetThreadLocal(LocalStorageKey key);
20 |
21 | static int GetThreadLocalInt(LocalStorageKey key);
22 |
23 | static void SetThreadLocal(LocalStorageKey key, void *value);
24 |
25 | static void SetThreadLocalInt(LocalStorageKey key, int value);
26 |
27 | static bool HasThreadLocal(LocalStorageKey key);
28 |
29 | static void *GetExistingThreadLocal(LocalStorageKey key);
30 | };
31 |
32 | } // namespace zz
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/KernelMode/UnifiedInterface/platform.h:
--------------------------------------------------------------------------------
1 | #ifndef PLATFORM_INTERFACE_COMMON_PLATFORM_H
2 | #define PLATFORM_INTERFACE_COMMON_PLATFORM_H
3 |
4 | #include "dobby/common.h"
5 |
6 | // ================================================================
7 | // base :: OSMemory
8 |
9 | enum MemoryPermission { kNoAccess, kRead, kReadWrite, kReadWriteExecute, kReadExecute };
10 |
11 | class OSMemory {
12 | public:
13 | static int PageSize();
14 |
15 | static void *Allocate(size_t size, MemoryPermission access);
16 |
17 | static void *Allocate(size_t size, MemoryPermission access, void *fixed_address);
18 |
19 | static bool Free(void *address, size_t size);
20 |
21 | static bool Release(void *address, size_t size);
22 |
23 | static bool SetPermission(void *address, size_t size, MemoryPermission access);
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/scripts/setup_macos_cross_compile.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -x
4 | set -e
5 |
6 | mkdir -p ~/opt
7 |
8 | cd ~/opt
9 | CMAKE_VERSION=3.25.2
10 | CMAKE_DOWNLOAD_PACKAGE=cmake-$CMAKE_VERSION-macos-universal
11 | wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/$CMAKE_DOWNLOAD_PACKAGE.tar.gz &&
12 | tar -zxf $CMAKE_DOWNLOAD_PACKAGE.tar.gz >/dev/null &&
13 | mv $CMAKE_DOWNLOAD_PACKAGE cmake-$CMAKE_VERSION
14 | CMAKE_HOME=~/opt/cmake-$CMAKE_VERSION
15 |
16 | cd ~/opt
17 | LLVM_VERSION=15.0.6
18 | LLVM_DOWNLOAD_PACKAGE=clang+llvm-$LLVM_VERSION-x86_64-apple-darwin
19 | wget https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/$LLVM_DOWNLOAD_PACKAGE.tar.xz &&
20 | tar -xf $LLVM_DOWNLOAD_PACKAGE.tar.xz >/dev/null &&
21 | mv $LLVM_DOWNLOAD_PACKAGE llvm-$LLVM_VERSION
22 | LLVM_HOME=~/opt/llvm-$LLVM_VERSION
23 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/basic.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | using phmap::flat_hash_map;
6 |
7 | int main()
8 | {
9 | // Create an unordered_map of three strings (that map to strings)
10 | flat_hash_map email =
11 | {
12 | { "tom", "tom@gmail.com"},
13 | { "jeff", "jk@gmail.com"},
14 | { "jim", "jimg@microsoft.com"}
15 | };
16 |
17 | // Iterate and print keys and values
18 | for (const auto& n : email)
19 | std::cout << n.first << "'s email is: " << n.second << "\n";
20 |
21 | // Add a new entry
22 | email["bill"] = "bg@whatever.com";
23 |
24 | // and print it
25 | std::cout << "bill's email is: " << email["bill"] << "\n";
26 |
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/de/robv/android/xposed/callbacks/IXUnhook.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of AliuHook, a library providing XposedAPI bindings to LSPlant
3 | * Copyright (c) 2021 Juby210 & Vendicated
4 | * Licensed under the Open Software License version 3.0
5 | *
6 | * Originally written by rovo89 as part of the original Xposed
7 | * Copyright 2013 rovo89, Tungstwenty
8 | * Licensed under the Apache License, Version 2.0, see http://www.apache.org/licenses/LICENSE-2.0
9 | */
10 |
11 | package de.robv.android.xposed.callbacks;
12 |
13 | /**
14 | * Interface for objects that can be used to remove callbacks.
15 | *
16 | * @param The class of the callback.
17 | */
18 | @SuppressWarnings({"unused"})
19 | public interface IXUnhook {
20 | /**
21 | * Returns the callback that has been registered.
22 | */
23 | T getCallback();
24 |
25 | /**
26 | * Removes the callback.
27 | */
28 | void unhook();
29 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_app.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
15 |
16 |
17 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/CodeBuffer/CodeBufferBase.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/common.h"
4 |
5 | class CodeBufferBase {
6 | public:
7 | CodeBufferBase() {
8 | }
9 |
10 | public:
11 | virtual CodeBufferBase *Copy();
12 |
13 | void Emit8(uint8_t data);
14 |
15 | void Emit16(uint16_t data);
16 |
17 | void Emit32(uint32_t data);
18 |
19 | void Emit64(uint64_t data);
20 |
21 | template T Load(int offset) {
22 | return *(T *)(buffer_.data() + offset);
23 | }
24 |
25 | template void Store(int offset, T value) {
26 | *(T *)(buffer_.data() + offset) = value;
27 | }
28 |
29 | template void Emit(T value) {
30 | EmitBuffer((uint8_t *)&value, sizeof(value));
31 | }
32 |
33 | void EmitBuffer(uint8_t *buffer, int len);
34 |
35 | uint8_t *GetBuffer();
36 | size_t GetBufferSize();
37 |
38 | private:
39 | tinystl::vector buffer_;
40 | };
41 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/ClosureTrampoline.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/dobby_internal.h"
4 |
5 | #ifdef ENABLE_CLOSURE_TRAMPOLINE_TEMPLATE
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif //__cplusplus
9 | void closure_trampoline_template();
10 | void closure_bridge_template();
11 | #ifdef __cplusplus
12 | }
13 | #endif //__cplusplus
14 | #endif
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif //__cplusplus
19 |
20 | typedef struct {
21 | void *address;
22 | int size;
23 | void *carry_handler;
24 | void *carry_data;
25 | } ClosureTrampolineEntry;
26 |
27 | asm_func_t get_closure_bridge();
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif //__cplusplus
32 |
33 | class ClosureTrampoline {
34 | private:
35 | static tinystl::vector *trampolines_;
36 |
37 | public:
38 | static ClosureTrampolineEntry *CreateClosureTrampoline(void *carry_data, void *carry_handler);
39 | };
40 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/UserMode/ExecMemory/substrated/mach_interface_support/substrated.defs:
--------------------------------------------------------------------------------
1 | /*
2 | * Regenerate with:
3 | *
4 | * $(xcrun --sdk macosx -f mig) \
5 | * -isysroot $(xcrun --sdk macosx --show-sdk-path) \
6 | * -sheader substratedserver.h \
7 | * -server substratedserver.c \
8 | * -header substratedclient.h \
9 | * -user substratedclient.c \
10 | * substrated.defs
11 | */
12 |
13 | subsystem substrated 9000;
14 |
15 | #include
16 | #include
17 |
18 | routine substrated_mark(server
19 | : mach_port_t;
20 | task
21 | : vm_task_entry_t;
22 | source_address
23 | : mach_vm_address_t;
24 | source_size
25 | : mach_vm_size_t;
26 | inout target_address
27 | : mach_vm_address_t);
28 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/Routing/FunctionWrapper/FunctionWrapperExport.cc:
--------------------------------------------------------------------------------
1 | #include "dobby/dobby_internal.h"
2 |
3 | #include "logging/logging.h"
4 |
5 | #include "Interceptor.h"
6 | #include "InterceptRouting/InterceptRouting.h"
7 |
8 | #include "function-wrapper.h"
9 |
10 | PUBLIC int DobbyWrap(void *function_address, PreCallTy pre_call, PostCallTy post_call) {
11 | DEBUG_LOG("Initialize 'DobbyWrap' hook at %p", function_address);
12 |
13 | Interceptor *interceptor = Interceptor::SharedInstance();
14 |
15 | InterceptEntry *entry = new InterceptEntry();
16 | entry->id = interceptor->entries->getCount();
17 | entry->type = kFunctionWrapper;
18 | entry->function_address = function_address;
19 |
20 | FunctionWrapperRouting *routing = new FunctionWrapperRouting(entry);
21 | routing->DispatchRouting();
22 | interceptor->addHookEntry(entry);
23 | routing->Commit();
24 |
25 | DEBUG_LOG("Finalize %p", function_address);
26 | return 0;
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/RoutingPlugin/RoutingPlugin.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/dobby_internal.h"
4 |
5 | #include "InterceptRouting/InterceptRouting.h"
6 |
7 | class RoutingPluginInterface {
8 | public:
9 | // @Return: if false will continue to iter next plugin
10 | virtual bool Prepare(InterceptRouting *routing) = 0;
11 |
12 | // @Return: if false will continue to iter next plugin
13 | virtual bool Active(InterceptRouting *routing) = 0;
14 |
15 | // @Return: if false will continue to iter next plugin
16 | virtual bool GenerateTrampolineBuffer(InterceptRouting *routing, addr_t src, addr_t dst) = 0;
17 |
18 | private:
19 | char name_[256];
20 | };
21 |
22 | class RoutingPluginManager {
23 | public:
24 | static void registerPlugin(const char *name, RoutingPluginInterface *plugin);
25 |
26 | public:
27 | static tinystl::vector plugins;
28 |
29 | static RoutingPluginInterface *near_branch_trampoline;
30 | };
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crack/vapp/test/testService.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp.test;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.IBinder;
6 | import android.util.Log;
7 |
8 | public class testService extends Service {
9 |
10 | static String TAG = "testService";
11 | public testService() {
12 | }
13 |
14 | @Override
15 | public void onCreate() {
16 | Log.d(TAG, "onCreate: 代理 testService 运行 .... 理论上 不会运行");
17 | super.onCreate();
18 | }
19 |
20 | @Override
21 | public int onStartCommand(Intent intent, int flags, int startId) {
22 | Log.d(TAG, "onStartCommand: 代理 testService 运行 .... 理论上 不会运行");
23 | return super.onStartCommand(intent, flags, startId);
24 | }
25 |
26 | @Override
27 | public IBinder onBind(Intent intent) {
28 | // TODO: Return the communication channel to the service.
29 | throw new UnsupportedOperationException("Not yet implemented");
30 | }
31 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := lsplant
6 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/external/dex_builder/include
7 | LOCAL_SRC_FILES := lsplant.cc
8 | LOCAL_EXPORT_C_INCLUDES:= $(LOCAL_PATH)/include
9 | LOCAL_SHARED_LIBRARIES := dex_builder
10 | LOCAL_LDLIBS := -llog
11 | LOCAL_EXPORT_LDLIBS := $(LOCAL_LDLIBS)
12 | LOCAL_CFLAGS := -flto
13 | LOCAL_LDFLAGS := -flto
14 | include $(BUILD_SHARED_LIBRARY)
15 |
16 | include $(CLEAR_VARS)
17 |
18 | LOCAL_MODULE := lsplant_static
19 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/external/dex_builder/include
20 | LOCAL_SRC_FILES := lsplant.cc
21 | LOCAL_EXPORT_C_INCLUDES:= $(LOCAL_PATH)/include
22 | LOCAL_STATIC_LIBRARIES := dex_builder_static
23 | LOCAL_EXPORT_LDLIBS := -llog
24 | include $(BUILD_STATIC_LIBRARY)
25 |
26 | include jni/external/dex_builder/Android.mk
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/Routing/InstructionInstrument/InstructionInstrumentRouting.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dobby/dobby_internal.h"
4 |
5 | #include "InterceptRouting/InterceptRouting.h"
6 |
7 | #include "TrampolineBridge/ClosureTrampolineBridge/ClosureTrampoline.h"
8 |
9 | class InstructionInstrumentRouting : public InterceptRouting {
10 | public:
11 | InstructionInstrumentRouting(InterceptEntry *entry, dobby_instrument_callback_t pre_handler,
12 | dobby_instrument_callback_t post_handler)
13 | : InterceptRouting(entry) {
14 | this->prologue_dispatch_bridge = nullptr;
15 | this->pre_handler = pre_handler;
16 | this->post_handler = post_handler;
17 | }
18 |
19 | void DispatchRouting() override;
20 |
21 | private:
22 | void BuildRouting();
23 |
24 | public:
25 | dobby_instrument_callback_t pre_handler;
26 | dobby_instrument_callback_t post_handler;
27 |
28 | private:
29 | void *prologue_dispatch_bridge;
30 | };
31 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/log.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of AliuHook, a library providing XposedAPI bindings to LSPlant
3 | * Copyright (c) 2021 Juby210 & Vendicated
4 | * Licensed under the Open Software License version 3.0
5 | */
6 |
7 | #pragma clang diagnostic push
8 | #pragma ide diagnostic ignored "OCUnusedMacroInspection"
9 |
10 | #ifndef ALIUHOOK_LOG_H
11 | #define ALIUHOOK_LOG_H
12 |
13 | #include
14 |
15 | #define LOG_TAG "AliuHook"
16 |
17 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
18 | #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
19 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
20 | #define LOGF(...) __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__)
21 |
22 | #ifdef NDEBUG
23 | #define LOGD(...)
24 | #else
25 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
26 | #endif
27 |
28 | #endif //ALIUHOOK_LOG_H
29 |
30 | #pragma clang diagnostic pop
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/xz/linux/lib/xz/xz_dec_syms.c:
--------------------------------------------------------------------------------
1 | /*
2 | * XZ decoder module information
3 | *
4 | * Author: Lasse Collin
5 | *
6 | * This file has been put into the public domain.
7 | * You can do whatever you want with this file.
8 | */
9 |
10 | #include
11 | #include
12 |
13 | EXPORT_SYMBOL(xz_dec_init);
14 | EXPORT_SYMBOL(xz_dec_reset);
15 | EXPORT_SYMBOL(xz_dec_run);
16 | EXPORT_SYMBOL(xz_dec_end);
17 |
18 | #ifdef CONFIG_XZ_DEC_MICROLZMA
19 | EXPORT_SYMBOL(xz_dec_microlzma_alloc);
20 | EXPORT_SYMBOL(xz_dec_microlzma_reset);
21 | EXPORT_SYMBOL(xz_dec_microlzma_run);
22 | EXPORT_SYMBOL(xz_dec_microlzma_end);
23 | #endif
24 |
25 | MODULE_DESCRIPTION("XZ decompressor");
26 | MODULE_VERSION("1.1");
27 | MODULE_AUTHOR("Lasse Collin and Igor Pavlov");
28 |
29 | /*
30 | * This code is in the public domain, but in Linux it's simplest to just
31 | * say it's GPL and consider the authors as the copyright holders.
32 | */
33 | MODULE_LICENSE("GPL");
34 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/README.md:
--------------------------------------------------------------------------------
1 | ## Dobby
2 |
3 | [](https://t.me/IOFramebuffer) [](https://t.me/dobby_group)
4 |
5 | Dobby a lightweight, multi-platform, multi-architecture exploit hook framework.
6 |
7 | - Minimal and modular library
8 | - Multi-platform support(Windows/macOS/iOS/Android/Linux)
9 | - Multiple architecture support(X86, X86-64, ARM, ARM64)
10 |
11 | ## Compile
12 |
13 | [docs/compile.md](docs/compile.md)
14 |
15 | ## Download
16 |
17 | [download latest library](https://github.com/jmpews/Dobby/releases/tag/latest)
18 |
19 | ## Credits
20 |
21 | 1. [frida-gum](https://github.com/frida/frida-gum)
22 | 2. [minhook](https://github.com/TsudaKageyu/minhook)
23 | 3. [substrate](https://github.com/jevinskie/substrate).
24 | 4. [v8](https://github.com/v8/v8)
25 | 5. [dart](https://github.com/dart-lang/sdk)
26 | 6. [vixl](https://git.linaro.org/arm/vixl.git)
27 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/dobby.cpp:
--------------------------------------------------------------------------------
1 | #include "dobby/dobby_internal.h"
2 | #include "Interceptor.h"
3 |
4 | __attribute__((constructor)) static void ctor() {
5 | DEBUG_LOG("================================");
6 | DEBUG_LOG("Dobby");
7 | DEBUG_LOG("dobby in debug log mode, disable with cmake flag \"-DDOBBY_DEBUG=OFF\"");
8 | DEBUG_LOG("================================");
9 | }
10 |
11 | PUBLIC const char *DobbyGetVersion() {
12 | return __DOBBY_BUILD_VERSION__;
13 | }
14 |
15 | PUBLIC int DobbyDestroy(void *address) {
16 | #if defined(TARGET_ARCH_ARM)
17 | if ((addr_t)address % 2) {
18 | address = (void *)((addr_t)address - 1);
19 | }
20 | #endif
21 | auto entry = Interceptor::SharedInstance()->find((addr_t)address);
22 | if (entry) {
23 | uint8_t *buffer = entry->origin_insns;
24 | uint32_t buffer_size = entry->origin_insn_size;
25 | DobbyCodePatch(address, buffer, buffer_size);
26 | Interceptor::SharedInstance()->remove((addr_t)address);
27 | return 0;
28 | }
29 |
30 | return -1;
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Interceptor.cpp:
--------------------------------------------------------------------------------
1 | #include "Interceptor.h"
2 |
3 | Interceptor *Interceptor::instance = nullptr;
4 |
5 | Interceptor *Interceptor::SharedInstance() {
6 | if (Interceptor::instance == nullptr) {
7 | Interceptor::instance = new Interceptor();
8 | }
9 | return Interceptor::instance;
10 | }
11 |
12 | InterceptEntry *Interceptor::find(addr_t addr) {
13 | for (auto *entry : entries) {
14 | if (entry->patched_addr == addr) {
15 | return entry;
16 | }
17 | }
18 | return nullptr;
19 | }
20 |
21 | void Interceptor::add(InterceptEntry *entry) {
22 | entries.push_back(entry);
23 | }
24 |
25 | void Interceptor::remove(addr_t addr) {
26 | for (auto iter = entries.begin(); iter != entries.end(); iter++) {
27 | if ((*iter)->patched_addr == addr) {
28 | entries.erase(iter);
29 | break;
30 | }
31 | }
32 | }
33 |
34 | const InterceptEntry *Interceptor::getEntry(int i) {
35 | return entries[i];
36 | }
37 |
38 | int Interceptor::count() {
39 | return entries.size();
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/hash_value.h:
--------------------------------------------------------------------------------
1 | #ifndef phmap_example_hash_value_
2 | #define phmap_example_hash_value_
3 |
4 | #include // minimal header providing phmap::HashState()
5 | #include
6 | using std::string;
7 |
8 | struct Person
9 | {
10 | bool operator==(const Person &o) const
11 | {
12 | return _first == o._first && _last == o._last && _age == o._age;
13 | }
14 |
15 | // Demonstrates how to provide the hash function as a friend member function of the class
16 | // This can be used as an alternative to providing a std::hash specialization
17 | // --------------------------------------------------------------------------------------
18 | friend size_t hash_value(const Person &p)
19 | {
20 | return phmap::HashState().combine(0, p._first, p._last, p._age);
21 | }
22 |
23 | string _first;
24 | string _last;
25 | int _age;
26 | };
27 |
28 | #endif // phmap_example_hash_value_
29 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/Routing/InstructionInstrument/instrument_routing_handler.cc:
--------------------------------------------------------------------------------
1 | #include "dobby/dobby_internal.h"
2 |
3 | #include "InterceptRouting/Routing/InstructionInstrument/InstructionInstrumentRouting.h"
4 | #include "InterceptRouting/Routing/InstructionInstrument/instrument_routing_handler.h"
5 |
6 | #include "TrampolineBridge/ClosureTrampolineBridge/common_bridge_handler.h"
7 |
8 | void instrument_forward_handler(InterceptEntry *entry, DobbyRegisterContext *ctx) {
9 | auto routing = static_cast(entry->routing);
10 | if (routing->pre_handler) {
11 | auto handler = (dobby_instrument_callback_t)routing->pre_handler;
12 | (*handler)((void *)entry->patched_addr, ctx);
13 | }
14 |
15 | // set prologue bridge next hop address as relocated instructions
16 | set_routing_bridge_next_hop(ctx, (void *)entry->relocated_addr);
17 | }
18 |
19 | void instrument_routing_dispatch(InterceptEntry *entry, DobbyRegisterContext *ctx) {
20 | instrument_forward_handler(entry, ctx);
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/BionicLinkerUtil/bionic_linker_demo.cc:
--------------------------------------------------------------------------------
1 | #include "dobby.h"
2 |
3 | #include "bionic_linker_util.h"
4 |
5 | #include "logging/logging.h"
6 |
7 | #include
8 |
9 | #define LOG_TAG "BionicLinkerUtil"
10 |
11 | __attribute__((constructor)) static void ctor() {
12 | const char *lib = NULL;
13 |
14 | #if defined(__LP64__)
15 | lib = "/system/lib64/libandroid_runtime.so";
16 | #else
17 | lib = "/system/lib/libandroid_runtime.so";
18 | #endif
19 |
20 | void *vm = NULL;
21 |
22 | vm = DobbySymbolResolver(lib, "_ZN7android14AndroidRuntime7mJavaVME");
23 | INFO_LOG("DobbySymbolResolver::vm %p", vm);
24 |
25 | #if 0
26 | linker_disable_namespace_restriction();
27 | void *handle = NULL;
28 | handle = dlopen(lib, RTLD_LAZY);
29 | vm = dlsym(handle, "_ZN7android14AndroidRuntime7mJavaVME");
30 | #else
31 | void *handle = NULL;
32 | handle = linker_dlopen(lib, RTLD_LAZY);
33 | vm = dlsym(handle, "_ZN7android14AndroidRuntime7mJavaVME");
34 | #endif
35 | INFO_LOG("vm %p", vm);
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crack/vapp/service/ProxyService.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp.service;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.IBinder;
6 | import android.util.Log;
7 |
8 | import java.util.ArrayList;
9 |
10 | public class ProxyService extends Service {
11 |
12 |
13 | private static final String TAG = "ProxyService";
14 | public ProxyService() {
15 | }
16 |
17 | @Override
18 | public void onCreate() {
19 | Log.d(TAG, "onCreate: 代理 ProxyService 运行 .... 理论上 不会运行");
20 | super.onCreate();
21 | }
22 |
23 | @Override
24 | public int onStartCommand(Intent intent, int flags, int startId) {
25 | Log.d(TAG, "onStartCommand: 代理 ProxyService 运行 .... 理论上 不会运行");
26 | return super.onStartCommand(intent, flags, startId);
27 | }
28 |
29 | @Override
30 | public IBinder onBind(Intent intent) {
31 | // TODO: Return the communication channel to the service.
32 | throw new UnsupportedOperationException("Not yet implemented");
33 | }
34 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/SupervisorCallMonitor/misc_utility.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | typedef uintptr_t addr_t;
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #if defined(__LP64__)
11 | typedef struct mach_header_64 mach_header_t;
12 | typedef struct segment_command_64 segment_command_t;
13 | typedef struct section_64 section_t;
14 | typedef struct nlist_64 nlist_t;
15 | #define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64
16 | #else
17 | typedef struct mach_header mach_header_t;
18 | typedef struct segment_command segment_command_t;
19 | typedef struct section section_t;
20 | typedef struct nlist nlist_t;
21 | #define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT
22 | #endif
23 |
24 | // get macho segment by segment name
25 | segment_command_t *macho_kit_get_segment_by_name(mach_header_t *mach_header, const char *segname);
26 |
27 | // get macho section by segment name and section name
28 | section_t *macho_kit_get_section_by_name(mach_header_t *mach_header, const char *segname, const char *sectname);
29 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/Routing/FunctionWrapper/intercept_routing_handler.h:
--------------------------------------------------------------------------------
1 | #ifndef FUNCTION_WRAPPER_INTERCEPT_ROUTING_HANDLER_H
2 | #define FUNCTION_WRAPPER_INTERCEPT_ROUTING_HANDLER_H
3 |
4 | #include "TrampolineBridge/ClosureTrampolineBridge/ClosureTrampoline.h"
5 | #include "Interceptor.h"
6 | #include "dobby/dobby_internal.h"
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif //__cplusplus
11 |
12 | // Dispatch the routing befor running the origin function
13 | void prologue_routing_dispatch(DobbyRegisterContext *ctx, ClosureTrampolineEntry *entry);
14 |
15 | // Dispatch the routing before the function return . (as it's implementation by relpace `return address` in the stack
16 | // ,or LR register)
17 | void epilogue_routing_dispatch(DobbyRegisterContext *ctx, ClosureTrampolineEntry *entry);
18 |
19 | void pre_call_forward_handler(DobbyRegisterContext *ctx, InterceptEntry *entry);
20 |
21 | void post_call_forward_handler(DobbyRegisterContext *ctx, InterceptEntry *entry);
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif //__cplusplus
26 |
27 | #endif
--------------------------------------------------------------------------------
/app/src/main/res/navigation/mobile_navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/Trampoline/x86/trampoline_x86.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_IA32)
3 |
4 | #include "dobby/dobby_internal.h"
5 |
6 | #include "core/assembler/assembler-ia32.h"
7 | #include "core/codegen/codegen-ia32.h"
8 |
9 | #include "InstructionRelocation/x86/InstructionRelocationX86.h"
10 |
11 | #include "MemoryAllocator/NearMemoryAllocator.h"
12 | #include "InterceptRouting/RoutingPlugin/RoutingPlugin.h"
13 |
14 | using namespace zz::x86;
15 |
16 | CodeBufferBase *GenerateNormalTrampolineBuffer(addr_t from, addr_t to) {
17 | TurboAssembler turbo_assembler_((void *)from);
18 | #define _ turbo_assembler_.
19 |
20 | CodeGen codegen(&turbo_assembler_);
21 | codegen.JmpNear((uint32_t)to);
22 |
23 | CodeBufferBase *result = NULL;
24 | result = turbo_assembler_.GetCodeBuffer()->Copy();
25 | return result;
26 | }
27 |
28 | CodeBufferBase *GenerateNearTrampolineBuffer(InterceptRouting *routing, addr_t src, addr_t dst) {
29 | DEBUG_LOG("x86 near branch trampoline enable default");
30 | return NULL;
31 | }
32 |
33 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/xz/userspace/buftest.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Test application to test buffer-to-buffer decoding
3 | *
4 | * Author: Lasse Collin
5 | *
6 | * This file has been put into the public domain.
7 | * You can do whatever you want with this file.
8 | */
9 |
10 | #include
11 | #include
12 | #include
13 | #include "xz.h"
14 |
15 | #define BUFFER_SIZE (1024 * 1024)
16 |
17 | static uint8_t in[BUFFER_SIZE];
18 | static uint8_t out[BUFFER_SIZE];
19 |
20 | int main(void)
21 | {
22 | struct xz_buf b;
23 | struct xz_dec *s;
24 | enum xz_ret ret;
25 |
26 | xz_crc32_init();
27 |
28 | s = xz_dec_init(XZ_SINGLE, 0);
29 | if (s == NULL) {
30 | fputs("Initialization failed\n", stderr);
31 | return 1;
32 | }
33 |
34 | b.in = in;
35 | b.in_pos = 0;
36 | b.in_size = fread(in, 1, sizeof(in), stdin);
37 |
38 | b.out = out;
39 | b.out_pos = 0;
40 | b.out_size = sizeof(out);
41 |
42 | ret = xz_dec_run(s, &b);
43 | xz_dec_end(s);
44 |
45 | fwrite(out, 1, b.out_pos, stdout);
46 | fprintf(stderr, "%d\n", ret);
47 |
48 | return 0;
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/Routing/FunctionWrapper/function-wrapper.h:
--------------------------------------------------------------------------------
1 | #ifndef FUNCTION_WRAPPER_H
2 | #define FUNCTION_WRAPPER_H
3 |
4 | #include "dobby/dobby_internal.h"
5 |
6 | #include "TrampolineBridge/ClosureTrampolineBridge/ClosureTrampoline.h"
7 | #include "InterceptRouting/InterceptRouting.h"
8 | #include "Interceptor.h"
9 |
10 | #if TARGET_ARCH_IA32
11 | #elif TARGET_ARCH_X64
12 | #include "InterceptRouting/x64/X64InterceptRouting.h"
13 | #elif TARGET_ARCH_ARM64
14 | #include "InterceptRouting/arm64/ARM64InterceptRouting.h"
15 | #elif TARGET_ARCH_ARM
16 | #else
17 | #error "unsupported architecture"
18 | #endif
19 |
20 | class FunctionWrapperRouting : public InterceptRouting {
21 | public:
22 | FunctionWrapperRouting(InterceptEntry *entry) : InterceptRouting(entry) {
23 | }
24 |
25 | void DispatchRouting();
26 |
27 | void *GetTrampolineTarget();
28 |
29 | private:
30 | void BuildPreCallRouting();
31 |
32 | void BuildPostCallRouting();
33 |
34 | private:
35 | void *prologue_dispatch_bridge;
36 |
37 | void *epilogue_dispatch_bridge;
38 | };
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/pmr.cc:
--------------------------------------------------------------------------------
1 | #if __has_include()
2 | #include
3 | namespace std
4 | {
5 | namespace pmr = experimental::pmr;
6 | }
7 | #elif __has_include()
8 | #include
9 | #elif
10 | #error is missing
11 | #endif
12 |
13 | #include
14 |
15 | struct MyStruct
16 | {
17 | template
18 | using ParallelFlatHashMap = phmap::parallel_flat_hash_map, std::equal_to,
19 | std::pmr::polymorphic_allocator>>;
20 |
21 | ParallelFlatHashMap hashMap;
22 |
23 | // No compile errors
24 | MyStruct()
25 | {
26 | }
27 |
28 | // Compile errors
29 | MyStruct(std::pmr::memory_resource* memoryResource = std::pmr::get_default_resource())
30 | : hashMap(memoryResource)
31 | {
32 | }
33 | };
34 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/assembler/assembler-ia32.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if TARGET_ARCH_IA32
3 |
4 | #include "core/assembler/assembler-ia32.h"
5 |
6 | using namespace zz::x86;
7 |
8 | void Assembler::jmp(Immediate imm) {
9 | buffer_->Emit8(0xE9);
10 | buffer_->Emit32((int)imm.value());
11 | }
12 |
13 | addr32_t TurboAssembler::CurrentIP() {
14 | return pc_offset() + (addr_t)realized_addr_;
15 | }
16 |
17 | void AssemblerPseudoLabel::link_confused_instructions(CodeBufferBase *buffer) {
18 | auto _buffer = (CodeBuffer *)buffer;
19 |
20 | for (auto &ref_label_insn : ref_label_insns_) {
21 | int64_t new_offset = pos() - ref_label_insn.pc_offset;
22 |
23 | if (ref_label_insn.link_type == kDisp32_off_7) {
24 | // why 7 ?
25 | // use `call` and `pop` get the runtime ip register
26 | // but the ip register not the real call next insn
27 | // it need add two insn length == 7
28 | int disp32_fix_pos = ref_label_insn.pc_offset - sizeof(int32_t);
29 | _buffer->FixBindLabel(disp32_fix_pos, new_offset + 7);
30 | }
31 | }
32 | }
33 |
34 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/hash_std.h:
--------------------------------------------------------------------------------
1 | #ifndef phmap_example_hash_std_
2 | #define phmap_example_hash_std_
3 |
4 | #include // minimal header providing phmap::HashState()
5 | #include
6 | using std::string;
7 |
8 | struct Person
9 | {
10 | bool operator==(const Person &o) const
11 | {
12 | return _first == o._first && _last == o._last && _age == o._age;
13 | }
14 |
15 | string _first;
16 | string _last;
17 | int _age;
18 | };
19 |
20 | namespace std
21 | {
22 | // inject specialization of std::hash for Person into namespace std
23 | // An alternative is to provide a hash_value() friend function (see hash_value.h)
24 | // ------------------------------------------------------------------------------
25 | template<> struct hash
26 | {
27 | std::size_t operator()(Person const &p) const
28 | {
29 | return phmap::HashState().combine(0, p._first, p._last, p._age);
30 | }
31 | };
32 | }
33 |
34 | #endif // phmap_example_hash_std_
35 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/assembler/assembler-x64.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_X64)
3 |
4 | #include "core/assembler/assembler-x64.h"
5 |
6 | using namespace zz::x64;
7 |
8 | void AssemblerPseudoLabel::link_confused_instructions(CodeBufferBase *buffer) {
9 | CodeBuffer *_buffer = (CodeBuffer *)buffer;
10 |
11 | for (auto &ref_label_insn : ref_label_insns_) {
12 | int64_t new_offset = pos() - ref_label_insn.pc_offset;
13 |
14 | if (ref_label_insn.link_type == kDisp32_off_9) {
15 | // why 9 ?
16 | // use `call` and `pop` get the runtime ip register
17 | // but the ip register not the real call next insn
18 | // it need add two insn length == 9
19 | int disp32_fix_pos = ref_label_insn.pc_offset - sizeof(int32_t);
20 | _buffer->FixBindLabel(disp32_fix_pos, new_offset + 9);
21 | }
22 | }
23 | }
24 |
25 | void Assembler::jmp(Immediate imm) {
26 | buffer_->Emit8(0xE9);
27 | buffer_->Emit32((int)imm.value());
28 | }
29 |
30 | addr64_t TurboAssembler::CurrentIP() {
31 | return pc_offset() + (addr_t)realized_addr_;
32 | }
33 |
34 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/arm64/dummy/dynamic-closure-trampoline-template-arm64.S:
--------------------------------------------------------------------------------
1 | // .section __TEXT,__text,regular,pure_instructions
2 |
3 | // For iOS, we can't allocate executable memory, but we can use `remap` doing some trick.
4 | // For details, please refer `libffi`
5 |
6 | #if defined(ENABLE_CLOSURE_BRIDGE_TEMPLATE)
7 |
8 | #if defined(__WIN32__) || defined(__APPLE__)
9 | #define cdecl(s) _##s
10 | #else
11 | #define cdecl(s) s
12 | #endif
13 |
14 | #define PAGE_MAX_SIZE 4096
15 | #define PAGE_MAX_SHIFT 14
16 |
17 | .align PAGE_MAX_SHIFT.globl cdecl(dynamic_closure_trampoline_table_page) cdecl(dynamic_closure_trampoline_table_page)
18 | :.rept(PAGE_MAX_SIZE - 4 * 4) /
19 | 8 // sub dynamic_closure_trampoline_forward size
20 | adr x16,
21 | #0 b cdecl(dynamic_closure_trampoline_forward)
22 | .endr
23 |
24 | cdecl(dynamic_closure_trampoline_forward)
25 | : sub x16,
26 | x16, #0x4000 // [DynamicClosureTrampoline **]
27 | ldr x16,
28 | [ x16, #0 ] // [DynamicClosureTrampoline *]
29 | ldr x17,
30 | [ x16, #0 ] // trampolineTo
31 | br x17
32 |
33 | #endif
--------------------------------------------------------------------------------
/app/src/main/java/com/crack/vapp/BaseData.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.content.Context;
6 | import android.content.pm.ApplicationInfo;
7 | import android.content.pm.PackageInfo;
8 |
9 | public class BaseData extends Application {
10 | public static Application app;
11 | public static Context context;
12 | public static Activity baseActivity;
13 |
14 | public static String proxyActivity = "com.crack.vapp.ui.ProxyActivity";
15 |
16 | public static String oriAppName = "com.crack.vapp";
17 |
18 |
19 | public static PackageInfo packageInfo = null;
20 |
21 | public static Object Package = null;
22 |
23 | static {
24 | System.loadLibrary("vapp");
25 | }
26 |
27 | @Override
28 | public Context getBaseContext() {
29 | return super.getBaseContext();
30 | }
31 |
32 | @Override
33 | protected void attachBaseContext(Context base) {
34 | super.attachBaseContext(base);
35 | app = this;
36 | context = base;
37 | }
38 |
39 | private native void nativeInit();
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/common_bridge_handler.cc:
--------------------------------------------------------------------------------
1 | #include "logging/logging.h"
2 |
3 | #include "TrampolineBridge/ClosureTrampolineBridge/common_bridge_handler.h"
4 |
5 | PUBLIC void common_closure_bridge_handler(DobbyRegisterContext *ctx, ClosureTrampolineEntry *entry) {
6 | DEBUG_LOG("common bridge handler: carry data: %p, carry handler: %p", (InterceptEntry *)entry->carry_data,
7 | entry->carry_handler);
8 |
9 | typedef void (*routing_handler_t)(InterceptEntry *, DobbyRegisterContext *);
10 | auto routing_handler = (routing_handler_t)entry->carry_handler;
11 |
12 | #if defined(__APPLE__) && __arm64e__
13 | #if __has_feature(ptrauth_calls)
14 | uint64_t discriminator = 0;
15 | // discriminator = __builtin_ptrauth_type_discriminator(__typeof(routing_handler));
16 | routing_handler = (__typeof(routing_handler))__builtin_ptrauth_sign_unauthenticated((void *)routing_handler,
17 | ptrauth_key_asia, discriminator);
18 | #endif
19 | #endif
20 |
21 | routing_handler((InterceptEntry *)entry->carry_data, ctx);
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/.vscode/tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
4 | !_TAG_PROGRAM_NAME Exuberant Ctags //
5 | !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6 | !_TAG_PROGRAM_VERSION 5.8 //
7 | HookZzCodeSegment ../tools/zzsolidifyhook.py /^HookZzCodeSegment = [$/;" kind:variable line:4
8 | lief ../tools/zzsolidifyhook.py /^import lief$/;" kind:namespace line:2
9 | new_target_file ../tools/zzsolidifyhook.py /^new_target_file = "\/Users\/jmpews\/Desktop\/test\/test.hook.dylib"$/;" kind:variable line:31
10 | target_file ../tools/zzsolidifyhook.py /^target_file = "\/Users\/jmpews\/Desktop\/test\/test.dylib"$/;" kind:variable line:30
11 | zz_macho_get_segment_with_name ../tools/zzsolidifyhook.py /^def zz_macho_get_segment_with_name(target_parsed, seg_name):$/;" kind:function line:13
12 | zz_macho_insert_segment ../tools/zzsolidifyhook.py /^def zz_macho_insert_segment(target_file, new_target_file):$/;" kind:function line:20
13 | zzsolidifyhook.py ../tools/zzsolidifyhook.py 1;" kind:file line:1
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_app_add.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
15 |
16 |
17 |
27 |
28 |
29 |
35 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/art/runtime/object_reference.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace lsplant::art {
6 | template
7 | class alignas(4) [[gnu::packed]] ObjectReference {
8 | static MirrorType* Decompress(uint32_t ref) {
9 | uintptr_t as_bits = kPoisonReferences ? -ref : ref;
10 | return reinterpret_cast(as_bits);
11 | }
12 |
13 | uint32_t reference_;
14 |
15 | public:
16 | MirrorType* AsMirrorPtr() const { return Decompress(reference_); }
17 | };
18 |
19 | template
20 | class alignas(4) [[gnu::packed]] CompressedReference : public ObjectReference {};
21 |
22 | template
23 | class alignas(4) [[gnu::packed]] StackReference : public CompressedReference {};
24 |
25 | template // use like this: down_cast(foo);
26 | inline To down_cast(From* f) { // so we only accept pointers
27 | static_assert(std::is_base_of_v>,
28 | "down_cast unsafe as To is not a subtype of From");
29 |
30 | return static_cast(f);
31 | }
32 | } // namespace lsplant::art
33 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/assembler/assembler-arm.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if TARGET_ARCH_ARM
3 |
4 | #include "core/assembler/assembler-arm.h"
5 |
6 | void AssemblerPseudoLabel::link_confused_instructions(CodeBufferBase *buffer) {
7 | CodeBuffer *_buffer = (CodeBuffer *)buffer;
8 |
9 | for (auto &ref_label_insn : ref_label_insns_) {
10 | arm_inst_t inst = _buffer->LoadARMInst(ref_label_insn.pc_offset);
11 | if (ref_label_insn.link_type == kLdrLiteral) {
12 | int64_t pc = ref_label_insn.pc_offset + ARM_PC_OFFSET;
13 | assert(pc % 4 == 0);
14 | int32_t imm12 = pos() - pc;
15 | if (imm12 > 0) {
16 | set_bit(inst, 23, 1);
17 | } else {
18 | set_bit(inst, 23, 0);
19 | imm12 = -imm12;
20 | }
21 | set_bits(inst, 0, 11, imm12);
22 | }
23 | _buffer->RewriteARMInst(ref_label_insn.pc_offset, inst);
24 | }
25 | }
26 |
27 | namespace zz {
28 | namespace arm {
29 |
30 | void Assembler::EmitARMInst(arm_inst_t instr) {
31 | buffer_->EmitARMInst(instr);
32 | }
33 |
34 | void Assembler::EmitAddress(uint32_t value) {
35 | buffer_->Emit32(value);
36 | }
37 |
38 | } // namespace arm
39 | } // namespace zz
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .idea/
3 | *-build*/
4 | build-output/
5 |
6 | CMakeLists.txt.user
7 | CMakeCache.txt
8 | CMakeFiles
9 | CMakeScripts
10 | Testing
11 | Makefile
12 | cmake_install.cmake
13 | install_manifest.txt
14 | compile_commands.json
15 | CTestTestfile.cmake
16 | _deps
17 |
18 | ## Build generated
19 | build/
20 | DerivedData/
21 |
22 | ## Various settings
23 | *.pbxuser
24 | !default.pbxuser
25 | *.mode1v3
26 | !default.mode1v3
27 | *.mode2v3
28 | !default.mode2v3
29 | *.perspectivev3
30 | !default.perspectivev3
31 | xcuserdata/
32 |
33 | ## Other
34 | *.moved-aside
35 | *.xccheckout
36 | *.xcscmblueprint
37 |
38 | ## Obj-C/Swift specific
39 | *.hmap
40 | *.ipa
41 | *.dSYM.zip
42 | *.dSYM
43 |
44 | # Prerequisites
45 | *.d
46 |
47 | # Compiled Object files
48 | *.slo
49 | *.lo
50 | *.o
51 | *.obj
52 |
53 | # Precompiled Headers
54 | *.gch
55 | *.pch
56 |
57 | # Compiled Dynamic libraries
58 | *.so
59 | *.dylib
60 | *.dll
61 |
62 | # Fortran module files
63 | *.mod
64 | *.smod
65 |
66 | # Compiled Static libraries
67 | *.lai
68 | *.la
69 | *.a
70 | *.lib
71 |
72 | # Executables
73 | *.exe
74 | *.out
75 | *.app
76 |
77 | # Prefab
78 | /prefab/**/*.a
79 | /prefab/**/*.h
80 | /AndroidManifest.xml
81 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/cmake/platform/platform-darwin.cmake:
--------------------------------------------------------------------------------
1 | # set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR TRUE)
2 | set(CMAKE_INSTALL_NAME_DIR "@rpath")
3 | set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
4 | add_library(DobbyX ${DOBBY_LIBRARY_TYPE} ${dobby.HEADER_FILE_LIST} ${dobby.SOURCE_FILE_LIST} ${logging.SOURCE_FILE_LIST} ${misc_helper.SOURCE_FILE_LIST} ${dobby.plugin.SOURCE_FILE_LIST})
5 |
6 | set_target_properties(DobbyX
7 | PROPERTIES
8 | LINK_FLAGS "${linker_flags}"
9 | COMPILE_FLAGS "${compiler_flags}"
10 | )
11 |
12 | # set framework property
13 | set_target_properties(DobbyX PROPERTIES
14 | FRAMEWORK TRUE
15 | FRAMEWORK_VERSION A
16 | MACOSX_FRAMEWORK_IDENTIFIER "com.dobby.dobby"
17 | # MACOSX_FRAMEWORK_INFO_PLIST Info.plist
18 | VERSION 1.0.0 # current version
19 | SOVERSION 1.0.0 # compatibility version
20 | PUBLIC_HEADER include/dobby.h
21 | XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Development"
22 | )
23 |
24 | if ((SYSTEM.Darwin AND BUILDING_PLUGIN) AND (NOT DOBBY_BUILD_KERNEL_MODE))
25 | add_subdirectory(builtin-plugin/Dyld2HideLibrary)
26 | add_subdirectory(builtin-plugin/ObjcRuntimeHook)
27 | if (PROCESSOR.AARCH64)
28 | add_subdirectory(builtin-plugin/SupervisorCallMonitor)
29 | endif ()
30 | endif()
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 | LOCAL_MODULE := dex_builder
5 | LOCAL_CPPFLAGS := -std=c++20
6 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
7 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
8 | LOCAL_SRC_FILES := dex_builder.cc slicer/writer.cc slicer/reader.cc slicer/dex_ir.cc slicer/common.cc \
9 | slicer/dex_format.cc slicer/dex_utf8.cc slicer/dex_bytecode.cc
10 | LOCAL_EXPORT_LDLIBS := -lz
11 | LOCAL_LDLIBS := -lz
12 | LOCAL_CFLAGS := -fvisibility=default -fvisibility-inlines-hidden -flto
13 | LOCAL_LDFLAGS := -flto
14 | include $(BUILD_SHARED_LIBRARY)
15 |
16 | include $(CLEAR_VARS)
17 | LOCAL_MODULE := dex_builder_static
18 | LOCAL_CPPFLAGS := -std=c++20
19 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
20 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
21 | LOCAL_SRC_FILES := dex_builder.cc slicer/writer.cc slicer/reader.cc slicer/dex_ir.cc slicer/common.cc \
22 | slicer/dex_format.cc slicer/dex_utf8.cc slicer/dex_bytecode.cc
23 | LOCAL_EXPORT_LDLIBS := -lz
24 | include $(BUILD_STATIC_LIBRARY)
25 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/NearMemoryAllocator.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "PlatformUnifiedInterface/MemoryAllocator.h"
4 |
5 | #include "dobby/common.h"
6 |
7 | class NearMemoryAllocator {
8 | public:
9 | MemoryAllocator *default_allocator;
10 | NearMemoryAllocator() {
11 | default_allocator = MemoryAllocator::SharedAllocator();
12 | }
13 |
14 | private:
15 | static NearMemoryAllocator *shared_allocator;
16 |
17 | public:
18 | static NearMemoryAllocator *SharedAllocator();
19 |
20 | public:
21 | MemBlock *allocateNearBlock(uint32_t size, addr_t pos, size_t search_range, bool executable);
22 | MemBlock *allocateNearBlockFromDefaultAllocator(uint32_t size, addr_t pos, size_t search_range, bool executable);
23 | MemBlock *allocateNearBlockFromUnusedRegion(uint32_t size, addr_t pos, size_t search_range, bool executable);
24 |
25 | uint8_t *allocateNearExecMemory(uint32_t size, addr_t pos, size_t search_range);
26 | uint8_t *allocateNearExecMemory(uint8_t *buffer, uint32_t buffer_size, addr_t pos, size_t search_range);
27 |
28 | uint8_t *allocateNearDataMemory(uint32_t size, addr_t pos, size_t search_range);
29 | uint8_t *allocateNearDataMemory(uint8_t *buffer, uint32_t buffer_size, addr_t pos, size_t search_range);
30 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/dobby/kernel_mode_header.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | typedef void *vm_map_entry_t;
11 | extern vm_map_t kernel_map;
12 |
13 | typedef void *pmap_paddr_t;
14 | struct pmap;
15 | typedef struct pmap *pmap_t;
16 | extern pmap_t kernel_pmap;
17 |
18 | extern task_t kernel_task;
19 |
20 | #ifdef __cplusplus
21 | }
22 | #endif
23 |
24 | // ----- pmap -----
25 |
26 | typedef void *pmap_paddr_t;
27 | struct pmap;
28 | typedef struct pmap *pmap_t;
29 |
30 | typedef uint64_t vaddr_t;
31 | typedef uint64_t paddr_t;
32 |
33 | struct pmap;
34 | typedef struct pmap *pmap_t;
35 |
36 | #ifdef __cplusplus
37 | extern "C" {
38 | #endif
39 |
40 | extern pmap_t kernel_pmap;
41 |
42 | void pmap_kit_init();
43 |
44 | paddr_t pmap_kit_kvtophys(pmap_t pmap, vaddr_t va);
45 |
46 | int pmap_kit_set_perm(pmap_t pmap, vaddr_t start, vaddr_t end, unsigned int prot);
47 |
48 | #define cppvPsnk 1
49 | #define cppvPsrc 2
50 | void pmap_kit_bcopy_phys(paddr_t src, paddr_t dst, size_t size, int flags);
51 |
52 | typedef uint64_t pt_entry_t;
53 | pt_entry_t pmap_kit_kva_to_pte(pmap_t pmap, vaddr_t va);
54 |
55 | #ifdef __cplusplus
56 | }
57 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/art/runtime/jni/jni_id_manager.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "art/runtime/art_method.hpp"
4 | #include "art/runtime/reflective_handle.hpp"
5 | #include "common.hpp"
6 |
7 | namespace lsplant::art::jni {
8 |
9 | class JniIdManager {
10 | private:
11 | CREATE_MEM_HOOK_STUB_ENTRY(
12 | "_ZN3art3jni12JniIdManager15EncodeGenericIdINS_9ArtMethodEEEmNS_16ReflectiveHandleIT_EE",
13 | uintptr_t, EncodeGenericId, (JniIdManager * thiz, ReflectiveHandle method), {
14 | if (auto target = IsBackup(method.Get()); target) {
15 | LOGD("get generic id for %s", method.Get()->PrettyMethod().c_str());
16 | method.Set(target);
17 | }
18 | return backup(thiz, method);
19 | });
20 |
21 | public:
22 | static bool Init(JNIEnv *env, const HookHandler &handler) {
23 | int sdk_int = GetAndroidApiLevel();
24 | if (sdk_int >= __ANDROID_API_R__) {
25 | if (IsJavaDebuggable(env) && !HookSyms(handler, EncodeGenericId)) {
26 | LOGW("Failed to hook EncodeGenericId, attaching debugger may crash the process");
27 | }
28 | }
29 | return true;
30 | }
31 | };
32 |
33 | } // namespace lsplant::art::jni
34 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/xz/linux/lib/xz/xz_crc64.c:
--------------------------------------------------------------------------------
1 | /*
2 | * CRC64 using the polynomial from ECMA-182
3 | *
4 | * This file is similar to xz_crc32.c. See the comments there.
5 | *
6 | * Authors: Lasse Collin
7 | * Igor Pavlov
8 | *
9 | * This file has been put into the public domain.
10 | * You can do whatever you want with this file.
11 | */
12 |
13 | #include "xz_private.h"
14 |
15 | #ifndef STATIC_RW_DATA
16 | # define STATIC_RW_DATA static
17 | #endif
18 |
19 | STATIC_RW_DATA uint64_t xz_crc64_table[256];
20 |
21 | XZ_EXTERN void xz_crc64_init(void)
22 | {
23 | /*
24 | * The ULL suffix is needed for -std=gnu89 compatibility
25 | * on 32-bit platforms.
26 | */
27 | const uint64_t poly = 0xC96C5795D7870F42ULL;
28 |
29 | uint32_t i;
30 | uint32_t j;
31 | uint64_t r;
32 |
33 | for (i = 0; i < 256; ++i) {
34 | r = i;
35 | for (j = 0; j < 8; ++j)
36 | r = (r >> 1) ^ (poly & ~((r & 1) - 1));
37 |
38 | xz_crc64_table[i] = r;
39 | }
40 |
41 | return;
42 | }
43 |
44 | XZ_EXTERN uint64_t xz_crc64(const uint8_t *buf, size_t size, uint64_t crc)
45 | {
46 | crc = ~crc;
47 |
48 | while (size != 0) {
49 | crc = xz_crc64_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
50 | --size;
51 | }
52 |
53 | return ~crc;
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/cmake/auto_source_group.cmake:
--------------------------------------------------------------------------------
1 | function (auto_source_group _folder _base _pattern)
2 | if (ARGC GREATER 3)
3 | set(_exclude ${ARGN})
4 | else ()
5 | set(_exclude)
6 | endif ()
7 | file (GLOB _files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${_folder}/*)
8 | set (folder_files)
9 | foreach (_fname ${_files})
10 | if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_fname})
11 | auto_source_group ("${_fname}" "${_base}" "${_pattern}" "${_exclude}")
12 | elseif (_fname MATCHES ${_pattern})
13 | if(_exclude)
14 | if (NOT _fname MATCHES ${_exclude})
15 | set(folder_files ${folder_files} ${_fname})
16 | endif ()
17 | else ()
18 | set(folder_files ${folder_files} ${_fname})
19 | endif ()
20 | endif ()
21 | endforeach ()
22 |
23 | string(REPLACE "./" "" _folder2 ${_folder})
24 | string(REPLACE "/" "\\" _folder2 ${_folder2})
25 | if (_folder2 STREQUAL ".")
26 | source_group(${_base} FILES ${folder_files})
27 | else ()
28 | source_group(${_base}\\${_folder2} FILES ${folder_files})
29 | endif ()
30 |
31 | set(AUTO_FILES_RESULT ${AUTO_FILES_RESULT} ${folder_files} PARENT_SCOPE)
32 | endfunction ()
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/arm/dummy/closure-trampoline-template-arm.S:
--------------------------------------------------------------------------------
1 | // .section __TEXT,__text,regular,pure_instructions
2 |
3 | #if defined(ENABLE_CLOSURE_BRIDGE_TEMPLATE)
4 |
5 | #if defined(__WIN32__) || defined(__APPLE__)
6 | #define cdecl(s) _##s
7 | #else
8 | #define cdecl(s) s
9 | #endif
10 |
11 | .align 4
12 |
13 | #if !defined(ENABLE_CLOSURE_TRAMPOLINE_CARRY_OBJECT_PTR)
14 |
15 | // closure trampoline carray the object pointer, and fetch required members at the runtime assembly code.
16 | // #include "TrampolineBridge/ClosureTrampolineBridge/ClosureTrampoline.h"
17 | // #define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
18 | #define OFFSETOF_ClourseTrampolineEntry_carry_data 4
19 | #define OFFSETOF_ClourseTrampolineEntry_carry_handler 0
20 | .globl
21 | cdecl(closure_trampoline_template) cdecl(closure_trampoline_template)
22 | : ldr r12,
23 | ClourseTrampolineEntryPtr ldr pc, [ r12, #0 ] ClourseTrampolineEntryPtr :.long 0
24 |
25 | #else
26 |
27 | ;
28 | closure trampoline just carray the required members from the object..globl cdecl(closure_trampoline_template)
29 | cdecl(closure_trampoline_template)
30 | : ldr r12,
31 | = carry_data ldr pc, = carry_handler carry_data :.long 0 carry_handler :.long 0
32 | #endif
33 |
34 | #endif
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
17 |
18 |
19 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/include/slicer/dex_utf8.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #pragma once
18 |
19 | #include "dex_format.h"
20 |
21 | // MUTF-8 (Modified UTF-8) Encoding helpers:
22 | // https://source.android.com/devices/tech/dalvik/dex-format.html
23 |
24 | namespace dex {
25 |
26 | // Compare two '\0'-terminated modified UTF-8 strings, using Unicode
27 | // code point values for comparison. This treats different encodings
28 | // for the same code point as equivalent, except that only a real '\0'
29 | // byte is considered the string terminator. The return value is as
30 | // for strcmp().
31 | int Utf8Cmp(const char* s1, const char* s2);
32 |
33 | } // namespace dex
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/MemoryAllocator/AssemblyCodeBuilder.cc:
--------------------------------------------------------------------------------
1 | #include "MemoryAllocator/AssemblyCodeBuilder.h"
2 |
3 | #include "dobby/dobby_internal.h"
4 | #include "PlatformUnifiedInterface/ExecMemory/CodePatchTool.h"
5 |
6 | AssemblyCode *AssemblyCodeBuilder::FinalizeFromTurboAssembler(AssemblerBase *assembler) {
7 | auto buffer = (CodeBufferBase *)assembler->GetCodeBuffer();
8 | auto realized_addr = (addr_t)assembler->GetRealizedAddress();
9 | #if defined(TEST_WITH_UNICORN)
10 | // impl: unicorn emulator map memory
11 | realized_addr = 0;
12 | #endif
13 | if (!realized_addr) {
14 | size_t buffer_size = 0;
15 | buffer_size = buffer->GetBufferSize();
16 | #if TARGET_ARCH_ARM
17 | // extra bytes for align needed
18 | buffer_size += 4;
19 | #endif
20 |
21 | auto block = MemoryAllocator::SharedAllocator()->allocateExecBlock(buffer_size);
22 | if (block == nullptr)
23 | return nullptr;
24 |
25 | realized_addr = block->addr;
26 | assembler->SetRealizedAddress((void *)realized_addr);
27 | }
28 |
29 | // Realize the buffer code to the executable memory address, remove the external label, etc
30 | DobbyCodePatch((void *)realized_addr, buffer->GetBuffer(), buffer->GetBufferSize());
31 |
32 | auto block = new AssemblyCode(realized_addr, buffer->GetBufferSize());
33 | return block;
34 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/Backend/UserMode/ExecMemory/code-patch-tool-posix.cc:
--------------------------------------------------------------------------------
1 |
2 | #include "dobby/dobby_internal.h"
3 | #include "core/arch/Cpu.h"
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | #if !defined(__APPLE__)
10 | PUBLIC int DobbyCodePatch(void *address, uint8_t *buffer, uint32_t buffer_size) {
11 | #if defined(__ANDROID__) || defined(__linux__)
12 | int page_size = (int)sysconf(_SC_PAGESIZE);
13 | uintptr_t patch_page = ALIGN_FLOOR(address, page_size);
14 | uintptr_t patch_end_page = ALIGN_FLOOR((uintptr_t)address + buffer_size, page_size);
15 |
16 | // change page permission as rwx
17 | mprotect((void *)patch_page, page_size, PROT_READ | PROT_WRITE | PROT_EXEC);
18 | if (patch_page != patch_end_page) {
19 | mprotect((void *)patch_end_page, page_size, PROT_READ | PROT_WRITE | PROT_EXEC);
20 | }
21 |
22 | // patch buffer
23 | memcpy(address, buffer, buffer_size);
24 |
25 | // restore page permission
26 | mprotect((void *)patch_page, page_size, PROT_READ | PROT_EXEC);
27 | if (patch_page != patch_end_page) {
28 | mprotect((void *)patch_end_page, page_size, PROT_READ | PROT_EXEC);
29 | }
30 |
31 | addr_t clear_start_ = (addr_t)address;
32 | ClearCache((void *)clear_start_, (void *)(clear_start_ + buffer_size));
33 | #endif
34 | return 0;
35 | }
36 |
37 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/hidden_api.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of AliuHook, a library providing XposedAPI bindings to LSPlant
3 | * Copyright (c) 2021 Juby210 & Vendicated
4 | * Licensed under the Open Software License version 3.0
5 | */
6 |
7 | #include "hidden_api.h"
8 |
9 | #include "log.h"
10 | #include "aliuhook.h"
11 |
12 | bool disable_hidden_api(JNIEnv *env) {
13 | // Hidden api introduced in sdk 29
14 | if (AliuHook::android_version < 29) {
15 | return true;
16 | }
17 |
18 | void *addr = AliuHook::elf_img.GetSymbolAddress(
19 | "_ZN3artL32VMRuntime_setHiddenApiExemptionsEP7_JNIEnvP7_jclassP13_jobjectArray",
20 | true,
21 | /* match_prefix: OneUI appends a random set of numbers at the end */
22 | true);
23 | if (!addr) {
24 | LOGE("HiddenAPI: Didn't find setHiddenApiExemptions");
25 | return false;
26 | }
27 |
28 | jclass stringClass = env->FindClass("java/lang/String");
29 | // L is basically wildcard for everything
30 | jobjectArray args = env->NewObjectArray(1, stringClass, env->NewStringUTF("L"));
31 |
32 | auto func = reinterpret_cast(addr);
33 | // jclass arg is not used so pass string class for the memes
34 | func(env, stringClass, args);
35 |
36 | return true;
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/dobby/platform_features.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if defined(__APPLE__) && __arm64e__
4 | #if __has_feature(ptrauth_calls)
5 | #include
6 | #endif
7 | #endif
8 |
9 | #if defined(BUILDING_KERNEL)
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #else
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #if defined(__linux__) || defined(__APPLE__)
27 | #include
28 | #include
29 | #endif
30 | #endif
31 |
32 | #if defined(BUILDING_KERNEL)
33 | #include "kernel_mode_header.h"
34 | #endif
35 |
36 | #if defined(BUILDING_KERNEL)
37 | #define abs(a) ((a) < 0 ? -(a) : (a))
38 | #define llabs(a) (((long long)a) < 0 ? -((long long)a) : ((long long)a))
39 | #define min(a, b) (((a) < (b)) ? (a) : (b))
40 | #define max(a, b) (((a) > (b)) ? (a) : (b))
41 | #ifdef __cplusplus
42 | #define abs(a) ((a) < 0 ? -(a) : (a))
43 | #endif
44 | #else
45 | #ifdef __cplusplus
46 | // #include "TINYSTL/vector.h"
47 | // #include "TINYSTL/unordered_map.h"
48 | #include "TINYSTL/vector.h"
49 | #include "TINYSTL/unordered_map.h"
50 | #endif
51 | #endif
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. For more details, visit
12 | # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=false
18 | android.enableJetifier=false
19 | # Enables namespacing of each library's R class so that its R class includes only the
20 | # resources declared in the library itself and none from the library's dependencies,
21 | # thereby reducing the size of the R class for that library
22 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/examples/hash.cc:
--------------------------------------------------------------------------------
1 | #include // minimal header providing phmap::HashState()
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #if PHMAP_HAVE_STD_STRING_VIEW
8 | #include
9 | #endif
10 | #include
11 |
12 | using std::string;
13 | using std::tuple;
14 | using std::pair;
15 |
16 | using groupid_t = std::array;
17 |
18 | namespace std
19 | {
20 | template<> struct hash
21 | {
22 | #if PHMAP_HAVE_STD_STRING_VIEW
23 | std::size_t operator()(groupid_t const &g) const
24 | {
25 | const std::string_view bv{reinterpret_cast(g.data()), sizeof(g)};
26 | return std::hash()(bv);
27 | }
28 | #else
29 | std::size_t operator()(groupid_t const &g) const
30 | {
31 | return phmap::Hash()(std::tuple_cat(g));
32 | }
33 | #endif
34 | };
35 | }
36 |
37 | int main()
38 | {
39 | std::vector groups = {
40 | {17, 75, 82, 66},
41 | {22, 88, 54, 42},
42 | {11, 55, 77, 99} };
43 |
44 | for (const auto &g : groups)
45 | std::cout << std::hash()(g) << '\n';
46 |
47 | return 0;
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/Trampoline/arm64/trampoline_arm64.cc:
--------------------------------------------------------------------------------
1 | #include "platform_detect_macro.h"
2 | #if defined(TARGET_ARCH_ARM64)
3 |
4 | #include "dobby/dobby_internal.h"
5 |
6 | #include "core/assembler/assembler-arm64.h"
7 | #include "core/codegen/codegen-arm64.h"
8 |
9 | #include "MemoryAllocator/NearMemoryAllocator.h"
10 | #include "InstructionRelocation/arm64/InstructionRelocationARM64.h"
11 | #include "InterceptRouting/RoutingPlugin/RoutingPlugin.h"
12 |
13 | using namespace zz::arm64;
14 |
15 | CodeBufferBase *GenerateNormalTrampolineBuffer(addr_t from, addr_t to) {
16 | TurboAssembler turbo_assembler_((void *)from);
17 | #define _ turbo_assembler_.
18 |
19 | uint64_t distance = llabs((int64_t)(from - to));
20 | uint64_t adrp_range = ((uint64_t)1 << (2 + 19 + 12 - 1));
21 | if (distance < adrp_range) {
22 | // adrp, add, br
23 | _ AdrpAdd(TMP_REG_0, from, to);
24 | _ br(TMP_REG_0);
25 | DEBUG_LOG("[trampoline] use [adrp, add, br]");
26 | } else {
27 | // ldr, br, branch-address
28 | CodeGen codegen(&turbo_assembler_);
29 | codegen.LiteralLdrBranch((uint64_t)to);
30 | DEBUG_LOG("[trampoline] use [ldr, br, #label]");
31 | }
32 | #undef _
33 |
34 | // Bind all labels
35 | turbo_assembler_.RelocBind();
36 |
37 | auto result = turbo_assembler_.GetCodeBuffer()->Copy();
38 | return result;
39 | }
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crack/vapp/ui/AddAppActivity.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp.ui;
2 |
3 | import static com.crack.vapp.Utils.AppInfoUtils.getAllNonSystemApps;
4 |
5 | import android.content.pm.ApplicationInfo;
6 | import android.os.Bundle;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.GridLayoutManager;
9 | import android.support.v7.widget.RecyclerView;
10 |
11 | import com.crack.vapp.R;
12 |
13 | import java.util.List;
14 |
15 | public class AddAppActivity extends AppCompatActivity {
16 |
17 | private RecyclerView recyclerView;
18 | private MyAppAdapter appAdapter;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_add_app);
24 |
25 | // 初始化 RecyclerView
26 | recyclerView = findViewById(R.id.recycler_view_add_app); // 修改为 recycler_view_add_app
27 | recyclerView.setLayoutManager(new GridLayoutManager(this, 1)); // 每行 1 个应用图标
28 |
29 | // 加载应用列表
30 | List appInfoList = getAllNonSystemApps(this);
31 | appAdapter = new MyAppAdapter(appInfoList);
32 | recyclerView.setAdapter(appAdapter);
33 | }
34 |
35 | // 模拟获取 ApplicationInfo 数据源
36 | private List getApplicationInfoList() {
37 | return getPackageManager().getInstalledApplications(0);
38 | }
39 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InterceptRouting/Routing/InstructionInstrument/InstructionInstrument.cc:
--------------------------------------------------------------------------------
1 | #include "dobby/dobby_internal.h"
2 |
3 | #include "Interceptor.h"
4 | #include "InterceptRouting/InterceptRouting.h"
5 | #include "InterceptRouting/Routing/InstructionInstrument/InstructionInstrumentRouting.h"
6 |
7 | PUBLIC int DobbyInstrument(void *address, dobby_instrument_callback_t pre_handler) {
8 | if (!address) {
9 | ERROR_LOG("address is 0x0.\n");
10 | return -1;
11 | }
12 |
13 | #if defined(__APPLE__) && defined(__arm64__)
14 | address = pac_strip(address);
15 | #endif
16 |
17 | #if defined(ANDROID)
18 | void *page_align_address = (void *)ALIGN_FLOOR(address, OSMemory::PageSize());
19 | if (!OSMemory::SetPermission(page_align_address, OSMemory::PageSize(), kReadExecute)) {
20 | return -1;
21 | }
22 | #endif
23 |
24 | DEBUG_LOG("\n\n----- [DobbyInstrument:%p] -----", address);
25 |
26 | auto entry = Interceptor::SharedInstance()->find((addr_t)address);
27 | if (entry) {
28 | ERROR_LOG("%s already been instrumented.", address);
29 | return -1;
30 | }
31 |
32 | entry = new InterceptEntry(kInstructionInstrument, (addr_t)address);
33 |
34 | auto routing = new InstructionInstrumentRouting(entry, pre_handler, nullptr);
35 | routing->Prepare();
36 | routing->DispatchRouting();
37 | routing->Commit();
38 |
39 | Interceptor::SharedInstance()->add(entry);
40 |
41 | return 0;
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/InstructionRelocation/arm64/inst_constants.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if 0
4 | enum LoadRegLiteralOp {
5 | LoadRegLiteralFixed = 0x18000000,
6 | LoadRegLiteralFixedMask = 0x3B000000,
7 | LoadRegLiteralMask = 0xFF000000,
8 | };
9 |
10 | // PC relative addressing.
11 | enum PCRelAddressingOp {
12 | PCRelAddressingFixed = 0x10000000,
13 | PCRelAddressingFixedMask = 0x1F000000,
14 | PCRelAddressingMask = 0x9F000000,
15 | ADR = PCRelAddressingFixed | 0x00000000,
16 | ADRP = PCRelAddressingFixed | 0x80000000
17 | };
18 |
19 | // Unconditional branch.
20 | enum UnconditionalBranchOp {
21 | UnconditionalBranchFixed = 0x14000000,
22 | UnconditionalBranchFixedMask = 0x7C000000,
23 | UnconditionalBranchMask = 0xFC000000,
24 |
25 | B = UnconditionalBranchFixed | 0x00000000,
26 | BL = UnconditionalBranchFixed | 0x80000000
27 | };
28 | #endif
29 |
30 | // Compare and branch.
31 | enum CompareBranchOp {
32 | CompareBranchFixed = 0x34000000,
33 | CompareBranchFixedMask = 0x7E000000,
34 | CompareBranchMask = 0xFF000000,
35 | };
36 |
37 | // Conditional branch.
38 | enum ConditionalBranchOp {
39 | ConditionalBranchFixed = 0x54000000,
40 | ConditionalBranchFixedMask = 0xFE000000,
41 | ConditionalBranchMask = 0xFF000010,
42 | };
43 |
44 | // Test and branch.
45 | enum TestBranchOp {
46 | TestBranchFixed = 0x36000000,
47 | TestBranchFixedMask = 0x7E000000,
48 | TestBranchMask = 0x7F000000,
49 | };
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/SupervisorCallMonitor/misc_utility.cc:
--------------------------------------------------------------------------------
1 | #include "misc_utility.h"
2 |
3 | #include
4 |
5 | segment_command_t *macho_kit_get_segment_by_name(mach_header_t *header, const char *segname) {
6 | segment_command_t *curr_seg_cmd = NULL;
7 |
8 | curr_seg_cmd = (segment_command_t *)((addr_t)header + sizeof(mach_header_t));
9 | for (int i = 0; i < header->ncmds; i++) {
10 | if (curr_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
11 | if (!strncmp(curr_seg_cmd->segname, segname, sizeof(curr_seg_cmd->segname))) {
12 | break;
13 | }
14 | }
15 | curr_seg_cmd = (segment_command_t *)((addr_t)curr_seg_cmd + curr_seg_cmd->cmdsize);
16 | }
17 |
18 | return curr_seg_cmd;
19 | }
20 |
21 | section_t *macho_kit_get_section_by_name(mach_header_t *header, const char *segname, const char *sectname) {
22 | section_t *section = NULL;
23 | segment_command_t *segment = NULL;
24 |
25 | int i = 0;
26 |
27 | segment = macho_kit_get_segment_by_name(header, segname);
28 | if (!segment)
29 | goto finish;
30 |
31 | section = (section_t *)((addr_t)segment + sizeof(segment_command_t));
32 | for (i = 0; i < segment->nsects; ++i) {
33 | if (!strncmp(section->sectname, sectname, sizeof(section->sectname))) {
34 | break;
35 | }
36 | section += 1;
37 | }
38 | if (i == segment->nsects) {
39 | section = NULL;
40 | }
41 |
42 | finish:
43 | return section;
44 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/TrampolineBridge/ClosureTrampolineBridge/arm64/dummy/closure-trampoline-template-arm64.S:
--------------------------------------------------------------------------------
1 | // .section __TEXT,__text,regular,pure_instructions
2 |
3 | #if defined(ENABLE_CLOSURE_BRIDGE_TEMPLATE)
4 |
5 | #if defined(__WIN32__) || defined(__APPLE__)
6 | #define cdecl(s) _##s
7 | #else
8 | #define cdecl(s) s
9 | #endif
10 |
11 | .align 4
12 |
13 | #if !defined(ENABLE_CLOSURE_TRAMPOLINE_CARRY_OBJECT_PTR)
14 |
15 | // closure trampoline carray the object pointer, and fetch required members at the runtime assembly code.
16 | // #include "TrampolineBridge/ClosureTrampolineBridge/ClosureTrampoline.h"
17 | // #define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
18 | #define OFFSETOF_ClourseTrampolineEntry_carry_data 8
19 | #define OFFSETOF_ClourseTrampolineEntry_carry_handler 0
20 | .globl
21 | cdecl(closure_trampoline_template) cdecl(closure_trampoline_template)
22 | : ldr x17,
23 | ClourseTrampolineEntryPtr ldr x16, OFFSETOF_ClourseTrampolineEntry_carry_data ldr x17,
24 | OFFSETOF_ClourseTrampolineEntry_carry_handler br x17 ClourseTrampolineEntryPtr :.long 0.long 0
25 |
26 | #else
27 |
28 | ;
29 | closure trampoline just carray the required members from the object..globl cdecl(closure_trampoline_template)
30 | cdecl(closure_trampoline_template)
31 | : ldr x16,
32 | = carry_data ldr x17, = carry_handler br x17 carry_data :.long 0.long 0 carry_handler :.long 0.long 0
33 |
34 | #endif
35 |
36 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/include/slicer/memview.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #pragma once
18 |
19 | #include "common.h"
20 |
21 | #include
22 | #include
23 |
24 | namespace slicer {
25 |
26 | // A shallow, non-owning reference to a "view" inside a memory buffer
27 | class MemView {
28 | public:
29 | MemView() : ptr_(nullptr), size_(0) {}
30 |
31 | MemView(const void* ptr, size_t size) : ptr_(ptr), size_(size) {
32 | assert(size > 0);
33 | }
34 |
35 | ~MemView() = default;
36 |
37 | template
38 | const T* ptr() const {
39 | return static_cast(ptr_);
40 | }
41 |
42 | size_t size() const { return size_; }
43 |
44 | private:
45 | const void* ptr_;
46 | size_t size_;
47 | };
48 |
49 | } // namespace slicer
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crack/vapp/test/testActivity.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp.test;
2 |
3 | import android.widget.Button;
4 |
5 | import com.crack.vapp.BaseData;
6 | import com.crack.vapp.R;
7 | import com.crack.vapp.core.HookService;
8 |
9 | public class testActivity extends android.app.Activity{
10 | public void onCreate(android.os.Bundle savedInstanceState)
11 |
12 | {
13 | BaseData.baseActivity = this;
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_main);
16 | android.widget.Toast.makeText(this,"testActivity",android.widget.Toast.LENGTH_SHORT).show();
17 |
18 | Button button = (Button)findViewById(R.id.button);
19 | button.setText("启动服务");
20 | button.setOnClickListener(new android.view.View.OnClickListener(){
21 | public void onClick(android.view.View v)
22 | {
23 | //启动服务 ProxyService
24 | android.content.Intent intent = new android.content.Intent(testActivity.this, testService.class);
25 | startService(intent);
26 | }
27 | });
28 |
29 | Button button2 = (Button)findViewById(R.id.button2);
30 | button2.setText("启动Hook Service");
31 | button2.setOnClickListener(new android.view.View.OnClickListener(){
32 | public void onClick(android.view.View v)
33 | {
34 | HookService.hook();
35 | }
36 | });
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/art/runtime/handle.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "object_reference.hpp"
6 | #include "value_object.hpp"
7 |
8 | namespace lsplant::art {
9 |
10 | namespace mirror {
11 | class Class;
12 | };
13 |
14 | template
15 | class Handle : public ValueObject {
16 | public:
17 | Handle(const Handle& handle) : reference_(handle.reference_) {}
18 |
19 | Handle& operator=(const Handle& handle) {
20 | reference_ = handle.reference_;
21 | return *this;
22 | }
23 | static_assert(std::is_same_v, "Expected mirror::Class");
24 |
25 | auto operator->() { return Get(); }
26 |
27 | T* Get() { return down_cast(reference_->AsMirrorPtr()); }
28 |
29 | protected:
30 | StackReference* reference_;
31 | };
32 |
33 | static_assert(!std::is_trivially_copyable_v>);
34 |
35 | // https://cs.android.com/android/_/android/platform/art/+/38cea84b362a10859580e788e984324f36272817
36 | template
37 | class TrivialHandle : public ValueObject {
38 | public:
39 | static_assert(std::is_same_v, "Expected mirror::Class");
40 |
41 | auto operator->() { return Get(); }
42 |
43 | T* Get() { return down_cast(reference_->AsMirrorPtr()); }
44 |
45 | protected:
46 | StackReference* reference_;
47 | };
48 | static_assert(std::is_trivially_copyable_v>);
49 |
50 | } // namespace lsplant::art
51 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/html/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | The Parallel Hashmap (Gregory Popovitch)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | $if(highlighting-css)$
17 |
20 | $endif$
21 | $for(css)$
22 |
23 | $endfor$
24 | $if(math)$
25 | $if(html5)$
26 | $else$
27 | $math$
28 | $endif$
29 | $endif$
30 | $for(header-includes)$
31 | $header-includes$
32 | $endfor$
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | $body$
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/tests/hash_policy_testing_test.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Abseil Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // https://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include "parallel_hashmap/phmap.h"
16 | #include "hash_policy_testing.h"
17 |
18 | #include "gtest/gtest.h"
19 |
20 | namespace phmap {
21 | namespace priv {
22 | namespace {
23 |
24 | TEST(_, Hash) {
25 | StatefulTestingHash h1;
26 | EXPECT_EQ(1, h1.id());
27 | StatefulTestingHash h2;
28 | EXPECT_EQ(2, h2.id());
29 | StatefulTestingHash h1c(h1);
30 | EXPECT_EQ(1, h1c.id());
31 | StatefulTestingHash h2m(std::move(h2));
32 | EXPECT_EQ(2, h2m.id());
33 | EXPECT_EQ(0, h2.id());
34 | StatefulTestingHash h3;
35 | EXPECT_EQ(3, h3.id());
36 | h3 = StatefulTestingHash();
37 | EXPECT_EQ(4, h3.id());
38 | h3 = std::move(h1);
39 | EXPECT_EQ(1, h3.id());
40 | }
41 |
42 | } // namespace
43 | } // namespace priv
44 | } // namespace phmap
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crack/vapp/core/InstallApp.java:
--------------------------------------------------------------------------------
1 | package com.crack.vapp.core;
2 |
3 | import static com.crack.vapp.Utils.FileUtil.deleteDirectory;
4 | import static com.crack.vapp.Utils.FileUtil.unzipApk;
5 |
6 | import android.content.Context;
7 | import android.content.pm.ApplicationInfo;
8 |
9 | import com.crack.vapp.Utils.lg;
10 |
11 | import java.io.File;
12 |
13 |
14 | public class InstallApp {
15 |
16 | /**
17 | * 安装逻辑:将 APK 包解压到自身目录下的 app包名 目录中
18 | * @param context 上下文
19 | * @param appInfo 应用信息
20 | */
21 | public static void installApp(Context context, ApplicationInfo appInfo) {
22 | try {
23 | // 获取 APK 文件路径
24 | String apkPath = appInfo.sourceDir;
25 | File apkFile = new File(apkPath);
26 |
27 | // 创建目标目录:自身目录 + app包名
28 | String packageName = appInfo.packageName;
29 | File targetDir = new File(context.getFilesDir(), packageName);
30 |
31 | // 如果目标目录已存在,先删除
32 | if (targetDir.exists()) {
33 | deleteDirectory(targetDir);
34 | }
35 |
36 | // 确保父文件夹存在
37 | if (!targetDir.getParentFile().exists()) {
38 | targetDir.getParentFile().mkdirs();
39 | }
40 | targetDir.mkdirs();
41 |
42 | // 解压 APK 文件到目标目录
43 | unzipApk(apkFile, targetDir);
44 | } catch (Exception e) {
45 | e.printStackTrace();
46 | }
47 | }
48 |
49 |
50 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/builtin-plugin/ApplicationEventMonitor/MGCopyAnswerMonitor.cc:
--------------------------------------------------------------------------------
1 | #include "./dobby_monitor.h"
2 |
3 | #include
4 | #include
5 |
6 | #define LOG_TAG "MGCopyAnswer"
7 |
8 | static uintptr_t getCallFirstArg(DobbyRegisterContext *ctx) {
9 | uintptr_t result;
10 | #if defined(_M_X64) || defined(__x86_64__)
11 | #if defined(_WIN32)
12 | result = ctx->general.regs.rcx;
13 | #else
14 | result = ctx->general.regs.rdi;
15 | #endif
16 | #elif defined(__arm64__) || defined(__aarch64__)
17 | result = ctx->general.regs.x0;
18 | #elif defined(__arm__)
19 | result = ctx->general.regs.r0;
20 | #else
21 | #error "Not Support Architecture."
22 | #endif
23 | return result;
24 | }
25 |
26 | void common_handler(DobbyRegisterContext *ctx, const InterceptEntry *info) {
27 | CFStringRef key_ = 0;
28 | key_ = (CFStringRef)getCallFirstArg(ctx);
29 |
30 | char str_key[256] = {0};
31 | CFStringGetCString(key_, str_key, 256, kCFStringEncodingUTF8);
32 | LOG("[#] MGCopyAnswer:: %s\n", str_key);
33 | }
34 |
35 | #if 0
36 | __attribute__((constructor)) static void ctor() {
37 | void *lib = dlopen("/usr/lib/libMobileGestalt.dylib", RTLD_NOW);
38 | void *MGCopyAnswer_addr = DobbySymbolResolver("libMobileGestalt.dylib", "MGCopyAnswer");
39 |
40 | sleep(1);
41 |
42 | dobby_enable_near_branch_trampoline();
43 | DobbyInstrument((void *)MGCopyAnswer_addr, common_handler);
44 | dobby_disable_near_branch_trampoline();
45 | }
46 | #endif
47 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/xz/linux/lib/xz/xz_crc32.c:
--------------------------------------------------------------------------------
1 | /*
2 | * CRC32 using the polynomial from IEEE-802.3
3 | *
4 | * Authors: Lasse Collin
5 | * Igor Pavlov
6 | *
7 | * This file has been put into the public domain.
8 | * You can do whatever you want with this file.
9 | */
10 |
11 | /*
12 | * This is not the fastest implementation, but it is pretty compact.
13 | * The fastest versions of xz_crc32() on modern CPUs without hardware
14 | * accelerated CRC instruction are 3-5 times as fast as this version,
15 | * but they are bigger and use more memory for the lookup table.
16 | */
17 |
18 | #include "xz_private.h"
19 |
20 | /*
21 | * STATIC_RW_DATA is used in the pre-boot environment on some architectures.
22 | * See for details.
23 | */
24 | #ifndef STATIC_RW_DATA
25 | # define STATIC_RW_DATA static
26 | #endif
27 |
28 | STATIC_RW_DATA uint32_t xz_crc32_table[256];
29 |
30 | XZ_EXTERN void xz_crc32_init(void)
31 | {
32 | const uint32_t poly = 0xEDB88320;
33 |
34 | uint32_t i;
35 | uint32_t j;
36 | uint32_t r;
37 |
38 | for (i = 0; i < 256; ++i) {
39 | r = i;
40 | for (j = 0; j < 8; ++j)
41 | r = (r >> 1) ^ (poly & ~((r & 1) - 1));
42 |
43 | xz_crc32_table[i] = r;
44 | }
45 |
46 | return;
47 | }
48 |
49 | XZ_EXTERN uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
50 | {
51 | crc = ~crc;
52 |
53 | while (size != 0) {
54 | crc = xz_crc32_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
55 | --size;
56 | }
57 |
58 | return ~crc;
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/Dobby/source/core/arch/arm/registers-arm.h:
--------------------------------------------------------------------------------
1 | #ifndef ARCH_ARM_REGISTERS
2 | #define ARCH_ARM_REGISTERS
3 |
4 | #include "core/arch/arm/constants-arm.h"
5 | #include "core/arch/Cpu.h"
6 |
7 | namespace zz {
8 | namespace arm {
9 |
10 | #define GENERAL_REGISTERS(V) \
11 | V(r0) V(r1) V(r2) V(r3) V(r4) V(r5) V(r6) V(r7) V(r8) V(r9) V(r10) V(r11) V(r12) V(sp) V(lr) V(pc)
12 |
13 | enum RegisterCode {
14 | #define REGISTER_CODE(R) kRegCode_##R,
15 | GENERAL_REGISTERS(REGISTER_CODE)
16 | #undef REGISTER_CODE
17 | kRegAfterLast
18 | };
19 |
20 | class Register : public RegisterBase {
21 | public:
22 | explicit constexpr Register(int code) : RegisterBase(code) {
23 | }
24 |
25 | static constexpr Register Create(int code) {
26 | return Register(code);
27 | }
28 |
29 | static constexpr Register R(int code) {
30 | return Register(code);
31 | }
32 |
33 | bool Is(const Register ®) const {
34 | return (reg.reg_code_ == this->reg_code_);
35 | }
36 |
37 | bool IsValid() const {
38 | return (reg_code_ != 0);
39 | }
40 |
41 | int code() const {
42 | return reg_code_;
43 | }
44 |
45 | private:
46 | };
47 |
48 | typedef Register CPURegister;
49 |
50 | #define DECLARE_REGISTER(R) constexpr Register R = Register::Create(kRegCode_##R);
51 | GENERAL_REGISTERS(DECLARE_REGISTER)
52 | #undef DECLARE_REGISTER
53 |
54 | constexpr Register no_reg = Register::Create(0);
55 |
56 | } // namespace arm
57 | } // namespace zz
58 | #endif
--------------------------------------------------------------------------------
/app/src/main/cpp/lspc/lsp/external/dex_builder/external/parallel_hashmap/benchmark/js/jquery.flot.saturated.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | 'use strict';
3 | var saturated = {
4 | saturate: function (a) {
5 | if (a === Infinity) {
6 | return Number.MAX_VALUE;
7 | }
8 |
9 | if (a === -Infinity) {
10 | return -Number.MAX_VALUE;
11 | }
12 |
13 | return a;
14 | },
15 | delta: function(min, max, noTicks) {
16 | return ((max - min) / noTicks) === Infinity ? (max / noTicks - min / noTicks) : (max - min) / noTicks
17 | },
18 | multiply: function (a, b) {
19 | return saturated.saturate(a * b);
20 | },
21 | // returns c * bInt * a. Beahves properly in the case where c is negative
22 | // and bInt * a is bigger that Number.MAX_VALUE (Infinity)
23 | multiplyAdd: function (a, bInt, c) {
24 | if (isFinite(a * bInt)) {
25 | return saturated.saturate(a * bInt + c);
26 | } else {
27 | var result = c;
28 |
29 | for (var i = 0; i < bInt; i++) {
30 | result += a;
31 | }
32 |
33 | return saturated.saturate(result);
34 | }
35 | },
36 | // round to nearby lower multiple of base
37 | floorInBase: function(n, base) {
38 | return base * Math.floor(n / base);
39 | }
40 | };
41 |
42 | $.plot.saturated = saturated;
43 | })(jQuery);
44 |
--------------------------------------------------------------------------------