├── IATHook ├── Debug │ ├── IATHOOK.exe │ └── IATHOOK.pdb ├── IATHOOK.sln ├── IATHOOK │ ├── Debug │ │ ├── IATHOOK.exe │ │ ├── IATHOOK.exe.recipe │ │ ├── IATHOOK.ilk │ │ ├── IATHOOK.log │ │ ├── IATHOOK.obj │ │ ├── IATHOOK.pdb │ │ ├── IATHOOK.tlog │ │ │ ├── CL.command.1.tlog │ │ │ ├── CL.read.1.tlog │ │ │ ├── CL.write.1.tlog │ │ │ ├── Cl.items.tlog │ │ │ ├── IATHOOK.lastbuildstate │ │ │ ├── link.command.1.tlog │ │ │ ├── link.read.1.tlog │ │ │ ├── link.secondary.1.tlog │ │ │ └── link.write.1.tlog │ │ ├── IATHOOK.vcxproj.FileListAbsolute.txt │ │ ├── vc143.idb │ │ └── vc143.pdb │ ├── IATHOOK.cpp │ ├── IATHOOK.vcxproj │ ├── IATHOOK.vcxproj.filters │ ├── IATHOOK.vcxproj.user │ ├── IATHOOK │ │ ├── Debug │ │ │ ├── IATHOOK.exe.recipe │ │ │ ├── IATHOOK.ilk │ │ │ ├── IATHOOK.log │ │ │ ├── IATHOOK.obj │ │ │ ├── IATHOOK.tlog │ │ │ │ ├── CL.command.1.tlog │ │ │ │ ├── CL.read.1.tlog │ │ │ │ ├── CL.write.1.tlog │ │ │ │ ├── Cl.items.tlog │ │ │ │ ├── IATHOOK.lastbuildstate │ │ │ │ ├── link.command.1.tlog │ │ │ │ ├── link.read.1.tlog │ │ │ │ ├── link.secondary.1.tlog │ │ │ │ └── link.write.1.tlog │ │ │ ├── vc143.idb │ │ │ └── vc143.pdb │ │ └── x64 │ │ │ └── Debug │ │ │ ├── IATHOOK.exe.recipe │ │ │ ├── IATHOOK.ilk │ │ │ ├── IATHOOK.log │ │ │ ├── IATHOOK.obj │ │ │ ├── IATHOOK.tlog │ │ │ ├── CL.command.1.tlog │ │ │ ├── CL.read.1.tlog │ │ │ ├── CL.write.1.tlog │ │ │ ├── Cl.items.tlog │ │ │ ├── IATHOOK.lastbuildstate │ │ │ ├── link.command.1.tlog │ │ │ ├── link.read.1.tlog │ │ │ ├── link.secondary.1.tlog │ │ │ └── link.write.1.tlog │ │ │ ├── vc143.idb │ │ │ └── vc143.pdb │ ├── Release │ │ ├── IATHOOK.exe.recipe │ │ ├── IATHOOK.iobj │ │ ├── IATHOOK.ipdb │ │ ├── IATHOOK.log │ │ ├── IATHOOK.obj │ │ ├── IATHOOK.tlog │ │ │ ├── CL.command.1.tlog │ │ │ ├── CL.read.1.tlog │ │ │ ├── CL.write.1.tlog │ │ │ ├── Cl.items.tlog │ │ │ ├── IATHOOK.lastbuildstate │ │ │ ├── link.command.1.tlog │ │ │ ├── link.read.1.tlog │ │ │ ├── link.secondary.1.tlog │ │ │ └── link.write.1.tlog │ │ └── vc143.pdb │ └── x64 │ │ └── Debug │ │ ├── IATHOOK.exe │ │ └── IATHOOK.pdb └── Release │ ├── IATHOOK.exe │ └── IATHOOK.pdb ├── InlineHook ├── InlineHook.sln └── InlineHook │ ├── Debug │ ├── InlineHook.exe │ └── InlineHook.pdb │ ├── InlineHook.cpp │ ├── InlineHook.vcxproj │ ├── InlineHook.vcxproj.filters │ ├── InlineHook.vcxproj.user │ └── InlineHook │ └── Debug │ ├── InlineHook.exe.recipe │ ├── InlineHook.ilk │ ├── InlineHook.log │ ├── InlineHook.obj │ ├── InlineHook.tlog │ ├── CL.command.1.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── Cl.items.tlog │ ├── InlineHook.lastbuildstate │ ├── link.command.1.tlog │ ├── link.read.1.tlog │ ├── link.secondary.1.tlog │ └── link.write.1.tlog │ ├── vc143.idb │ └── vc143.pdb ├── Junkcode ├── junkcode.sln └── junkcode │ ├── Debug │ ├── junkcode.exe │ └── junkcode.pdb │ ├── junkcode.cpp │ ├── junkcode.vcxproj │ ├── junkcode.vcxproj.filters │ ├── junkcode.vcxproj.user │ └── junkcode │ ├── Debug │ ├── junkcode.exe.recipe │ ├── junkcode.ilk │ ├── junkcode.log │ ├── junkcode.obj │ ├── junkcode.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── Cl.items.tlog │ │ ├── junkcode.lastbuildstate │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ ├── link.secondary.1.tlog │ │ └── link.write.1.tlog │ ├── vc143.idb │ └── vc143.pdb │ └── x64 │ └── Debug │ ├── junkcode.log │ ├── junkcode.tlog │ ├── CL.command.1.tlog │ ├── junkcode.lastbuildstate │ └── unsuccessfulbuild │ ├── vc143.idb │ └── vc143.pdb ├── README.md ├── SMC ├── SMC.sln ├── SMC │ ├── Debug │ │ ├── SMC.exe │ │ └── SMC.pdb │ ├── SMC.cpp │ ├── SMC.vcxproj │ ├── SMC.vcxproj.filters │ ├── SMC.vcxproj.user │ └── SMC │ │ └── Debug │ │ ├── SMC.exe.recipe │ │ ├── SMC.ilk │ │ ├── SMC.log │ │ ├── SMC.obj │ │ ├── SMC.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── Cl.items.tlog │ │ ├── SMC.lastbuildstate │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ ├── link.secondary.1.tlog │ │ └── link.write.1.tlog │ │ ├── vc143.idb │ │ └── vc143.pdb └── smc事先加密脚本.py ├── Seccomp+除0异常hook ├── README.md └── demo.cpp ├── TlsCallBack └── TLS │ ├── TLS.sln │ └── TLS │ ├── Debug │ ├── TLS.exe │ └── TLS.pdb │ ├── TLS.cpp │ ├── TLS.vcxproj │ ├── TLS.vcxproj.filters │ ├── TLS.vcxproj.user │ └── TLS │ └── Debug │ ├── TLS.exe.recipe │ ├── TLS.ilk │ ├── TLS.log │ ├── TLS.obj │ ├── TLS.tlog │ ├── CL.command.1.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── Cl.items.tlog │ ├── TLS.lastbuildstate │ ├── link.command.1.tlog │ ├── link.read.1.tlog │ ├── link.secondary.1.tlog │ └── link.write.1.tlog │ ├── vc143.idb │ └── vc143.pdb └── antiFrida ├── antiInlineHook ├── CMakeLists.txt ├── dlfcn │ ├── local_dlfcn.c │ └── local_dlfcn.h ├── logger.h └── main.cpp ├── findPort.cpp └── findmaps.cpp /IATHook/Debug/IATHOOK.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/Debug/IATHOOK.exe -------------------------------------------------------------------------------- /IATHook/Debug/IATHOOK.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/Debug/IATHOOK.pdb -------------------------------------------------------------------------------- /IATHook/IATHOOK.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.34928.147 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IATHOOK", "IATHOOK\IATHOOK.vcxproj", "{F8489861-3C04-4329-8111-1A1C24CCA643}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {F8489861-3C04-4329-8111-1A1C24CCA643}.Debug|x64.ActiveCfg = Debug|x64 17 | {F8489861-3C04-4329-8111-1A1C24CCA643}.Debug|x64.Build.0 = Debug|x64 18 | {F8489861-3C04-4329-8111-1A1C24CCA643}.Debug|x86.ActiveCfg = Debug|Win32 19 | {F8489861-3C04-4329-8111-1A1C24CCA643}.Debug|x86.Build.0 = Debug|Win32 20 | {F8489861-3C04-4329-8111-1A1C24CCA643}.Release|x64.ActiveCfg = Release|x64 21 | {F8489861-3C04-4329-8111-1A1C24CCA643}.Release|x64.Build.0 = Release|x64 22 | {F8489861-3C04-4329-8111-1A1C24CCA643}.Release|x86.ActiveCfg = Release|Win32 23 | {F8489861-3C04-4329-8111-1A1C24CCA643}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {303213FE-C8ED-41F1-98B1-A0EECCE4DD5B} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.exe -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | D:\算法训练\项目实现\IATHOOK\Debug\IATHOOK.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.ilk -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.log: -------------------------------------------------------------------------------- 1 |  IATHOOK.cpp 2 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(75,11): warning C4834: 放弃具有 [[nodiscard]] 属性的函数的返回值 3 | IATHOOK.vcxproj -> D:\算法训练\项目实现\IATHOOK\Debug\IATHOOK.exe 4 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.obj -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.pdb -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp;D:\算法训练\项目实现\IATHOOK\IATHOOK\Debug\IATHOOK.obj 2 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/IATHOOK.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Debug|Win32|D:\算法训练\项目实现\IATHOOK\| 3 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/link.secondary.1.tlog: -------------------------------------------------------------------------------- 1 | ^D:\算法训练\项目实现\IATHOOK\IATHOOK\DEBUG\IATHOOK.OBJ 2 | D:\算法训练\项目实现\IATHOOK\IATHOOK\Debug\IATHOOK.ilk 3 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/IATHOOK.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/IATHOOK.vcxproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\IATHOOK\IATHOOK\Debug\IATHOOK.exe 2 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/vc143.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/vc143.idb -------------------------------------------------------------------------------- /IATHook/IATHOOK/Debug/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Debug/vc143.pdb -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef int(__cdecl* PMemcmp)(const void* buf1, const void* buf2, size_t count); 5 | 6 | DWORD GetMemcmpAddressFromIAT() { 7 | HMODULE hModule = GetModuleHandle(NULL); 8 | if (!hModule) { 9 | printf("Failed to get handle of current module\n"); 10 | return 0; 11 | } 12 | 13 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hModule; 14 | PIMAGE_NT_HEADERS pNTHeader = (PIMAGE_NT_HEADERS)((DWORD)hModule + pDosHeader->e_lfanew); 15 | PIMAGE_OPTIONAL_HEADER32 pOptionHeader = (PIMAGE_OPTIONAL_HEADER32) & (pNTHeader->OptionalHeader); 16 | PIMAGE_IMPORT_DESCRIPTOR pIMPORT_DESCRIPTOR = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)hModule + pOptionHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); 17 | 18 | while (pIMPORT_DESCRIPTOR->FirstThunk) { 19 | PDWORD FirstThunk = (PDWORD)((DWORD)hModule + pIMPORT_DESCRIPTOR->FirstThunk); 20 | PDWORD OriginalFirstThunk = (PDWORD)((DWORD)hModule + pIMPORT_DESCRIPTOR->OriginalFirstThunk); 21 | while (*FirstThunk) { 22 | char* functionName = (char*)((*OriginalFirstThunk) + (DWORD)hModule + 2); 23 | if (strcmp(functionName, "memcmp") == 0) { 24 | return (DWORD)FirstThunk; 25 | } 26 | FirstThunk++; 27 | OriginalFirstThunk++; 28 | } 29 | pIMPORT_DESCRIPTOR++; 30 | } 31 | 32 | printf("Failed to find memcmp in IAT.\n"); 33 | return 0; 34 | } 35 | 36 | int __cdecl MyMemcmp(const void* buf1, const void* buf2, size_t count) { 37 | printf("Hooked memcmp Param: buf1: %p, buf2: %p, count: %zu\n", buf1, buf2, count); 38 | 39 | PMemcmp OriginalMemcmp = (PMemcmp)GetProcAddress(GetModuleHandleA("ucrtbase.dll"), "memcmp"); 40 | if (!OriginalMemcmp) { 41 | printf("Failed to call original memcmp.\n"); 42 | return -1; 43 | } 44 | int result = OriginalMemcmp(buf1, buf2, count); 45 | 46 | printf("Original memcmp result: %d\n", result); 47 | return result; 48 | } 49 | 50 | void InstallIatHook(DWORD* pdwOldFunction, DWORD dwNewFunction) { 51 | DWORD dwOldProtect; 52 | if (VirtualProtect(pdwOldFunction, sizeof(DWORD), PAGE_READWRITE, &dwOldProtect)) { 53 | *pdwOldFunction = dwNewFunction; 54 | VirtualProtect(pdwOldFunction, sizeof(DWORD), dwOldProtect, &dwOldProtect); 55 | printf("Function hooked successfully.\n"); 56 | } 57 | else { 58 | printf("Failed to change protection of IAT.\n"); 59 | } 60 | } 61 | 62 | int main(int argc, char* argv[]) { 63 | DWORD* dwMemcmp = (DWORD*)GetMemcmpAddressFromIAT(); 64 | if (dwMemcmp == 0) { 65 | printf("Failed to get memcmp address from IAT.\n"); 66 | return -1; 67 | } 68 | 69 | printf("memcmp address in IAT: %p\n", (void*)*dwMemcmp); 70 | 71 | InstallIatHook(dwMemcmp, (DWORD)MyMemcmp); 72 | 73 | char buf1[] = "test1"; 74 | char buf2[] = "test2"; 75 | memcmp(buf1, buf2, sizeof(buf1)); 76 | 77 | // Uncomment below to uninstall the hook 78 | // UninstallIatHook(dwMemcmp, (DWORD)MyMemcmp); 79 | // memcmp(buf1, buf2, sizeof(buf1)); 80 | 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {f8489861-3c04-4329-8111-1a1c24cca643} 25 | IATHOOK 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | stdcpp14 80 | 81 | 82 | Console 83 | true 84 | false 85 | false 86 | 87 | 88 | 89 | 90 | Level3 91 | true 92 | true 93 | true 94 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 95 | true 96 | 97 | 98 | Console 99 | true 100 | true 101 | true 102 | 103 | 104 | 105 | 106 | Level3 107 | true 108 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 109 | true 110 | 111 | 112 | Console 113 | true 114 | 115 | 116 | 117 | 118 | Level3 119 | true 120 | true 121 | true 122 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 123 | true 124 | 125 | 126 | Console 127 | true 128 | true 129 | true 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | D:\算法训练\项目实现\IATHOOK\IATHOOK\Debug\IATHOOK.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.ilk -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.log: -------------------------------------------------------------------------------- 1 |  IATHOOK.cpp 2 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(75,11): warning C4834: 放弃具有 [[nodiscard]] 属性的函数的返回值 3 | IATHOOK.vcxproj -> D:\算法训练\项目实现\IATHOOK\IATHOOK\Debug\IATHOOK.exe 4 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.obj -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp;D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK\Debug\IATHOOK.obj 2 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/IATHOOK.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Debug|Win32|D:\算法训练\项目实现\IATHOOK\IATHOOK\| 3 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/link.secondary.1.tlog: -------------------------------------------------------------------------------- 1 | ^D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK\DEBUG\IATHOOK.OBJ 2 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK\Debug\IATHOOK.ilk 3 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/IATHOOK.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/vc143.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/vc143.idb -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/Debug/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/Debug/vc143.pdb -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | D:\算法训练\项目实现\IATHOOK\IATHOOK\x64\Debug\IATHOOK.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.ilk -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.log: -------------------------------------------------------------------------------- 1 |  IATHOOK.cpp 2 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(14,55): warning C4311: “类型强制转换”: 从“HMODULE”到“DWORD”的指针截断 3 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(14,55): warning C4302: “类型强制转换”: 从“HMODULE”到“DWORD”截断 4 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(14,35): warning C4312: “类型强制转换”: 从“unsigned long”转换到更大的“PIMAGE_NT_HEADERS” 5 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(16,78): warning C4311: “类型强制转换”: 从“HMODULE”到“DWORD”的指针截断 6 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(16,78): warning C4302: “类型强制转换”: 从“HMODULE”到“DWORD”截断 7 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(16,51): warning C4312: “类型强制转换”: 从“unsigned long”转换到更大的“PIMAGE_IMPORT_DESCRIPTOR” 8 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(19,38): warning C4311: “类型强制转换”: 从“HMODULE”到“DWORD”的指针截断 9 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(19,38): warning C4302: “类型强制转换”: 从“HMODULE”到“DWORD”截断 10 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(19,29): warning C4312: “类型强制转换”: 从“unsigned long”转换到更大的“PDWORD” 11 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(20,46): warning C4311: “类型强制转换”: 从“HMODULE”到“DWORD”的指针截断 12 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(20,46): warning C4302: “类型强制转换”: 从“HMODULE”到“DWORD”截断 13 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(20,37): warning C4312: “类型强制转换”: 从“unsigned long”转换到更大的“PDWORD” 14 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(22,66): warning C4311: “类型强制转换”: 从“HMODULE”到“DWORD”的指针截断 15 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(22,66): warning C4302: “类型强制转换”: 从“HMODULE”到“DWORD”截断 16 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(22,34): warning C4312: “类型强制转换”: 从“unsigned long”转换到更大的“char *” 17 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(24,24): warning C4311: “类型强制转换”: 从“PDWORD”到“DWORD”的指针截断 18 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(24,24): warning C4302: “类型强制转换”: 从“PDWORD”到“DWORD”截断 19 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(63,23): warning C4312: “类型强制转换”: 从“DWORD”转换到更大的“DWORD *” 20 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(69,43): warning C4312: “类型强制转换”: 从“DWORD”转换到更大的“void *” 21 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(71,30): warning C4311: “类型强制转换”: 从“int (__cdecl *)(const void *,const void *,size_t)”到“DWORD”的指针截断 22 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(71,30): warning C4302: “类型强制转换”: 从“int (__cdecl *)(const void *,const void *,size_t)”到“DWORD”截断 23 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp(75,11): warning C4834: 放弃具有 [[nodiscard]] 属性的函数的返回值 24 | IATHOOK.vcxproj -> D:\算法训练\项目实现\IATHOOK\IATHOOK\x64\Debug\IATHOOK.exe 25 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.obj -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp;D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK\x64\Debug\IATHOOK.obj 2 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/IATHOOK.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Debug|x64|D:\算法训练\项目实现\IATHOOK\IATHOOK\| 3 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/link.secondary.1.tlog: -------------------------------------------------------------------------------- 1 | ^D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK\X64\DEBUG\IATHOOK.OBJ 2 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK\x64\Debug\IATHOOK.ilk 3 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/IATHOOK.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/vc143.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/vc143.idb -------------------------------------------------------------------------------- /IATHook/IATHOOK/IATHOOK/x64/Debug/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/IATHOOK/x64/Debug/vc143.pdb -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | D:\算法训练\项目实现\IATHOOK\Release\IATHOOK.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.iobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.iobj -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.ipdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.ipdb -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.log: -------------------------------------------------------------------------------- 1 |  IATHOOK.cpp 2 | 正在生成代码 3 | Previous IPDB not found, fall back to full compilation. 4 | All 7 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. 5 | 已完成代码的生成 6 | IATHOOK.vcxproj -> D:\算法训练\项目实现\IATHOOK\Release\IATHOOK.exe 7 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.obj -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\IATHOOK\IATHOOK\IATHOOK.cpp;D:\算法训练\项目实现\IATHOOK\IATHOOK\Release\IATHOOK.obj 2 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/IATHOOK.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Release|Win32|D:\算法训练\项目实现\IATHOOK\| 3 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/link.secondary.1.tlog: -------------------------------------------------------------------------------- 1 | ^D:\算法训练\项目实现\IATHOOK\IATHOOK\RELEASE\IATHOOK.OBJ 2 | D:\算法训练\项目实现\IATHOOK\IATHOOK\Release\IATHOOK.IPDB 3 | D:\算法训练\项目实现\IATHOOK\IATHOOK\Release\IATHOOK.iobj 4 | -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/IATHOOK.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/IATHOOK.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /IATHook/IATHOOK/Release/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/Release/vc143.pdb -------------------------------------------------------------------------------- /IATHook/IATHOOK/x64/Debug/IATHOOK.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/x64/Debug/IATHOOK.exe -------------------------------------------------------------------------------- /IATHook/IATHOOK/x64/Debug/IATHOOK.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/IATHOOK/x64/Debug/IATHOOK.pdb -------------------------------------------------------------------------------- /IATHook/Release/IATHOOK.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/Release/IATHOOK.exe -------------------------------------------------------------------------------- /IATHook/Release/IATHOOK.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/IATHook/Release/IATHOOK.pdb -------------------------------------------------------------------------------- /InlineHook/InlineHook.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.34928.147 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InlineHook", "InlineHook\InlineHook.vcxproj", "{E1BD7CEF-0F16-4D98-A49D-31944BB048A5}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {E1BD7CEF-0F16-4D98-A49D-31944BB048A5}.Debug|x64.ActiveCfg = Debug|x64 17 | {E1BD7CEF-0F16-4D98-A49D-31944BB048A5}.Debug|x64.Build.0 = Debug|x64 18 | {E1BD7CEF-0F16-4D98-A49D-31944BB048A5}.Debug|x86.ActiveCfg = Debug|Win32 19 | {E1BD7CEF-0F16-4D98-A49D-31944BB048A5}.Debug|x86.Build.0 = Debug|Win32 20 | {E1BD7CEF-0F16-4D98-A49D-31944BB048A5}.Release|x64.ActiveCfg = Release|x64 21 | {E1BD7CEF-0F16-4D98-A49D-31944BB048A5}.Release|x64.Build.0 = Release|x64 22 | {E1BD7CEF-0F16-4D98-A49D-31944BB048A5}.Release|x86.ActiveCfg = Release|Win32 23 | {E1BD7CEF-0F16-4D98-A49D-31944BB048A5}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {BA7862F3-576F-4470-9737-1E06B05D28F0} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/Debug/InlineHook.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/Debug/InlineHook.exe -------------------------------------------------------------------------------- /InlineHook/InlineHook/Debug/InlineHook.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/Debug/InlineHook.pdb -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | 24 | using namespace std; 25 | typedef VOID(*PFUNMSG)(LPCWSTR szMsg, LPCWSTR Title); 26 | #pragma comment(linker,"/INCLUDE:__tls_used") 27 | HMODULE hModule; 28 | PFUNMSG Crypto; 29 | 30 | BYTE __NewCode[7] = { 0xE9, 0x0, 0x0, 0x0, 0x0, 0x0 }; 31 | BYTE __OldCode[7] = { 0 }; 32 | 33 | int fun2(); 34 | int fun1(); 35 | void InlineHook(); 36 | 37 | 38 | void InlineHook() 39 | { 40 | 41 | if (ReadProcessMemory(INVALID_HANDLE_VALUE, fun2, __OldCode, 7, NULL) == 0) 42 | { 43 | printf("ReadProcessMemory error\n"); 44 | return; 45 | } 46 | 47 | DWORD JmpAddress = (DWORD)fun1; 48 | // 计算自定义函数的地址. 49 | // 构造新头部代码 50 | __NewCode[0] = 0xB8; // 51 | memcpy(&__NewCode[1], &JmpAddress, 4); // mov eax, _JmpAddr 52 | __NewCode[5] = 0xFF; // 53 | __NewCode[6] = 0xE0; // jmp eax 54 | DWORD dwOldProtect = 0; 55 | //DWORD dwOldProtect = 0; //旧保护属性 56 | // 去内存保护 57 | ::VirtualProtect(fun2, 7, PAGE_EXECUTE_READWRITE, &dwOldProtect); 58 | //写入跳转,开始Hook 59 | WriteProcessMemory(INVALID_HANDLE_VALUE, fun2, __NewCode, 7, NULL); 60 | // 写内存保护 61 | ::VirtualProtect(fun2, 7, dwOldProtect, &dwOldProtect); 62 | } 63 | 64 | 65 | 66 | 67 | int main() 68 | { 69 | InlineHook(); 70 | fun2(); 71 | } 72 | 73 | int fun2() { 74 | puts("Right!"); 75 | return 0; 76 | } 77 | 78 | int fun1() { 79 | puts("If You see me,That's Mean's you are success!"); 80 | return 0; 81 | } 82 | 83 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {e1bd7cef-0f16-4d98-a49d-31944bb048a5} 25 | InlineHook 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | 80 | 81 | Console 82 | true 83 | false 84 | false 85 | 86 | 87 | 88 | 89 | Level3 90 | true 91 | true 92 | true 93 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 94 | true 95 | 96 | 97 | Console 98 | true 99 | true 100 | true 101 | 102 | 103 | 104 | 105 | Level3 106 | true 107 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 108 | true 109 | 110 | 111 | Console 112 | true 113 | 114 | 115 | 116 | 117 | Level3 118 | true 119 | true 120 | true 121 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 122 | true 123 | 124 | 125 | Console 126 | true 127 | true 128 | true 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | D:\算法训练\项目实现\InlineHook\InlineHook\Debug\InlineHook.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/InlineHook.ilk -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.log: -------------------------------------------------------------------------------- 1 |  InlineHook.cpp 2 | InlineHook.vcxproj -> D:\算法训练\项目实现\InlineHook\InlineHook\Debug\InlineHook.exe 3 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/InlineHook.obj -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\InlineHook\InlineHook\InlineHook.cpp;D:\算法训练\项目实现\InlineHook\InlineHook\InlineHook\Debug\InlineHook.obj 2 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/InlineHook.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Debug|Win32|D:\算法训练\项目实现\InlineHook\InlineHook\| 3 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/link.secondary.1.tlog: -------------------------------------------------------------------------------- 1 | ^D:\算法训练\项目实现\INLINEHOOK\INLINEHOOK\INLINEHOOK\DEBUG\INLINEHOOK.OBJ 2 | D:\算法训练\项目实现\InlineHook\InlineHook\InlineHook\Debug\InlineHook.ilk 3 | -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/InlineHook.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/vc143.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/vc143.idb -------------------------------------------------------------------------------- /InlineHook/InlineHook/InlineHook/Debug/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/InlineHook/InlineHook/InlineHook/Debug/vc143.pdb -------------------------------------------------------------------------------- /Junkcode/junkcode.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.34928.147 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "junkcode", "junkcode\junkcode.vcxproj", "{E0649530-E0A2-41CA-8E0E-6BCD95708FDB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {E0649530-E0A2-41CA-8E0E-6BCD95708FDB}.Debug|x64.ActiveCfg = Debug|x64 17 | {E0649530-E0A2-41CA-8E0E-6BCD95708FDB}.Debug|x64.Build.0 = Debug|x64 18 | {E0649530-E0A2-41CA-8E0E-6BCD95708FDB}.Debug|x86.ActiveCfg = Debug|Win32 19 | {E0649530-E0A2-41CA-8E0E-6BCD95708FDB}.Debug|x86.Build.0 = Debug|Win32 20 | {E0649530-E0A2-41CA-8E0E-6BCD95708FDB}.Release|x64.ActiveCfg = Release|x64 21 | {E0649530-E0A2-41CA-8E0E-6BCD95708FDB}.Release|x64.Build.0 = Release|x64 22 | {E0649530-E0A2-41CA-8E0E-6BCD95708FDB}.Release|x86.ActiveCfg = Release|Win32 23 | {E0649530-E0A2-41CA-8E0E-6BCD95708FDB}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {07DAA86D-49F6-427F-9A2D-9009D031B210} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Junkcode/junkcode/Debug/junkcode.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/Debug/junkcode.exe -------------------------------------------------------------------------------- /Junkcode/junkcode/Debug/junkcode.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/Debug/junkcode.pdb -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | using namespace std; 24 | 25 | int main(){ 26 | 27 | _asm { 28 | jz label1 // zf不为0 跳转 29 | jnz label1 // zf标志位 为0跳转 30 | _EMIT 0x89 31 | label1 : 32 | } 33 | _asm 34 | { 35 | call f1 36 | f1 : 37 | add byte ptr[esp + 0], 6 38 | ret 39 | _EMIT 0x89 40 | } 41 | 42 | printf("hello"); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {e0649530-e0a2-41ca-8e0e-6bcd95708fdb} 25 | junkcode 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | 80 | 81 | Console 82 | true 83 | 84 | 85 | 86 | 87 | Level3 88 | true 89 | true 90 | true 91 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | 94 | 95 | Console 96 | true 97 | true 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | true 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | true 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | true 118 | true 119 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 120 | true 121 | 122 | 123 | Console 124 | true 125 | true 126 | true 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | D:\算法训练\项目实现\junkcode\junkcode\Debug\junkcode.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/junkcode.ilk -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.log: -------------------------------------------------------------------------------- 1 |  junkcode.cpp 2 | junkcode.vcxproj -> D:\算法训练\项目实现\junkcode\junkcode\Debug\junkcode.exe 3 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/junkcode.obj -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/junkcode.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/junkcode.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/junkcode.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp;D:\算法训练\项目实现\junkcode\junkcode\junkcode\Debug\junkcode.obj 2 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/junkcode.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Debug|Win32|D:\算法训练\项目实现\junkcode\junkcode\| 3 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/junkcode.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/junkcode.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/link.secondary.1.tlog: -------------------------------------------------------------------------------- 1 | ^D:\算法训练\项目实现\JUNKCODE\JUNKCODE\JUNKCODE\DEBUG\JUNKCODE.OBJ 2 | D:\算法训练\项目实现\junkcode\junkcode\junkcode\Debug\junkcode.ilk 3 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/junkcode.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/junkcode.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/vc143.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/vc143.idb -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/Debug/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/Debug/vc143.pdb -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/x64/Debug/junkcode.log: -------------------------------------------------------------------------------- 1 |  junkcode.cpp 2 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(27,5): error C4235: 使用了非标准扩展: 不支持在此结构上使用“__asm”关键字 3 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(28,9): error C2065: “jz”: 未声明的标识符 4 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(28,12): error C2146: 语法错误: 缺少“;”(在标识符“label1”的前面) 5 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(28,12): error C2065: “label1”: 未声明的标识符 6 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(29,9): error C2146: 语法错误: 缺少“;”(在标识符“jnz”的前面) 7 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(29,9): error C2065: “jnz”: 未声明的标识符 8 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(29,13): error C2146: 语法错误: 缺少“;”(在标识符“label1”的前面) 9 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(29,13): error C2065: “label1”: 未声明的标识符 10 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(30,9): error C2146: 语法错误: 缺少“;”(在标识符“_EMIT”的前面) 11 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(30,9): error C2065: “_EMIT”: 未声明的标识符 12 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(30,15): error C2143: 语法错误: 缺少“;”(在“常数”的前面) 13 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(31,9): error C2146: 语法错误: 缺少“;”(在标识符“label1”的前面) 14 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(32,5): error C2059: 语法错误:“}” 15 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(33,5): error C4235: 使用了非标准扩展: 不支持在此结构上使用“__asm”关键字 16 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(35,9): error C2065: “call”: 未声明的标识符 17 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(35,14): error C2146: 语法错误: 缺少“;”(在标识符“f1”的前面) 18 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(35,14): error C2065: “f1”: 未声明的标识符 19 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(36,9): error C2146: 语法错误: 缺少“;”(在标识符“f1”的前面) 20 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(37,9): error C2065: “add”: 未声明的标识符 21 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(37,17): error C2146: 语法错误: 缺少“;”(在标识符“byte”的前面) 22 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(37,26): error C2065: “esp”: 未声明的标识符 23 | D:\算法训练\项目实现\junkcode\junkcode\junkcode.cpp(37,36): error C2059: 语法错误:“常数” 24 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/x64/Debug/junkcode.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/x64/Debug/junkcode.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/x64/Debug/junkcode.tlog/junkcode.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Debug|x64|D:\算法训练\项目实现\junkcode\junkcode\| 3 | -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/x64/Debug/junkcode.tlog/unsuccessfulbuild: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/x64/Debug/junkcode.tlog/unsuccessfulbuild -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/x64/Debug/vc143.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/x64/Debug/vc143.idb -------------------------------------------------------------------------------- /Junkcode/junkcode/junkcode/x64/Debug/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/Junkcode/junkcode/junkcode/x64/Debug/vc143.pdb -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeRepo 2 | 这是SWDD的逆向技术实现代码存储仓库~ 3 | ![bitmap](https://github.com/SHangwendada/CodeRepo/assets/102873474/42df5d96-6c5a-489c-bd86-04ae2f7e8a74) 4 | -------------------------------------------------------------------------------- /SMC/SMC.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.34928.147 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SMC", "SMC\SMC.vcxproj", "{EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}.Debug|x64.ActiveCfg = Debug|x64 17 | {EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}.Debug|x64.Build.0 = Debug|x64 18 | {EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}.Debug|x86.ActiveCfg = Debug|Win32 19 | {EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}.Debug|x86.Build.0 = Debug|Win32 20 | {EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}.Release|x64.ActiveCfg = Release|x64 21 | {EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}.Release|x64.Build.0 = Release|x64 22 | {EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}.Release|x86.ActiveCfg = Release|Win32 23 | {EF17AB11-02CC-4C4A-934B-F3BAC55F95D1}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {AB65FE83-3969-4329-8150-1B1FBF268072} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /SMC/SMC/Debug/SMC.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/Debug/SMC.exe -------------------------------------------------------------------------------- /SMC/SMC/Debug/SMC.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/Debug/SMC.pdb -------------------------------------------------------------------------------- /SMC/SMC/SMC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #pragma code_seg(".hello") 11 | int fun() 12 | { 13 | puts("Hello"); 14 | return 0; 15 | } 16 | #pragma code_seg() 17 | #pragma comment(linker, "/SECTION:.hello,ERW") 18 | 19 | void Fun1end() 20 | { 21 | } 22 | 23 | void xxor(char* soure, int dLen, int key) //异或 24 | { 25 | for (int i = 0; i < dLen; i++) 26 | { 27 | soure[i] = soure[i] ^ key; 28 | } 29 | } 30 | void SMC(char* pBuf, int key) //SMC解密/加密函数 31 | { 32 | const char* szSecName = ".hello"; 33 | short nSec; 34 | PIMAGE_DOS_HEADER pDosHeader; 35 | PIMAGE_NT_HEADERS pNtHeader; 36 | PIMAGE_SECTION_HEADER pSec; 37 | pDosHeader = (PIMAGE_DOS_HEADER)pBuf; 38 | pNtHeader = (PIMAGE_NT_HEADERS)&pBuf[pDosHeader->e_lfanew]; 39 | nSec = pNtHeader->FileHeader.NumberOfSections; 40 | pSec = (PIMAGE_SECTION_HEADER)&pBuf[sizeof(IMAGE_NT_HEADERS) + pDosHeader->e_lfanew]; 41 | for (int i = 0; i < nSec; i++) 42 | { 43 | if (strcmp((char*)&pSec->Name, szSecName) == 0) 44 | { 45 | int pack_size; 46 | char* packStart; 47 | pack_size = pSec->SizeOfRawData; 48 | packStart = &pBuf[pSec->VirtualAddress]; 49 | xxor(packStart, pack_size, key); 50 | return; 51 | } 52 | pSec++; 53 | } 54 | } 55 | void UnPack() //解密/加密函数 56 | { 57 | char* hMod; 58 | hMod = (char*)GetModuleHandle(0); //获得当前的exe模块地址 59 | SMC(hMod, 0xff); 60 | } 61 | 62 | 63 | 64 | 65 | int main(void) 66 | { 67 | 68 | UnPack(); 69 | UnPack();//编译时请注释一个 70 | fun(); 71 | return 0; 72 | } -------------------------------------------------------------------------------- /SMC/SMC/SMC.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {ef17ab11-02cc-4c4a-934b-f3bac55f95d1} 25 | SMC 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | 80 | 81 | Console 82 | true 83 | false 84 | false 85 | 86 | 87 | 88 | 89 | Level3 90 | true 91 | true 92 | true 93 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 94 | true 95 | 96 | 97 | Console 98 | true 99 | true 100 | true 101 | 102 | 103 | 104 | 105 | Level3 106 | true 107 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 108 | true 109 | 110 | 111 | Console 112 | true 113 | 114 | 115 | 116 | 117 | Level3 118 | true 119 | true 120 | true 121 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 122 | true 123 | 124 | 125 | Console 126 | true 127 | true 128 | true 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /SMC/SMC/SMC.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | -------------------------------------------------------------------------------- /SMC/SMC/SMC.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | D:\算法训练\项目实现\SMC\SMC\Debug\SMC.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/SMC.ilk -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.log: -------------------------------------------------------------------------------- 1 |  SMC.cpp 2 | SMC.vcxproj -> D:\算法训练\项目实现\SMC\SMC\Debug\SMC.exe 3 | -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/SMC.obj -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/SMC.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/SMC.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/SMC.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\SMC\SMC\SMC.cpp;D:\算法训练\项目实现\SMC\SMC\SMC\Debug\SMC.obj 2 | -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/SMC.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Debug|Win32|D:\算法训练\项目实现\SMC\SMC\| 3 | -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/SMC.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/SMC.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/link.secondary.1.tlog: -------------------------------------------------------------------------------- 1 | ^D:\算法训练\项目实现\SMC\SMC\SMC\DEBUG\SMC.OBJ 2 | D:\算法训练\项目实现\SMC\SMC\SMC\Debug\SMC.ilk 3 | -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/SMC.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/SMC.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/vc143.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/vc143.idb -------------------------------------------------------------------------------- /SMC/SMC/SMC/Debug/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/SMC/SMC/SMC/Debug/vc143.pdb -------------------------------------------------------------------------------- /SMC/smc事先加密脚本.py: -------------------------------------------------------------------------------- 1 | import pefile 2 | 3 | def encrypt_section(pe_file, section_name, xor_key): 4 | """ 5 | 加密PE文件中指定的区段 6 | """ 7 | # 找到对应的section 8 | for section in pe_file.sections: 9 | if section.Name.decode().strip('\x00') == section_name: 10 | print(f"[*] Found {section_name} section at 0x{section.PointerToRawData:08x}") 11 | data = section.get_data() 12 | encrypted_data = bytes([data[i] ^ xor_key for i in range(len(data))]) 13 | pe_file.set_bytes_at_offset(section.PointerToRawData, encrypted_data) 14 | print(f"[*] Encrypted {len(data)} bytes at 0x{section.PointerToRawData:08x}") 15 | return 16 | 17 | print(f"[!] {section_name} section not found!") 18 | 19 | 20 | if __name__ == "__main__": 21 | filename = "smctest.exe" 22 | section_name = ".hello" 23 | xor_key = 0xff 24 | 25 | print(f"[*] Loading {filename}") 26 | pe_file = pefile.PE(filename) 27 | 28 | # 加密 29 | print("[*] Encrypting section") 30 | encrypt_section(pe_file, section_name, xor_key) 31 | 32 | # 保存文件 33 | new_filename = filename[:-4] + "_encrypted.exe" 34 | print(f"[*] Saving as {new_filename}") 35 | pe_file.write(new_filename) 36 | pe_file.close() 37 | -------------------------------------------------------------------------------- /Seccomp+除0异常hook/README.md: -------------------------------------------------------------------------------- 1 | 如果没有seccomp事先需要通过apt install 安装 2 | 3 | 4 | 5 | 编译参数: 6 | 7 | ~~~bash 8 | g++ demo.cpp -o test -lseccomp && chmod +x test && ./test 9 | ~~~ 10 | 11 | -------------------------------------------------------------------------------- /Seccomp+除0异常hook/demo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | // 异步安全输出 10 | void safe_print(const char *msg) { 11 | syscall(SYS_write, STDOUT_FILENO, msg, strlen(msg)); 12 | } 13 | 14 | // 异步安全输出整数 15 | void safe_print_int(long value) { 16 | char buffer[32]; 17 | int len = snprintf(buffer, sizeof(buffer), "%ld", value); // 格式化整数 18 | if (len > 0) { 19 | syscall(SYS_write, STDOUT_FILENO, buffer, len); // 安全输出 20 | } 21 | } 22 | 23 | // 异步安全整数输入函数 24 | // 返回值:0-成功,-1-输入错误,-2-系统调用失败 25 | int safe_scanf_int(int *value) { 26 | char buffer[32] = {0}; 27 | ssize_t ret = syscall(SYS_read, STDIN_FILENO, buffer, sizeof(buffer)-1); 28 | 29 | if (ret < 0) { // 系统调用失败 30 | return -2; 31 | } else if (ret == 0) { // EOF(如Ctrl+D) 32 | return -1; 33 | } 34 | 35 | // 移除末尾换行符(兼容回车结尾) 36 | if (buffer[ret-1] == '\n') { 37 | buffer[ret-1] = '\0'; 38 | } else { 39 | buffer[ret] = '\0'; // 确保字符串终止 40 | } 41 | 42 | // 验证输入合法性 43 | char *endptr; 44 | long tmp = strtol(buffer, &endptr, 10); 45 | if (*endptr != '\0') { // 存在非数字字符 46 | return -1; 47 | } 48 | 49 | 50 | *value = (int)tmp; 51 | return 0; 52 | } 53 | 54 | 55 | // SIGFPE 处理器 56 | void sigfpe_handler(int sig, siginfo_t *info, void *ucontext) { 57 | ucontext_t *uc = (ucontext_t *)ucontext;//获取触发异常之前的上下文 58 | safe_print("捕获到 SIGFPE 信号!\n"); 59 | 60 | // 获取主函数的 rbp 值 61 | unsigned long rbp = uc->uc_mcontext.gregs[REG_RBP]; 62 | 63 | // 计算 a 的地址:rbp - 0xC 64 | int *a_ptr = (int *)(rbp - 0x8); // 这个需要首先反汇编看一下输入到底存在栈的哪个位置 65 | /* 66 | 类似于 67 | call _Z14safe_scanf_intPi ; safe_scanf_int(int *) 68 | mov eax, [rbp+var_8] 69 | 你这里的a_ptr就是rbp-0x8 70 | */ 71 | 72 | safe_print("检测到输入的a为:"); 73 | safe_print_int(*a_ptr); 74 | safe_print("\n"); 75 | // 修改 a 的值(例如设为 42) 76 | *a_ptr = 42; 77 | 78 | // 跳过触发异常的指令(2 字节) 79 | uc->uc_mcontext.gregs[REG_RIP] += 2; 80 | 81 | safe_print("已修改 a 的值为42。\n"); 82 | //已修改 a 的值为42。 83 | } 84 | 85 | // 注册信号处理器 86 | void __attribute__ ((constructor)) setup_sigfpe_handler() { 87 | struct sigaction sa; 88 | sa.sa_sigaction = sigfpe_handler; 89 | sigemptyset(&sa.sa_mask); 90 | sa.sa_flags = SA_SIGINFO | SA_NODEFER; // 允许信号嵌套 91 | sigaction(SIGFPE, &sa, NULL); 92 | } 93 | 94 | // 配置 seccomp 95 | void __attribute__ ((constructor)) setup_seccomp() { 96 | scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_KILL); 97 | seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(exit_group), 0); 98 | seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(write), 0); 99 | seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(brk), 0); 100 | seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(rt_sigreturn), 0); 101 | seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(mmap), 0); 102 | seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(read), 0); 103 | seccomp_load(ctx); 104 | seccomp_release(ctx); 105 | } 106 | 107 | int main() { 108 | // 触发除零(使用 volatile 防止优化) 109 | int a = 0; 110 | volatile int c = 10, d = 1,f = 0; 111 | 112 | safe_print("Please input a。\n"); 113 | safe_scanf_int(&a); 114 | //构造e恒除以0 115 | f = a | 1; 116 | d >>= f; 117 | int e = c / d; 118 | 119 | // 安全输出 120 | safe_print("程序继续执行。\n"); 121 | safe_print("a = "); 122 | safe_print_int(a); 123 | // 安全退出 124 | syscall(SYS_exit_group, 0); 125 | } 126 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.34928.147 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLS", "TLS\TLS.vcxproj", "{72756B73-4901-449D-AF86-89667325E680}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {72756B73-4901-449D-AF86-89667325E680}.Debug|x64.ActiveCfg = Debug|x64 17 | {72756B73-4901-449D-AF86-89667325E680}.Debug|x64.Build.0 = Debug|x64 18 | {72756B73-4901-449D-AF86-89667325E680}.Debug|x86.ActiveCfg = Debug|Win32 19 | {72756B73-4901-449D-AF86-89667325E680}.Debug|x86.Build.0 = Debug|Win32 20 | {72756B73-4901-449D-AF86-89667325E680}.Release|x64.ActiveCfg = Release|x64 21 | {72756B73-4901-449D-AF86-89667325E680}.Release|x64.Build.0 = Release|x64 22 | {72756B73-4901-449D-AF86-89667325E680}.Release|x86.ActiveCfg = Release|Win32 23 | {72756B73-4901-449D-AF86-89667325E680}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {EEC8D80C-102F-4BC7-AA6D-14B870DD83B6} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/Debug/TLS.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/Debug/TLS.exe -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/Debug/TLS.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/Debug/TLS.pdb -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | using namespace std; 24 | typedef VOID(*PFUNMSG)(LPCWSTR szMsg, LPCWSTR Title); 25 | #pragma comment(linker,"/INCLUDE:__tls_used") 26 | HMODULE hModule; 27 | PFUNMSG Crypto; 28 | 29 | 30 | 31 | 32 | VOID NTAPI tls_callback( 33 | PVOID DllHandle, 34 | DWORD Reason, 35 | PVOID Reserved 36 | ) 37 | { 38 | printf("hello\n"); 39 | } 40 | 41 | 42 | #pragma data_seg(".CRT$XLX") 43 | PIMAGE_TLS_CALLBACK pTlsfun[] = { tls_callback ,0 }; 44 | 45 | 46 | int main() { 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {72756b73-4901-449d-af86-89667325e680} 25 | TLS 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | 80 | 81 | Console 82 | true 83 | 84 | 85 | 86 | 87 | Level3 88 | true 89 | true 90 | true 91 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | 94 | 95 | Console 96 | true 97 | true 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | true 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | true 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | true 118 | true 119 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 120 | true 121 | 122 | 123 | Console 124 | true 125 | true 126 | true 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | D:\算法训练\项目实现\TLS\TLS\TLS\Debug\TLS.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/TLS.ilk -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.log: -------------------------------------------------------------------------------- 1 |  TLS.cpp 2 | TLS.vcxproj -> D:\算法训练\项目实现\TLS\TLS\TLS\Debug\TLS.exe 3 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/TLS.obj -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | D:\算法训练\项目实现\TLS\TLS\TLS\TLS.cpp;D:\算法训练\项目实现\TLS\TLS\TLS\TLS\Debug\TLS.obj 2 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/TLS.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.40.33807:TargetPlatformVersion=10.0.22621.0: 2 | Debug|Win32|D:\算法训练\项目实现\TLS\TLS\TLS\| 3 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/link.secondary.1.tlog: -------------------------------------------------------------------------------- 1 | ^D:\算法训练\项目实现\TLS\TLS\TLS\TLS\DEBUG\TLS.OBJ 2 | D:\算法训练\项目实现\TLS\TLS\TLS\TLS\Debug\TLS.ilk 3 | -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/TLS.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/vc143.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/vc143.idb -------------------------------------------------------------------------------- /TlsCallBack/TLS/TLS/TLS/Debug/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SHangwendada/CodeRepo/f64dd86f5c8bd1ac01a465e1f26f21db19188c4c/TlsCallBack/TLS/TLS/TLS/Debug/vc143.pdb -------------------------------------------------------------------------------- /antiFrida/antiInlineHook/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about using CMake with Android Studio, read the 2 | # documentation: https://d.android.com/studio/projects/add-native-code.html. 3 | # For more examples on how to use CMake, see https://github.com/android/ndk-samples. 4 | 5 | # Sets the minimum CMake version required for this project. 6 | cmake_minimum_required(VERSION 3.22.1) 7 | 8 | # Declares the project name. The project name can be accessed via ${ PROJECT_NAME}, 9 | # Since this is the top level CMakeLists.txt, the project name is also accessible 10 | # with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level 11 | # build script scope). 12 | project("summertrain") 13 | 14 | # Creates and names a library, sets it as either STATIC 15 | # or SHARED, and provides the relative paths to its source code. 16 | # You can define multiple libraries, and CMake builds them for you. 17 | # Gradle automatically packages shared libraries with your APK. 18 | # 19 | # In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define 20 | # the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME} 21 | # is preferred for the same purpose. 22 | # 23 | # In order to load a library into your app from Java/Kotlin, you must call 24 | # System.loadLibrary() and pass the name of the library defined here; 25 | # for GameActivity/NativeActivity derived applications, the same library name must be 26 | # used in the AndroidManifest.xml file. 27 | add_library(${CMAKE_PROJECT_NAME} SHARED 28 | # List C/C++ source files with relative paths to this CMakeLists.txt. 29 | dlfcn/local_dlfcn.c 30 | native-lib.cpp 31 | ) 32 | # 设置编译类型为 Release,删除符号信息 33 | set(CMAKE_BUILD_TYPE Release) 34 | 35 | # 添加其他 CMake 配置... 36 | 37 | # Specifies libraries CMake should link to your target library. You 38 | # can link libraries from various origins, such as libraries defined in this 39 | # build script, prebuilt third-party libraries, or Android system libraries. 40 | target_link_libraries(${CMAKE_PROJECT_NAME} 41 | # List libraries link to the target library 42 | android 43 | log) -------------------------------------------------------------------------------- /antiFrida/antiInlineHook/dlfcn/local_dlfcn.c: -------------------------------------------------------------------------------- 1 | // 2 | // Created by luoyesiqiu 3 | // 4 | #include "local_dlfcn.h" 5 | #ifdef __LP64__ 6 | #define Elf_Ehdr Elf64_Ehdr 7 | #define Elf_Shdr Elf64_Shdr 8 | #define Elf_Sym Elf64_Sym 9 | #else 10 | #define Elf_Ehdr Elf32_Ehdr 11 | #define Elf_Shdr Elf32_Shdr 12 | #define Elf_Sym Elf32_Sym 13 | #endif 14 | 15 | /** 16 | * 打开一个本地so文件 17 | * @param lib_path so文件路径 18 | * @return 句柄 19 | */ 20 | void *local_dlopen(const char* lib_path){ 21 | int fd = open(lib_path, O_RDONLY); 22 | if (fd < 0) { 23 | return NULL; 24 | } 25 | 26 | size_t size = lseek(fd, 0, SEEK_END); 27 | if (size <= 0) { 28 | return NULL; 29 | } 30 | 31 | Elf_Ehdr *elf = (Elf_Ehdr *) mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0); 32 | close(fd); 33 | fd = -1; 34 | 35 | if (elf == MAP_FAILED) { 36 | return NULL; 37 | } 38 | 39 | char* shoff = ((char *) elf) + elf->e_shoff; 40 | struct local_dlfcn_handle* handle = (struct local_dlfcn_handle *) calloc(1,sizeof(struct local_dlfcn_handle)); 41 | handle->elf = (char *)elf; 42 | handle->size = size; 43 | for (int k = 0; k < elf->e_shnum; k++, shoff += elf->e_shentsize) { 44 | Elf_Shdr *sh = (Elf_Shdr *) shoff; 45 | //LOGD("%s: k=%d shdr=%p type=%x", __func__, k, sh, sh->sh_type); 46 | 47 | switch (sh->sh_type) { 48 | case SHT_DYNSYM: 49 | if (handle->dynsym){ 50 | goto tail; 51 | } 52 | handle->dynsym = malloc(sh->sh_size); 53 | if (!handle->dynsym) { 54 | goto tail; 55 | } 56 | memcpy(handle->dynsym, ((char *) elf) + sh->sh_offset, sh->sh_size); 57 | handle->nsyms = (sh->sh_size / sizeof(Elf_Sym)); 58 | //LOGD("%s SHT_DYNSYM,shndx",__func__); 59 | break; 60 | 61 | case SHT_STRTAB: 62 | if (handle->dynstr) break; /* .dynstr is guaranteed to be the first STRTAB */ 63 | handle->dynstr = malloc(sh->sh_size); 64 | if (!handle->dynstr) { 65 | goto tail; 66 | } 67 | memcpy(handle->dynstr, ((char *) elf) + sh->sh_offset, sh->sh_size); 68 | //LOGD("%s SHT_STRTAB",__func__); 69 | break; 70 | } 71 | 72 | } 73 | return handle; 74 | 75 | tail: 76 | if (fd >= 0) close(fd); 77 | if (elf != MAP_FAILED) { 78 | munmap(elf, size); 79 | } 80 | local_dlclose(handle); 81 | return NULL; 82 | } 83 | 84 | /** 85 | * 从so文件查找一个符号 86 | * @param handle 句柄 87 | * @param sym_name 符号名 88 | * @return 符号在so文件中的偏移 89 | */ 90 | off_t local_dlsym(void *handle,const char *sym_name){ 91 | struct local_dlfcn_handle* h = (struct local_dlfcn_handle*)handle; 92 | Elf_Sym *sym = (Elf_Sym *) h->dynsym; 93 | char *strings = h->dynstr; 94 | int dynsym_sh_ndx = 0; 95 | off_t dynsym_st_value = 0; 96 | int found_sym = 0; 97 | for(int i = 0; i < h->nsyms;sym++,i++){ 98 | if (strcmp(strings + sym->st_name, sym_name) == 0) { 99 | dynsym_st_value = sym->st_value; 100 | dynsym_sh_ndx = sym->st_shndx; 101 | found_sym = 1; 102 | //LOGD("%s %s found at %p,st_shndx = %ld",__func__, sym_name, dynsym_st_value,sym->st_shndx); 103 | } 104 | } 105 | if(!found_sym){ 106 | return -1; 107 | } 108 | Elf_Ehdr *elf = (Elf_Ehdr *)h->elf; 109 | char* shoff = ((char *) elf) + elf->e_shoff; 110 | for(int i = 0;elf->e_shnum;i++,shoff += elf->e_shentsize){ 111 | if(dynsym_sh_ndx == i){ 112 | Elf_Shdr *sh = (Elf_Shdr *) shoff; 113 | return sh->sh_offset + dynsym_st_value - sh->sh_addr; 114 | } 115 | } 116 | return -1; 117 | } 118 | 119 | /** 120 | * 关闭句柄 121 | * @param handle 句柄 122 | */ 123 | void local_dlclose(void *handle){ 124 | if(handle){ 125 | struct local_dlfcn_handle *h = (struct local_dlfcn_handle *) handle; 126 | if(h->dynstr) free(h->dynstr); 127 | if(h->dynsym) free(h->dynsym); 128 | if (h->elf != MAP_FAILED) { 129 | munmap(h->elf, h->size); 130 | } 131 | free(handle); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /antiFrida/antiInlineHook/dlfcn/local_dlfcn.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by luoyesiqiu 3 | // 4 | 5 | #ifndef LOCAL_DLFCN_H 6 | #define LOCAL_DLFCN_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "../logger.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | struct local_dlfcn_handle{ 22 | char *elf; 23 | size_t size; 24 | char *dynsym; 25 | int nsyms; 26 | char *dynstr; 27 | }; 28 | 29 | void *local_dlopen(const char *lib_path); 30 | off_t local_dlsym(void *handle, const char *sym_name); 31 | void local_dlclose(void *handle); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /antiFrida/antiInlineHook/logger.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by luoyesiqiu 3 | // 4 | 5 | #ifndef LOCAL_DLFCN_LOGGER_H 6 | #define LOCAL_DLFCN_LOGGER_H 7 | 8 | #include 9 | 10 | #define TAG "local_dlfcn" 11 | 12 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) 13 | 14 | #endif //LOCAL_DLFCN_LOGGER_H 15 | -------------------------------------------------------------------------------- /antiFrida/antiInlineHook/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "dlfcn/local_dlfcn.h" 11 | 12 | #define LOG_TAG "GenFunction" 13 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 14 | #define S11 7 15 | #define S12 12 16 | #define S13 17 17 | #define S14 22 18 | #define S21 5 19 | #define S22 9 20 | #define S23 14 21 | #define S24 20 22 | #define S31 4 23 | #define S32 11 24 | #define S33 16 25 | #define S34 23 26 | #define S41 6 27 | #define S42 10 28 | #define S43 15 29 | #define S44 21 30 | 31 | #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) 32 | 33 | #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) 34 | #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) 35 | #define H(x, y, z) ((x) ^ (y) ^ (z)) 36 | #define I(x, y, z) ((y) ^ ((x) | (~z))) 37 | 38 | #define FF(a, b, c, d, x, s, ac) { \ 39 | (a) += F ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 40 | (a) = ROTATE_LEFT ((a), (s)); \ 41 | (a) += (b); \ 42 | } 43 | #define GG(a, b, c, d, x, s, ac) { \ 44 | (a) += G ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 45 | (a) = ROTATE_LEFT ((a), (s)); \ 46 | (a) += (b); \ 47 | } 48 | #define HH(a, b, c, d, x, s, ac) { \ 49 | (a) += H ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 50 | (a) = ROTATE_LEFT ((a), (s)); \ 51 | (a) += (b); \ 52 | } 53 | #define II(a, b, c, d, x, s, ac) { \ 54 | (a) += I ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 55 | (a) = ROTATE_LEFT ((a), (s)); \ 56 | (a) += (b); \ 57 | } 58 | 59 | static void simpleMD5Transform(unsigned int state[4], const unsigned char block[64]) { 60 | unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16]; 61 | int i; 62 | 63 | for (i = 0; i < 16; i++) { 64 | x[i] = ((unsigned int)block[i * 4]) | (((unsigned int)block[i * 4 + 1]) << 8) | 65 | (((unsigned int)block[i * 4 + 2]) << 16) | (((unsigned int)block[i * 4 + 3]) << 24); 66 | } 67 | 68 | FF(a, b, c, d, x[ 0], S11, 0xd76aa478); 69 | FF(d, a, b, c, x[ 1], S12, 0xe8c7b756); 70 | FF(c, d, a, b, x[ 2], S13, 0x242070db); 71 | FF(b, c, d, a, x[ 3], S14, 0xc1bdceee); 72 | FF(a, b, c, d, x[ 4], S11, 0xf57c0faf); 73 | FF(d, a, b, c, x[ 5], S12, 0x4787c62a); 74 | FF(c, d, a, b, x[ 6], S13, 0xa8304613); 75 | FF(b, c, d, a, x[ 7], S14, 0xfd469501); 76 | FF(a, b, c, d, x[ 8], S11, 0x698098d8); 77 | FF(d, a, b, c, x[ 9], S12, 0x8b44f7af); 78 | FF(c, d, a, b, x[10], S13, 0xffff5bb1); 79 | FF(b, c, d, a, x[11], S14, 0x895cd7be); 80 | FF(a, b, c, d, x[12], S11, 0x6b901122); 81 | FF(d, a, b, c, x[13], S12, 0xfd987193); 82 | FF(c, d, a, b, x[14], S13, 0xa679438e); 83 | FF(b, c, d, a, x[15], S14, 0x49b40821); 84 | 85 | GG(a, b, c, d, x[ 1], S21, 0xf61e2562); 86 | GG(d, a, b, c, x[ 6], S22, 0xc040b340); 87 | GG(c, d, a, b, x[11], S23, 0x265e5a51); 88 | GG(b, c, d, a, x[ 0], S24, 0xe9b6c7aa); 89 | GG(a, b, c, d, x[ 5], S21, 0xd62f105d); 90 | GG(d, a, b, c, x[10], S22, 0x2441453); 91 | GG(c, d, a, b, x[15], S23, 0xeeeeeeee); 92 | GG(b, c, d, a, x[ 4], S24, 0xe7d3fbc8); 93 | GG(a, b, c, d, x[ 9], S21, 0x21e1cde6); 94 | GG(d, a, b, c, x[14], S22, 0xc33707d6); 95 | GG(c, d, a, b, x[ 3], S23, 0xf4d50d87); 96 | GG(b, c, d, a, x[ 8], S24, 0x455a14ed); 97 | GG(a, b, c, d, x[13], S21, 0xa9e3e905); 98 | GG(d, a, b, c, x[ 2], S22, 0xfcefa3f8); 99 | GG(c, d, a, b, x[ 7], S23, 0x676f02d9); 100 | GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); 101 | 102 | HH(a, b, c, d, x[ 5], S31, 0xfffa3942); 103 | HH(d, a, b, c, x[ 8], S32, 0x8771f681); 104 | HH(c, d, a, b, x[11], S33, 0x6d9d6122); 105 | HH(b, c, d, a, x[14], S34, 0xfde5380c); 106 | HH(a, b, c, d, x[ 1], S31, 0xa4beea44); 107 | HH(d, a, b, c, x[ 4], S32, 0x4bdecfa9); 108 | HH(c, d, a, b, x[ 7], S33, 0xf6bb4b60); 109 | HH(b, c, d, a, x[10], S34, 0xbebfbc70); 110 | HH(a, b, c, d, x[13], S31, 0x289b7ec6); 111 | HH(d, a, b, c, x[ 0], S32, 0xeaa127fa); 112 | HH(c, d, a, b, x[ 3], S33, 0xd4ef3085); 113 | HH(b, c, d, a, x[ 6], S34, 0x4881d05); 114 | HH(a, b, c, d, x[ 9], S31, 0xd9d4d039); 115 | HH(d, a, b, c, x[12], S32, 0xe6db99e5); 116 | HH(c, d, a, b, x[15], S33, 0x1fa27cf8); 117 | HH(b, c, d, a, x[ 2], S34, 0xc4ac5665); 118 | 119 | II(a, b, c, d, x[ 0], S41, 0xf4292244); 120 | II(d, a, b, c, x[ 7], S42, 0x432aff97); 121 | II(c, d, a, b, x[14], S43, 0xab9423a7); 122 | II(b, c, d, a, x[ 5], S44, 0xfc93a039); 123 | II(a, b, c, d, x[12], S41, 0x655b59c3); 124 | II(d, a, b, c, x[ 3], S42, 0x8f0ccc92); 125 | II(c, d, a, b, x[10], S43, 0xffeff47d); 126 | II(b, c, d, a, x[ 1], S44, 0x85845dd1); 127 | II(a, b, c, d, x[ 8], S41, 0x6fa87e4f); 128 | II(d, a, b, c, x[15], S42, 0xfe2ce6e0); 129 | II(c, d, a, b, x[ 6], S43, 0xa3014314); 130 | II(b, c, d, a, x[13], S44, 0x4e0811a1); 131 | II(a, b, c, d, x[ 4], S41, 0xf7537e82); 132 | II(d, a, b, c, x[11], S42, 0xbd3af235); 133 | II(c, d, a, b, x[ 2], S43, 0x2ad7d2bb); 134 | II(b, c, d, a, x[ 9], S44, 0xaaaaaaaa); 135 | 136 | state[0] += a; 137 | state[1] += b; 138 | state[2] += c; 139 | state[3] += d; 140 | } 141 | 142 | 143 | 144 | 145 | 146 | 147 | void* check(void* arg) { 148 | while ((1)){ 149 | #ifdef __LP64__ 150 | const char *lib_path = "/system/lib64/libc.so"; 151 | #else 152 | const char *lib_path = "/system/lib/libc.so"; 153 | #endif 154 | #define CMP_COUNT 8 155 | const char *sym_name = "signal"; 156 | 157 | struct local_dlfcn_handle *handle = static_cast(local_dlopen(lib_path)); 158 | 159 | off_t offset = local_dlsym(handle,sym_name); 160 | 161 | FILE *fp = fopen(lib_path,"rb"); 162 | char file_bytes[CMP_COUNT] = {0}; 163 | if(fp != NULL){ 164 | fseek(fp,offset,SEEK_SET); 165 | fread(file_bytes,1,CMP_COUNT,fp); 166 | fclose(fp); 167 | } 168 | 169 | void *dl_handle = dlopen(lib_path,RTLD_NOW); 170 | void *sym = dlsym(dl_handle,sym_name); 171 | 172 | int is_hook = memcmp(file_bytes,sym,CMP_COUNT) != 0; 173 | 174 | local_dlclose(handle); 175 | dlclose(dl_handle); 176 | if (is_hook){ 177 | // LOGI("FIND!Hook!"); 178 | exit(0); 179 | } 180 | sleep(1); 181 | } 182 | 183 | } 184 | 185 | unsigned char storedBytes[256] = {0}; 186 | char hashString[33]; 187 | 188 | static void Gen() __attribute__((constructor)); 189 | static void Gen() { 190 | pthread_t tid; 191 | LOGI("GO!"); 192 | if (pthread_create(&tid, NULL, check, NULL) != 0) { 193 | perror("Failed to create thread"); 194 | exit(EXIT_FAILURE); 195 | } 196 | unsigned char flag[256] = "fridaCHeck3"; 197 | unsigned int state[4] = {0x67452201, 0xefcdab89, 0x98badcfe, 0x10325476}; 198 | unsigned char buffer[64] = {0}; 199 | int i; 200 | 201 | strncpy((char *)buffer, (const char *)flag, 64); 202 | 203 | simpleMD5Transform(state, buffer); 204 | 205 | memset(storedBytes, 0, 256); 206 | 207 | for (i = 0; i < 16; i++) { 208 | storedBytes[i] = (state[i / 4] >> ((i % 4) * 8)) & 0xFF; 209 | } 210 | for (i = 0; i < 16; i++) { 211 | sprintf(&hashString[i * 2], "%02x", storedBytes[i]); 212 | } 213 | hashString[32] = '\0'; 214 | // LOGI("Hash string of 'fridaCHeck2': %s", hashString); 215 | } 216 | 217 | 218 | 219 | //53cd3f37664bd01357182ca13bc2f9b6 220 | // Hash string of 'fridaCHeck2': f5d02d7eede3a75ee6e6cc0a9673c76f 221 | // Hash string of 'fridaCHeck3': a8490cd255d3a0a982fac16130183b76 222 | extern "C" 223 | JNIEXPORT jobject JNICALL 224 | Java_com_swdd_summertrain_MainActivity_Check(JNIEnv *env, jobject thiz, jstring input) { 225 | sleep(1); 226 | const char* str = env->GetStringUTFChars(input, nullptr); 227 | bool isEqual = (strcmp(str,hashString) == 0 ); 228 | 229 | jclass booleanClass = env->FindClass("java/lang/Boolean"); 230 | jmethodID booleanConstructor = env->GetMethodID(booleanClass, "", "(Z)V"); 231 | jobject result = env->NewObject(booleanClass, booleanConstructor, isEqual); 232 | env->ReleaseStringUTFChars(input, str); 233 | return result; 234 | } 235 | -------------------------------------------------------------------------------- /antiFrida/findPort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define LOG_TAG "GenFunction" 10 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 11 | #define S11 7 12 | #define S12 12 13 | #define S13 17 14 | #define S14 22 15 | #define S21 5 16 | #define S22 9 17 | #define S23 14 18 | #define S24 20 19 | #define S31 4 20 | #define S32 11 21 | #define S33 16 22 | #define S34 23 23 | #define S41 6 24 | #define S42 10 25 | #define S43 15 26 | #define S44 21 27 | 28 | #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) 29 | 30 | #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) 31 | #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) 32 | #define H(x, y, z) ((x) ^ (y) ^ (z)) 33 | #define I(x, y, z) ((y) ^ ((x) | (~z))) 34 | 35 | #define FF(a, b, c, d, x, s, ac) { \ 36 | (a) += F ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 37 | (a) = ROTATE_LEFT ((a), (s)); \ 38 | (a) += (b); \ 39 | } 40 | #define GG(a, b, c, d, x, s, ac) { \ 41 | (a) += G ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 42 | (a) = ROTATE_LEFT ((a), (s)); \ 43 | (a) += (b); \ 44 | } 45 | #define HH(a, b, c, d, x, s, ac) { \ 46 | (a) += H ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 47 | (a) = ROTATE_LEFT ((a), (s)); \ 48 | (a) += (b); \ 49 | } 50 | #define II(a, b, c, d, x, s, ac) { \ 51 | (a) += I ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 52 | (a) = ROTATE_LEFT ((a), (s)); \ 53 | (a) += (b); \ 54 | } 55 | 56 | static void simpleMD5Transform(unsigned int state[4], const unsigned char block[64]) { 57 | unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16]; 58 | int i; 59 | 60 | for (i = 0; i < 16; i++) { 61 | x[i] = ((unsigned int)block[i * 4]) | (((unsigned int)block[i * 4 + 1]) << 8) | 62 | (((unsigned int)block[i * 4 + 2]) << 16) | (((unsigned int)block[i * 4 + 3]) << 24); 63 | } 64 | 65 | FF(a, b, c, d, x[ 0], S11, 0xd76aa478); 66 | FF(d, a, b, c, x[ 1], S12, 0xe8c7b756); 67 | FF(c, d, a, b, x[ 2], S13, 0x242070db); 68 | FF(b, c, d, a, x[ 3], S14, 0xc1bdceee); 69 | FF(a, b, c, d, x[ 4], S11, 0xf57c0faf); 70 | FF(d, a, b, c, x[ 5], S12, 0x4787c62a); 71 | FF(c, d, a, b, x[ 6], S13, 0xa8304613); 72 | FF(b, c, d, a, x[ 7], S14, 0xfd469501); 73 | FF(a, b, c, d, x[ 8], S11, 0x698098d8); 74 | FF(d, a, b, c, x[ 9], S12, 0x8b44f7af); 75 | FF(c, d, a, b, x[10], S13, 0xffff5bb1); 76 | FF(b, c, d, a, x[11], S14, 0x895cd7be); 77 | FF(a, b, c, d, x[12], S11, 0x6b901122); 78 | FF(d, a, b, c, x[13], S12, 0xfd987193); 79 | FF(c, d, a, b, x[14], S13, 0xa679438e); 80 | FF(b, c, d, a, x[15], S14, 0x49b40821); 81 | 82 | GG(a, b, c, d, x[ 1], S21, 0xf61e2562); 83 | GG(d, a, b, c, x[ 6], S22, 0xc040b340); 84 | GG(c, d, a, b, x[11], S23, 0x265e5a51); 85 | GG(b, c, d, a, x[ 0], S24, 0xe9b6c7aa); 86 | GG(a, b, c, d, x[ 5], S21, 0xd62f105d); 87 | GG(d, a, b, c, x[10], S22, 0x2441453); 88 | GG(c, d, a, b, x[15], S23, 0xeeeeeeee); 89 | GG(b, c, d, a, x[ 4], S24, 0xe7d3fbc8); 90 | GG(a, b, c, d, x[ 9], S21, 0x21e1cde6); 91 | GG(d, a, b, c, x[14], S22, 0xc33707d6); 92 | GG(c, d, a, b, x[ 3], S23, 0xf4d50d87); 93 | GG(b, c, d, a, x[ 8], S24, 0x455a14ed); 94 | GG(a, b, c, d, x[13], S21, 0xa9e3e905); 95 | GG(d, a, b, c, x[ 2], S22, 0xfcefa3f8); 96 | GG(c, d, a, b, x[ 7], S23, 0x676f02d9); 97 | GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); 98 | 99 | HH(a, b, c, d, x[ 5], S31, 0xfffa3942); 100 | HH(d, a, b, c, x[ 8], S32, 0x8771f681); 101 | HH(c, d, a, b, x[11], S33, 0x6d9d6122); 102 | HH(b, c, d, a, x[14], S34, 0xfde5380c); 103 | HH(a, b, c, d, x[ 1], S31, 0xa4beea44); 104 | HH(d, a, b, c, x[ 4], S32, 0x4bdecfa9); 105 | HH(c, d, a, b, x[ 7], S33, 0xf6bb4b60); 106 | HH(b, c, d, a, x[10], S34, 0xbebfbc70); 107 | HH(a, b, c, d, x[13], S31, 0x289b7ec6); 108 | HH(d, a, b, c, x[ 0], S32, 0xeaa127fa); 109 | HH(c, d, a, b, x[ 3], S33, 0xd4ef3085); 110 | HH(b, c, d, a, x[ 6], S34, 0x4881d05); 111 | HH(a, b, c, d, x[ 9], S31, 0xd9d4d039); 112 | HH(d, a, b, c, x[12], S32, 0xe6db99e5); 113 | HH(c, d, a, b, x[15], S33, 0x1fa27cf8); 114 | HH(b, c, d, a, x[ 2], S34, 0xc4ac5665); 115 | 116 | II(a, b, c, d, x[ 0], S41, 0xf4292244); 117 | II(d, a, b, c, x[ 7], S42, 0x432aff97); 118 | II(c, d, a, b, x[14], S43, 0xab9423a7); 119 | II(b, c, d, a, x[ 5], S44, 0xfc93a039); 120 | II(a, b, c, d, x[12], S41, 0x655b59c3); 121 | II(d, a, b, c, x[ 3], S42, 0x8f0ccc92); 122 | II(c, d, a, b, x[10], S43, 0xffeff47d); 123 | II(b, c, d, a, x[ 1], S44, 0x85845dd1); 124 | II(a, b, c, d, x[ 8], S41, 0x6fa87e4f); 125 | II(d, a, b, c, x[15], S42, 0xfe2ce6e0); 126 | II(c, d, a, b, x[ 6], S43, 0xa3014314); 127 | II(b, c, d, a, x[13], S44, 0x4e0811a1); 128 | II(a, b, c, d, x[ 4], S41, 0xf7537e82); 129 | II(d, a, b, c, x[11], S42, 0xbd3af235); 130 | II(c, d, a, b, x[ 2], S43, 0x2ad7d2bb); 131 | II(b, c, d, a, x[ 9], S44, 0xaaaaaaaa); 132 | 133 | state[0] += a; 134 | state[1] += b; 135 | state[2] += c; 136 | state[3] += d; 137 | } 138 | 139 | void* check_ports(void* arg) { 140 | /* */ 141 | while (1) { 142 | struct sockaddr_in sa{}; 143 | sa.sin_family = AF_INET; 144 | auto port = 27042; 145 | sa.sin_port = htons(port = 27042); 146 | inet_aton("127.0.0.1", &sa.sin_addr); 147 | int sock = socket(AF_INET, SOCK_STREAM, 0); 148 | if (connect(sock, (struct sockaddr *) &sa, sizeof(sa)) == 0) { 149 | LOGI("Find! Frida"); 150 | close(sock); 151 | exit(0); 152 | } 153 | 154 | 155 | auto prot2 = 23946; 156 | sa.sin_port = htons(port = 23946); 157 | inet_aton("127.0.0.1", &sa.sin_addr); 158 | int sock2 = socket(AF_INET, SOCK_STREAM, 0); 159 | if (connect(sock2, (struct sockaddr *) &sa, sizeof(sa)) == 0) { 160 | LOGI("Find! IDA"); 161 | close(sock); 162 | exit(0); 163 | } 164 | sleep(0.1); 165 | } 166 | } 167 | 168 | unsigned char storedBytes[256] = {0}; 169 | char hashString[33]; 170 | 171 | static void Gen() __attribute__((constructor)); 172 | static void Gen() { 173 | pthread_t tid; 174 | LOGI("GO!"); 175 | if (pthread_create(&tid, NULL, check_ports, NULL) != 0) { 176 | perror("Failed to create thread"); 177 | exit(EXIT_FAILURE); 178 | } 179 | unsigned char flag[256] = "fridaCHeck1"; 180 | unsigned int state[4] = {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476}; 181 | unsigned char buffer[64] = {0}; 182 | int i; 183 | 184 | strncpy((char *)buffer, (const char *)flag, 64); 185 | 186 | simpleMD5Transform(state, buffer); 187 | 188 | memset(storedBytes, 0, 256); 189 | 190 | for (i = 0; i < 16; i++) { 191 | storedBytes[i] = (state[i / 4] >> ((i % 4) * 8)) & 0xFF; 192 | } 193 | for (i = 0; i < 16; i++) { 194 | sprintf(&hashString[i * 2], "%02x", storedBytes[i]); 195 | } 196 | hashString[32] = '\0'; 197 | //LOGI("Hash string of 'fridaCHeck1': %s", hashString); 198 | } 199 | //53cd3f37664bd01357182ca13bc2f9b6 200 | extern "C" 201 | JNIEXPORT jobject JNICALL 202 | Java_com_swdd_summertrain_MainActivity_Check(JNIEnv *env, jobject thiz, jstring input) { 203 | const char* str = env->GetStringUTFChars(input, nullptr); 204 | bool isEqual = (strcmp(str,hashString) == 0 ); 205 | 206 | jclass booleanClass = env->FindClass("java/lang/Boolean"); 207 | jmethodID booleanConstructor = env->GetMethodID(booleanClass, "", "(Z)V"); 208 | jobject result = env->NewObject(booleanClass, booleanConstructor, isEqual); 209 | env->ReleaseStringUTFChars(input, str); 210 | return result; 211 | } 212 | -------------------------------------------------------------------------------- /antiFrida/findmaps.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define LOG_TAG "GenFunction" 11 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 12 | #define S11 7 13 | #define S12 12 14 | #define S13 17 15 | #define S14 22 16 | #define S21 5 17 | #define S22 9 18 | #define S23 14 19 | #define S24 20 20 | #define S31 4 21 | #define S32 11 22 | #define S33 16 23 | #define S34 23 24 | #define S41 6 25 | #define S42 10 26 | #define S43 15 27 | #define S44 21 28 | 29 | #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) 30 | 31 | #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) 32 | #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) 33 | #define H(x, y, z) ((x) ^ (y) ^ (z)) 34 | #define I(x, y, z) ((y) ^ ((x) | (~z))) 35 | 36 | #define FF(a, b, c, d, x, s, ac) { \ 37 | (a) += F ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 38 | (a) = ROTATE_LEFT ((a), (s)); \ 39 | (a) += (b); \ 40 | } 41 | #define GG(a, b, c, d, x, s, ac) { \ 42 | (a) += G ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 43 | (a) = ROTATE_LEFT ((a), (s)); \ 44 | (a) += (b); \ 45 | } 46 | #define HH(a, b, c, d, x, s, ac) { \ 47 | (a) += H ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 48 | (a) = ROTATE_LEFT ((a), (s)); \ 49 | (a) += (b); \ 50 | } 51 | #define II(a, b, c, d, x, s, ac) { \ 52 | (a) += I ((b), (c), (d)) + (x) + (unsigned int)(ac); \ 53 | (a) = ROTATE_LEFT ((a), (s)); \ 54 | (a) += (b); \ 55 | } 56 | 57 | static void simpleMD5Transform(unsigned int state[4], const unsigned char block[64]) { 58 | unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16]; 59 | int i; 60 | 61 | for (i = 0; i < 16; i++) { 62 | x[i] = ((unsigned int)block[i * 4]) | (((unsigned int)block[i * 4 + 1]) << 8) | 63 | (((unsigned int)block[i * 4 + 2]) << 16) | (((unsigned int)block[i * 4 + 3]) << 24); 64 | } 65 | 66 | FF(a, b, c, d, x[ 0], S11, 0xd76aa478); 67 | FF(d, a, b, c, x[ 1], S12, 0xe8c7b756); 68 | FF(c, d, a, b, x[ 2], S13, 0x242070db); 69 | FF(b, c, d, a, x[ 3], S14, 0xc1bdceee); 70 | FF(a, b, c, d, x[ 4], S11, 0xf57c0faf); 71 | FF(d, a, b, c, x[ 5], S12, 0x4787c62a); 72 | FF(c, d, a, b, x[ 6], S13, 0xa8304613); 73 | FF(b, c, d, a, x[ 7], S14, 0xfd469501); 74 | FF(a, b, c, d, x[ 8], S11, 0x698098d8); 75 | FF(d, a, b, c, x[ 9], S12, 0x8b44f7af); 76 | FF(c, d, a, b, x[10], S13, 0xffff5bb1); 77 | FF(b, c, d, a, x[11], S14, 0x895cd7be); 78 | FF(a, b, c, d, x[12], S11, 0x6b901122); 79 | FF(d, a, b, c, x[13], S12, 0xfd987193); 80 | FF(c, d, a, b, x[14], S13, 0xa679438e); 81 | FF(b, c, d, a, x[15], S14, 0x49b40821); 82 | 83 | GG(a, b, c, d, x[ 1], S21, 0xf61e2562); 84 | GG(d, a, b, c, x[ 6], S22, 0xc040b340); 85 | GG(c, d, a, b, x[11], S23, 0x265e5a51); 86 | GG(b, c, d, a, x[ 0], S24, 0xe9b6c7aa); 87 | GG(a, b, c, d, x[ 5], S21, 0xd62f105d); 88 | GG(d, a, b, c, x[10], S22, 0x2441453); 89 | GG(c, d, a, b, x[15], S23, 0xeeeeeeee); 90 | GG(b, c, d, a, x[ 4], S24, 0xe7d3fbc8); 91 | GG(a, b, c, d, x[ 9], S21, 0x21e1cde6); 92 | GG(d, a, b, c, x[14], S22, 0xc33707d6); 93 | GG(c, d, a, b, x[ 3], S23, 0xf4d50d87); 94 | GG(b, c, d, a, x[ 8], S24, 0x455a14ed); 95 | GG(a, b, c, d, x[13], S21, 0xa9e3e905); 96 | GG(d, a, b, c, x[ 2], S22, 0xfcefa3f8); 97 | GG(c, d, a, b, x[ 7], S23, 0x676f02d9); 98 | GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); 99 | 100 | HH(a, b, c, d, x[ 5], S31, 0xfffa3942); 101 | HH(d, a, b, c, x[ 8], S32, 0x8771f681); 102 | HH(c, d, a, b, x[11], S33, 0x6d9d6122); 103 | HH(b, c, d, a, x[14], S34, 0xfde5380c); 104 | HH(a, b, c, d, x[ 1], S31, 0xa4beea44); 105 | HH(d, a, b, c, x[ 4], S32, 0x4bdecfa9); 106 | HH(c, d, a, b, x[ 7], S33, 0xf6bb4b60); 107 | HH(b, c, d, a, x[10], S34, 0xbebfbc70); 108 | HH(a, b, c, d, x[13], S31, 0x289b7ec6); 109 | HH(d, a, b, c, x[ 0], S32, 0xeaa127fa); 110 | HH(c, d, a, b, x[ 3], S33, 0xd4ef3085); 111 | HH(b, c, d, a, x[ 6], S34, 0x4881d05); 112 | HH(a, b, c, d, x[ 9], S31, 0xd9d4d039); 113 | HH(d, a, b, c, x[12], S32, 0xe6db99e5); 114 | HH(c, d, a, b, x[15], S33, 0x1fa27cf8); 115 | HH(b, c, d, a, x[ 2], S34, 0xc4ac5665); 116 | 117 | II(a, b, c, d, x[ 0], S41, 0xf4292244); 118 | II(d, a, b, c, x[ 7], S42, 0x432aff97); 119 | II(c, d, a, b, x[14], S43, 0xab9423a7); 120 | II(b, c, d, a, x[ 5], S44, 0xfc93a039); 121 | II(a, b, c, d, x[12], S41, 0x655b59c3); 122 | II(d, a, b, c, x[ 3], S42, 0x8f0ccc92); 123 | II(c, d, a, b, x[10], S43, 0xffeff47d); 124 | II(b, c, d, a, x[ 1], S44, 0x85845dd1); 125 | II(a, b, c, d, x[ 8], S41, 0x6fa87e4f); 126 | II(d, a, b, c, x[15], S42, 0xfe2ce6e0); 127 | II(c, d, a, b, x[ 6], S43, 0xa3014314); 128 | II(b, c, d, a, x[13], S44, 0x4e0811a1); 129 | II(a, b, c, d, x[ 4], S41, 0xf7537e82); 130 | II(d, a, b, c, x[11], S42, 0xbd3af235); 131 | II(c, d, a, b, x[ 2], S43, 0x2ad7d2bb); 132 | II(b, c, d, a, x[ 9], S44, 0xaaaaaaaa); 133 | 134 | state[0] += a; 135 | state[1] += b; 136 | state[2] += c; 137 | state[3] += d; 138 | } 139 | 140 | int is_hash_match(const char *line) { 141 | regex_t regex; 142 | const char *pattern = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"; 143 | regcomp(®ex, pattern, REG_EXTENDED); 144 | int result = regexec(®ex, line, 0, NULL, 0); 145 | if(result == 0 && strstr(line,".so")){ 146 | //LOGI("Hash : %s " , line); 147 | return 1; 148 | } 149 | regfree(®ex); 150 | return 0; 151 | } 152 | 153 | char checkList[][512]{ 154 | "frida", 155 | "gadget", 156 | "agent", 157 | "/data/local/tmp/",0 158 | }; 159 | 160 | bool check_maps() { 161 | char line[512]; 162 | bool flag = false; 163 | FILE* fp = fopen("/proc/self/maps", "r"); 164 | if (fp) { 165 | while (fgets(line, sizeof(line), fp)) { 166 | //LOGI("%s",line); 167 | if(is_hash_match(line)){ 168 | LOGI("Findeeddddd!"); 169 | flag = true; 170 | } 171 | for(int i = 0 ; checkList[i][0] != 0 ; i ++ ){ 172 | if (strstr(line,checkList[i])){ 173 | //LOGI("Find:%s",checkList[i]); 174 | flag = true; 175 | } 176 | } 177 | } 178 | fclose(fp); 179 | } 180 | return flag; 181 | } 182 | 183 | 184 | void* check(void* arg) { 185 | char checkList2[][512]{ 186 | "frida", 187 | "gadget", 188 | "agent", 189 | "/data/local/tmp/", 190 | "-64.so", 191 | "-32.so", 192 | 0 193 | }; 194 | 195 | /* if(check_maps()){ 196 | LOGI("Find! Frida2"); 197 | }*/ 198 | while (1) { 199 | //检测frida端口 200 | struct sockaddr_in sa{}; 201 | sa.sin_family = AF_INET; 202 | auto port = 27042; 203 | sa.sin_port = htons(port = 27042); 204 | inet_aton("127.0.0.1", &sa.sin_addr); 205 | int sock = socket(AF_INET, SOCK_STREAM, 0); 206 | if (connect(sock, (struct sockaddr *) &sa, sizeof(sa)) == 0) { 207 | // LOGI("Find! Frida"); 208 | close(sock); 209 | exit(0); 210 | } 211 | 212 | // Anti IDA 213 | auto prot2 = 23946; 214 | sa.sin_port = htons(port = 23946); 215 | inet_aton("127.0.0.1", &sa.sin_addr); 216 | int sock2 = socket(AF_INET, SOCK_STREAM, 0); 217 | if (connect(sock2, (struct sockaddr *) &sa, sizeof(sa)) == 0) { 218 | close(sock); 219 | exit(0); 220 | } 221 | 222 | //检测maps 223 | char line[512]; 224 | FILE* fp = fopen("/proc/self/maps", "r"); 225 | if (fp) { 226 | while (fgets(line, sizeof(line), fp)) { 227 | for(int i = 0 ; checkList2[i][0] != 0 ; i ++ ){ 228 | if (strstr(line,checkList2[i])){ 229 | exit(0); 230 | } 231 | } 232 | } 233 | fclose(fp); 234 | } 235 | sleep(1); 236 | } 237 | } 238 | 239 | unsigned char storedBytes[256] = {0}; 240 | char hashString[33]; 241 | 242 | static void Gen() __attribute__((constructor)); 243 | static void Gen() { 244 | check_maps(); 245 | pthread_t tid; 246 | LOGI("GO!"); 247 | if (pthread_create(&tid, NULL, check, NULL) != 0) { 248 | perror("Failed to create thread"); 249 | exit(EXIT_FAILURE); 250 | } 251 | unsigned char flag[256] = "fridaCHeck2"; 252 | unsigned int state[4] = {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476}; 253 | unsigned char buffer[64] = {0}; 254 | int i; 255 | 256 | strncpy((char *)buffer, (const char *)flag, 64); 257 | 258 | simpleMD5Transform(state, buffer); 259 | 260 | memset(storedBytes, 0, 256); 261 | 262 | for (i = 0; i < 16; i++) { 263 | storedBytes[i] = (state[i / 4] >> ((i % 4) * 8)) & 0xFF; 264 | } 265 | for (i = 0; i < 16; i++) { 266 | sprintf(&hashString[i * 2], "%02x", storedBytes[i]); 267 | } 268 | hashString[32] = '\0'; 269 | //LOGI("Hash string of 'fridaCHeck2': %s", hashString); 270 | } 271 | 272 | //53cd3f37664bd01357182ca13bc2f9b6 273 | // Hash string of 'fridaCHeck2': f5d02d7eede3a75ee6e6cc0a9673c76f 274 | extern "C" 275 | JNIEXPORT jobject JNICALL 276 | Java_com_swdd_summertrain_MainActivity_Check(JNIEnv *env, jobject thiz, jstring input) { 277 | if(check_maps()){ 278 | exit(0); 279 | } 280 | sleep(1); 281 | const char* str = env->GetStringUTFChars(input, nullptr); 282 | bool isEqual = (strcmp(str,hashString) == 0 ); 283 | 284 | jclass booleanClass = env->FindClass("java/lang/Boolean"); 285 | jmethodID booleanConstructor = env->GetMethodID(booleanClass, "", "(Z)V"); 286 | jobject result = env->NewObject(booleanClass, booleanConstructor, isEqual); 287 | env->ReleaseStringUTFChars(input, str); 288 | return result; 289 | } 290 | --------------------------------------------------------------------------------