### Install and start test_winkernel driver Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_MSVC.TXT Commands to install and start the test driver 'test_winkernel.sys' using the 'sc' command. The output shows a failure with error 995, which is expected. ```batch >sc create test_winkernel type= kernel binPath= [SC] CreateService SUCCESS ``` ```batch >sc start test_winkernel [SC] StartService FAILED 995: The I/O operation has been aborted because of either a thread exit or an application request. ``` -------------------------------- ### Install Capstone via vcpkg Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_MSVC.TXT Clone vcpkg, bootstrap it, integrate with Visual Studio, and install the capstone port. Requires a shell with git and build tools. ```shell git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install vcpkg install capstone ``` -------------------------------- ### Install Capstone on Unix-like systems Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Install Capstone using sudo ./make.sh install. On FreeBSD/OpenBSD where sudo is unavailable, use su and then ./make.sh install. Requires root password to copy files to system directories. ```bash $ sudo ./make.sh install ``` ```bash $ su; ./make.sh install ``` -------------------------------- ### Create installation image: cmake --build . --config Release --target install Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_CMAKE.TXT Builds and installs Capstone using the 'install' target. The default install location is often C:\Program Files on Windows, so set -DCMAKE_INSTALL_PREFIX=image to install into the build directory's 'image' subdirectory. ```shell cmake --build . --config Release --target install ``` -------------------------------- ### Run Executable and Install Su Functions Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html These functions handle running a Linux executable and installing su. They use the postText helper to communicate with backend endpoints '/runExecProc' and '/installSu'. The installSu function copies the su path to clipboard and alerts on success. ```javascript prompt("请输入Linux可执行程序的文件位置:", g_lastRootExecPath); if(!path || !path.length) return; g_lastRootExecPath = path; const resp = await postText('/runExecProc', JSON.stringify({ path: path }) ); if (resp.ok) { const data = await resp.json() appendConsole(data.content); } else alert('发送数据时发生错误'); } async function installSuBtnClick() { const resp = await postText('/installSu'); if (resp.ok) { const data = await resp.json() appendConsole(data.content); if(data.ok === '1') { g_lastSuFullPath = data.su_hide_full_path; copyToClipboard(data.su_hide_full_path); alert("安装部署su成功,su路径已复制到剪贴板。"); } } else alert('发送数据时发生错误'); } ``` -------------------------------- ### Build and install cstool executable Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Builds the cstool executable from all .c files in the cstool directory when CAPSTONE_BUILD_CSTOOL is enabled. Links against the capstone library and optionally installs the binary to the bindir. ```cmake if(CAPSTONE_BUILD_CSTOOL) file(GLOB CSTOOL_SRC cstool/*.c) add_executable(cstool ${CSTOOL_SRC}) target_link_libraries(cstool PRIVATE capstone) if(CAPSTONE_INSTALL) install(TARGETS cstool EXPORT capstone-targets DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() endif() ``` -------------------------------- ### Install Capstone libraries and CMake package config Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Installs Capstone headers, pkg-config file, CMake package config, and library targets when CAPSTONE_INSTALL is enabled. Handles absolute vs relative install directories, exports targets with the capstone:: namespace, and creates an UNINSTALL custom target if not already defined. ```cmake if(CAPSTONE_INSTALL) include(GNUInstallDirs) install(FILES ${HEADERS_COMMON} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/capstone) # Support absolute installation paths (discussion: https://github.com/NixOS/nixpkgs/issues/144170) if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR}) set(CAPSTONE_PKGCONFIG_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}) set(CAPSTONE_CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}) else() set(CAPSTONE_PKGCONFIG_INSTALL_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") set(CAPSTONE_CMAKE_INSTALL_LIBDIR "\${PACKAGE_PREFIX_DIR}/${CMAKE_INSTALL_LIBDIR}") endif() if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR}) set(CAPSTONE_PKGCONFIG_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}) set(CAPSTONE_CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}) else() set(CAPSTONE_PKGCONFIG_INSTALL_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") set(CAPSTONE_CMAKE_INSTALL_INCLUDEDIR "\${PACKAGE_PREFIX_DIR}/${CMAKE_INSTALL_INCLUDEDIR}") endif() configure_file(capstone.pc.in ${CMAKE_BINARY_DIR}/capstone.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/capstone.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) include(CMakePackageConfigHelpers) set(CAPSTONE_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/capstone") configure_package_config_file( capstone-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/capstone-config.cmake INSTALL_DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR} ) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/capstone-config-version.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capstone-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/capstone-config-version.cmake" DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR} ) if(BUILD_SHARED_LIBS) set(LIB_INSTALL_TARGETS capstone_shared) endif() if (BUILD_STATIC_LIBS) set(LIB_INSTALL_TARGETS ${LIB_INSTALL_TARGETS} capstone_static) endif() install(TARGETS ${LIB_INSTALL_TARGETS} EXPORT capstone-targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(EXPORT capstone-targets NAMESPACE capstone:: DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR} ) # uninstall target if(NOT TARGET UNINSTALL) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY ) set(CMAKE_FOLDER) add_custom_target(UNINSTALL COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) set_target_properties(UNINSTALL PROPERTIES FOLDER CMakePredefinedTargets ) endif() endif() ``` -------------------------------- ### Customize Capstone build with command-line options Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Pass build options to ./make.sh to select architectures and enable features without editing config.mk. Options must be placed before ./make.sh. This example selects ARM, AArch64, and x86 architectures, disables system dynamic memory, and enables DIET and X86_REDUCE modes. ```bash $ CAPSTONE_ARCHS="arm aarch64 x86" CAPSTONE_USE_SYS_DYN_MEM=no CAPSTONE_DIET=yes CAPSTONE_X86_REDUCE=yes ./make.sh ``` -------------------------------- ### Test Capstone with cstool x32 Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/HACK.TXT Test Capstone with cstool after installation. The example disassembles the bytes 90 91 in x86 32-bit mode. Replace x32 and the hex string with your target architecture and bytes. ```bash $ cstool x32 "90 91" ``` -------------------------------- ### Enable test signing mode for x64 driver testing Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_MSVC.TXT Run this command in an administrator command prompt to enable test signing mode on x64 platforms, required to install the test driver. Restart the system after executing. ```batch >bcdedit /set testsigning on ``` -------------------------------- ### Clean and recompile Capstone with make.sh Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/HACK.TXT Clean and recompile Capstone from the source root. The first command builds the project, and the second installs it system-wide with sudo. Run these before testing if you encounter strange bugs. ```bash $ ./make.sh $ sudo ./make.sh install ``` -------------------------------- ### Build and install cstest executable with cmocka Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Builds the cstest test executable when CAPSTONE_BUILD_CSTEST is enabled. Requires the cmocka library via pkg-config, links against capstone and PkgConfig::CMOCKA, and optionally installs the binary. ```cmake if(CAPSTONE_BUILD_CSTEST) find_package(PkgConfig REQUIRED) pkg_check_modules(CMOCKA REQUIRED IMPORTED_TARGET cmocka) file(GLOB CSTEST_SRC suite/cstest/src/*.c) add_executable(cstest ${CSTEST_SRC}) target_link_libraries(cstest PUBLIC capstone PkgConfig::CMOCKA) target_include_directories(cstest PRIVATE $ ${PROJECT_SOURCE_DIR}/suite/cstest/include ${CMOCKA_INCLUDE_DIRS} ) if(CAPSTONE_INSTALL) install(TARGETS cstest EXPORT capstone-targets DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() endif() ``` -------------------------------- ### Get App List from Backend Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html This function fetches the app list from '/getAppList' with filter options. It shows a loading spinner, processes the response, decodes base64 labels, and handles errors by appending a console message. ```javascript async function getAppList() { var showSystemAppsCheckbox = document.getElementById('showSystemApps'); var showThirdPartyAppsCheckbox = document.getElementById('showThirdPartyApps'); var showRunningAppsCheckbox = document.getElementById('showRunningApps'); // 先显示加载中转圈,等数据回来后再渲染列表 var listItems = document.getElementById('listAppItems'); cleanAppListModal(); var loadingDiv = document.createElement('div'); loadingDiv.className = 'list-loading'; loadingDiv.innerHTML = '
加载中...'; listItems.appendChild(loadingDiv); let jsonData = { showSystemApp: showSystemAppsCheckbox.checked ? 1 : 0, showThirdApp: showThirdPartyAppsCheckbox.checked ? 1 : 0, showRunningApp: showRunningAppsCheckbox.checked ? 1 : 0, }; let appList = []; try { const resp = await postText('/getAppList', JSON.stringify(jsonData)); if (resp.ok) { const data = await resp.json(); if (data && data.content && data.content.length) { appList = data.content.map(function(item) { if (typeof item === 'string') return { appName: item, packageName: item }; const packageName = item.packageName || ''; return { appName: decodeBase64Utf8(item.labelBase64) || packageName, packageName: packageName }; }); } } } catch (e) { appendConsole('获取应用列表失败: ' + e); } // 先清理旧列表,紧接着渲染新列表,避免闪烁 ``` -------------------------------- ### Build with Nmake Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_CMAKE.TXT Create a build directory, enter it, and run ..\nmake.bat to build Capstone using Nmake from Windows SDK. Outputs test*.exe, capstone.lib, and capstone.dll in the same directory. ```shell mkdir build cd build ..\nmake.bat ``` -------------------------------- ### Compile Capstone for current platform Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Run ./make.sh to compile Capstone natively on Unix-like systems (MacOSX, Linux, *BSD, Solaris). ```bash $ ./make.sh ``` -------------------------------- ### Choose compiler with ./make.sh clang or gcc Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Select the compiler to use. By default, 'cc' is used; run './make.sh clang' to use clang or './make.sh gcc' to use gcc. ```shell $ ./make.sh clang ``` ```shell $ ./make.sh gcc ``` -------------------------------- ### Build with Visual Studio generator Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_CMAKE.TXT Create a build directory, enter it, and run cmake -G "Visual Studio 12" .. to generate a Visual Studio solution. Open capstone.sln and build the solution including libraries and tests. ```shell mkdir build cd build cmake -G "Visual Studio 12" .. ``` -------------------------------- ### Cross-compile Capstone for 32-bit on 64-bit OS Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Use ./make.sh nix32 to cross-compile a 32-bit binary on a 64-bit Unix-like system. ```bash $ ./make.sh nix32 ``` -------------------------------- ### runRootCmdBtnClick function Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Prompts for a root command, sends it to '/runRootCmd', and appends the response content to console. ```javascript async function runRootCmdBtnClick() { var shell = prompt("请输入ROOT命令:", g_lastInputCmd); if(!shell || !shell.length) return; g_lastInputCmd = shell; const resp = await postText('/runRootCmd', JSON.stringify({ cmd: shell }) ); if (resp.ok) { const data = await resp.json() appendConsole(data.content); } else alert('发送数据时发生错误'); } ``` -------------------------------- ### rootExecProcBtnClick function (partial) Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Incomplete function for executing a process as root; the source is truncated. ```javascript async function rootExecProcBtnClick() { var path = ``` -------------------------------- ### testRootBtnClick function Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Sends a POST to '/testRoot' and appends the response content to console, alerting on error. ```javascript async function testRootBtnClick() { const resp = await postText('/testRoot'); if (resp.ok) { const data = await resp.json() appendConsole(data.content); } else alert('发送数据时发生错误'); } ``` -------------------------------- ### Cross-compile Capstone for Windows 64-bit Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Cross-compile a Windows 64-bit binary using ./make.sh cross-win64. Requires Linux and gcc-mingw-w64-x86-64. ```bash $ ./make.sh cross-win64 ``` -------------------------------- ### JavaScript HTTP management functions for demo module Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Pro(众测开放中)/src/testModule/module_web_ui_example/webroot/index.html Defines postText, getProcessInfo, getValue, setValue, and onReady functions. postText sends a POST request to a given path with optional body text. getProcessInfo fetches /getPid and /getUid and displays them. getValue fetches /getValue and displays the result. setValue posts to /setValue and alerts success or failure based on the response. onReady initializes the page by calling getProcessInfo and getValue, and attaches a click handler to the save button. ```JavaScript function postText(path, bodyText = "") { const url = new URL(path, window.location.href); return fetch(url, { method: 'POST', body: bodyText }); } async function getProcessInfo() { const resp1 = await postText('/getPid'); const resp2 = await postText('/getUid'); const pid = await resp1.text(); const uid = await resp2.text(); document.getElementById('process').textContent = "当前进程 PID:" + pid + ", UID:" + uid; } async function getValue() { const resp = await postText('/getValue'); const text = await resp.text(); document.getElementById('last').textContent = "测试读取上次的值:" + text; } async function setValue(text) { const resp = await postText('/setValue', text); if (!resp.ok) throw new Error('HTTP ' + resp.status); const result = await resp.text(); alert(result.trim() === 'OK' ? '保存成功,请刷新网页' : ('保存失败:' + result)); } function onReady() { getProcessInfo(); getValue(); document.getElementById('save').addEventListener('click', () => { setValue(document.getElementById('val').value); }); } document.addEventListener('DOMContentLoaded', onReady); ``` -------------------------------- ### Cross-compile Capstone for Windows 32-bit Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Cross-compile a Windows 32-bit binary using ./make.sh cross-win32. Requires Linux and gcc-mingw-w64-i686. ```bash $ ./make.sh cross-win32 ``` -------------------------------- ### Build with CMake default generator Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_CMAKE.TXT Create a build directory, configure with CMake, and build. Pass additional flags like -DCMAKE_BUILD_TYPE=Debug or -DCMAKE_EXPORT_COMPILE_COMMANDS=ON during the cmake .. step. ```shell mkdir build cd build cmake .. ``` ```shell cmake --build . --config [Release/Debug] ``` -------------------------------- ### Add App List Modal Item Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html This function creates a list item for the app list modal. It sets up the item with app name, package name, and an initial letter icon. Clicking the item either shows the file list modal (for su forever inject) or injects su into the app. ```javascript function addAppListModalItem(appInfo, isSuForeverInject) { var listItems = document.getElementById('listAppItems'); const appName = appInfo.appName || appInfo.packageName; const packageName = appInfo.packageName; const initial = appName ? appName.charAt(0).toUpperCase() : '?'; var div = document.createElement('div'); div.className = 'list-item'; div.setAttribute('data-search', appName + ' ' + packageName); div.setAttribute('data-package', packageName); var icon = document.createElement('div'); icon.className = 'list-item-icon'; icon.textContent = initial; var text = document.createElement('div'); text.className = 'list-item-text'; var nameSpan = document.createElement('span'); nameSpan.className = 'list-item-name'; nameSpan.textContent = appName; var pkgSpan = document.createElement('span'); pkgSpan.className = 'list-item-pkg'; pkgSpan.textContent = packageName; text.appendChild(nameSpan); text.appendChild(pkgSpan); div.appendChild(icon); div.appendChild(text); div.onclick = function(event) { hideAppListModal(); if(isSuForeverInject) { showFileListModal(); getPrecheckAppFileList(packageName); } else { injectSuInTempApp(packageName); } } listItems.appendChild(div); } ``` -------------------------------- ### Build for a single architecture: ../cmake.sh x86 Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_CMAKE.TXT Pass the architecture name to cmake.sh to build only that architecture. Available architectures include ARM, ARM64, M68K, MIPS, PowerPC, Sparc, SystemZ, XCore, x86, TMS320C64x, M680x, EVM, MOS65XX, WASM, BPF, and RISCV. ```shell ../cmake.sh x86 ``` -------------------------------- ### Uninstall Capstone with sudo ./make.sh uninstall Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Uninstall Capstone. Requires sudo privileges. ```shell $ sudo ./make.sh uninstall ``` -------------------------------- ### Cross-compile Capstone for Android ARM64 Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Cross-compile for Android ARM64 using ./make.sh cross-android arm64. Requires Android NDK and sets NDK environment variable. Only ARM and ARM64 are supported. ```bash $ NDK=/android/android-ndk-r10e ./make.sh cross-android arm64 ``` -------------------------------- ### Cross-compile Capstone for all iDevices Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Cross-compile for all iDevices (armv7 + armv7s + arm64) using ./make.sh ios. Requires Mac OSX with XCode. ```bash $ ./make.sh ios ``` -------------------------------- ### Configure CPack packaging Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Sets the CPack project configuration file to CPackConfig.cmake and includes CPackConfig.txt to enable packaging configuration. ```cmake set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/CPackConfig.cmake") include(CPackConfig.txt) ``` -------------------------------- ### Compile Windows binaries under Cygwin Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Compile Capstone for Windows 32-bit or 64-bit under Cygwin. The resulting files libcapstone.dll, libcapstone.dll.a, and tests/test*.exe can be used on a Windows machine. ```shell $ ./make.sh cygwin-mingw32 ``` ```shell $ ./make.sh cygwin-mingw64 ``` -------------------------------- ### window.onload handler Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Sets up heartbeat interval and initializes modals on page load. ```javascript window.onload = function () { setInterval(heartbeat, 500); initAppListModal(); initFileListModal(); }; ``` -------------------------------- ### initFileListModal function Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Initializes the file list modal with filtering and clear input functionality. ```javascript function initFileListModal() { var modal = document.getElementById("myFileListModal"); var span = document.getElementById("myFileListClose"); var filterInput = document.getElementById('filterFileInput'); var clearInput = document.getElementById('myFileListClear'); var listItems = document.getElementById('listFileItems'); span.onclick = function() { modal.style.display = "none"; } window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } filterInput.oninput = function() { var filterValue = this.value.toLowerCase(); var items = listItems.getElementsByClassName('list-item'); for(var i = 0; i < items.length; i++) { var item = items[i]; var searchKey = (item.getAttribute('data-search') || '').toLowerCase(); if(searchKey.indexOf(filterValue) > -1) { item.style.display = ""; } else { item.style.display = "none"; } } if (filterValue) { clearInput.style.display = 'block'; filterInput.style.width = 'calc(100% - 40px)'; } else { clearInput.style.display = 'none'; filterInput.style.width = '100%'; } } clearInput.onclick = function() { filterInput.value = ''; filterInput.dispatchEvent(new Event('input')); } } ``` -------------------------------- ### Cross-compile Capstone for iOS Arm64 Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Cross-compile for Arm64 devices (iPhone 5S, iPad mini Retina, iPad Air) using ./make.sh ios_arm64. Requires Mac OSX with XCode. ```bash $ ./make.sh ios_arm64 ``` -------------------------------- ### initAppListModal function Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Initializes the app list modal with filtering, clear input, and checkbox events that trigger getAppList(). ```javascript function initAppListModal() { var modal = document.getElementById("myAppListModal"); var span = document.getElementById("myAppListClose"); var filterInput = document.getElementById('filterAppInput'); var clearInput = document.getElementById('myAppListClear'); var listItems = document.getElementById('listAppItems'); var showSystemAppsCheckbox = document.getElementById('showSystemApps'); var showThirdPartyAppsCheckbox = document.getElementById('showThirdPartyApps'); var showRunningAppsCheckbox = document.getElementById('showRunningApps'); span.onclick = function() { hideAppListModal(); } window.addEventListener('click', function(event) { if (event.target == modal) { hideAppListModal(); } }); filterInput.oninput = function() { var filterValue = this.value.toLowerCase(); var items = listItems.getElementsByClassName('list-item'); for(var i = 0; i < items.length; i++) { var item = items[i]; var searchKey = (item.getAttribute('data-search') || '').toLowerCase(); if(searchKey.indexOf(filterValue) > -1) { item.style.display = ""; } else { item.style.display = "none"; } } if (filterValue) { clearInput.style.display = 'block'; filterInput.style.width = 'calc(100% - 40px)'; } else { clearInput.style.display = 'none'; filterInput.style.width = '100%'; } } clearInput.onclick = function() { filterInput.value = ''; filterInput.dispatchEvent(new Event('input')); } // checkbox 事件只绑定一次,避免重复触发闪烁 showSystemAppsCheckbox.addEventListener('change', function() { getAppList(); }); showThirdPartyAppsCheckbox.addEventListener('change', function() { getAppList(); }); showRunningAppsCheckbox.addEventListener('change', function() { getAppList(); }); } ``` -------------------------------- ### Define Capstone object library and optional static/shared libraries Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Creates an object library 'capstone' with C99 standard and public include directory. If BUILD_STATIC_LIBS is set, adds a static library 'capstone_static' with output name 'capstone'. If BUILD_SHARED_LIBS is set, enables position-independent code, adds a shared library 'capstone_shared' with output name 'capstone', version and SOVERSION properties, and defines CAPSTONE_SHARED for the object library. ```cmake add_library(capstone OBJECT ${ALL_SOURCES} ${ALL_HEADERS}) set_property(TARGET capstone PROPERTY C_STANDARD 99) target_include_directories(capstone PUBLIC $ ) if(BUILD_STATIC_LIBS) add_library(capstone_static STATIC $) # Use normal capstone name. Otherwise we get libcapstone_static.a set_target_properties(capstone_static PROPERTIES OUTPUT_NAME "capstone") target_include_directories(capstone_static PUBLIC $ ) endif() if(BUILD_SHARED_LIBS) set_property(TARGET capstone PROPERTY POSITION_INDEPENDENT_CODE 1) add_library(capstone_shared SHARED $) # Use normal capstone name. Otherwise we get libcapstone_shared.so set_target_properties(capstone_shared PROPERTIES OUTPUT_NAME "capstone") set_target_properties(capstone_shared PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} ) target_include_directories(capstone_shared PUBLIC $ ) target_compile_definitions(capstone PUBLIC CAPSTONE_SHARED) endif() ``` -------------------------------- ### Cross-compile Capstone for Android ARM Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Cross-compile for Android ARM using ./make.sh cross-android arm. Requires Android NDK and sets NDK environment variable. Only ARM and ARM64 are supported. ```bash $ NDK=/android/android-ndk-r10e ./make.sh cross-android arm ``` -------------------------------- ### Inject Su into Temporary App Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html This function injects su into a specified app by calling '/injectSuInTempApp'. It polls '/getInjectSuInTempAppResult' every 350ms until the operation completes, showing a loading indicator and alerting on success or error. ```javascript async function injectSuInTempApp(appName) { const resp = await postText('/injectSuInTempApp', JSON.stringify({ appName: appName }) ); if (resp.ok) { const data = await resp.json() appendConsole(data.content); if(data.errcode === '0') { showLoadingIndicator('请现在手动启动APP\['+ appName +'\]'); const timerid = setInterval(async ()=> { const resp = await postText('/getInjectSuInTempAppResult'); if (resp.ok) { const data = await resp.json() appendConsole(data.content); if(data.working !== '1') { clearInterval(timerid); hideLoadingIndicator(); if(data.success === '1') { alert('已经授予ROOT权限到APP\['+ appName +'\]'); } } } else { clearInterval(timerid); hideLoadingIndicator(); alert('发送数据时发生错误'); } }, 350); } } else alert('发送数据时发生错误'); } ``` -------------------------------- ### Cross-compile Capstone for iOS ArmV7s Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Cross-compile for ArmV7s devices (iPad 4, iPhone 5C, iPad mini) using ./make.sh ios_armv7s. Requires Mac OSX with XCode. ```bash $ ./make.sh ios_armv7s ``` -------------------------------- ### Uninstall test_winkernel driver Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_MSVC.TXT Command to uninstall the test driver using the 'sc' command. Run with administrator privileges. ```batch >sc delete test_winkernel ``` -------------------------------- ### CMake build configuration for permissionmanager native library Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Pro(众测开放中)/src/PermissionManager/app/src/main/cpp/CMakeLists.txt This CMake build script defines the native library 'permissionmanager' and its dependencies. It sets the minimum CMake version, declares the project, and builds static and shared libraries for Magica and the main library. It also links against the log library and a static kernel module kit library. ```cmake cmake_minimum_required(VERSION 3.18.1) ``` ```cmake project("permissionmanager") ``` ```cmake set(OTHER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/cJSON.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/native-lib.cpp" ) ``` ```cmake set(MAGICA_JNI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/magica/jni") add_library(lsplt STATIC "${MAGICA_JNI_DIR}/lsplt/elf_util.cc" "${MAGICA_JNI_DIR}/lsplt/lsplt.cc" ) target_include_directories(lsplt PUBLIC "${MAGICA_JNI_DIR}/lsplt/include" "${MAGICA_JNI_DIR}/lsplt" ) add_library(magica SHARED "${MAGICA_JNI_DIR}/magica.cpp" ) find_library(log-lib log) target_include_directories(magica PRIVATE "${MAGICA_JNI_DIR}" "${MAGICA_JNI_DIR}/lsplt/include" ) target_link_libraries(magica lsplt ${log-lib} ) ``` ```cmake add_library( # Sets the name of the library. permissionmanager # Sets the library as a shared library. SHARED # Provides a relative path to your source file(s). ${OTHER_SRC}) ``` ```cmake find_library( # Sets the name of the path variable. log-lib # Specifies the name of the NDK library that # you want CMake to locate. log) ``` ```cmake target_include_directories( permissionmanager PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../testModule/kernel_module_kit/include/ ) ``` ```cmake target_link_libraries( # Specifies the target library. permissionmanager # Links the target library to the log library # included in the NDK. ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../testModule/kernel_module_kit/lib/libkernel_module_kit_static.a z ${log-lib}) ``` -------------------------------- ### Cross-compile Capstone for iOS ArmV7 Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE.TXT Cross-compile for ArmV7 devices (iPod 4, iPad 1/2/3, iPhone4, iPhone4S) using ./make.sh ios_armv7. Requires Mac OSX with XCode. ```bash $ ./make.sh ios_armv7 ``` -------------------------------- ### Add PowerPC architecture support in CMake Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Conditionally adds PowerPC support when CAPSTONE_PPC_SUPPORT is enabled. Defines CAPSTONE_HAS_POWERPC, sets SOURCES_PPC and HEADERS_PPC, and appends test_ppc.c to TEST_SOURCES. ```cmake if(CAPSTONE_PPC_SUPPORT) add_definitions(-DCAPSTONE_HAS_POWERPC) set(SOURCES_PPC arch/PowerPC/PPCDisassembler.c arch/PowerPC/PPCInstPrinter.c arch/PowerPC/PPCMapping.c arch/PowerPC/PPCModule.c ) set(HEADERS_PPC arch/PowerPC/PPCDisassembler.h arch/PowerPC/PPCGenAsmWriter.inc arch/PowerPC/PPCInstPrinter.h arch/PowerPC/PPCMapping.h arch/PowerPC/PPCPredicates.h arch/PowerPC/PPCGenAsmWriter.inc arch/PowerPC/PPCGenRegisterName.inc arch/PowerPC/PPCGenDisassemblerTables.inc arch/PowerPC/PPCMappingInsn.inc arch/PowerPC/PPCMappingInsnName.inc arch/PowerPC/PPCGenSubtargetInfo.inc arch/PowerPC/PPCGenRegisterInfo.inc arch/PowerPC/PPCGenInstrInfo.inc ) set(TEST_SOURCES ${TEST_SOURCES} test_ppc.c) endif() ``` -------------------------------- ### HTTP management page JavaScript: postText, getProcessInfo, getValue, setValue Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Pro(众测开放中)/src/testModule/module_background_service_example/webroot/index.html JavaScript code for the HTTP management page. It defines postText() to POST to endpoints, getProcessInfo() to fetch /getPid and /getUid and display them, getValue() to fetch /getValue, and setValue() to POST to /setValue and alert success or failure. onReady() initializes the page and binds the save button. ```javascript function postText(path, bodyText = "") { const url = new URL(path, window.location.href); return fetch(url, { method: 'POST', body: bodyText }); } async function getProcessInfo() { const resp1 = await postText('/getPid'); const resp2 = await postText('/getUid'); const pid = await resp1.text(); const uid = await resp2.text(); document.getElementById('process').textContent = "当前进程 PID:" + pid + ", UID:" + uid; } async function getValue() { const resp = await postText('/getValue'); const text = await resp.text(); document.getElementById('last').textContent = "测试读取上次的值:" + text; } async function setValue(text) { const resp = await postText('/setValue', text); if (!resp.ok) throw new Error('HTTP ' + resp.status); const result = await resp.text(); alert(result.trim() === 'OK' ? '保存成功,请刷新网页' : ('保存失败:' + result)); } function onReady() { getProcessInfo(); getValue(); document.getElementById('save').addEventListener('click', () => { setValue(document.getElementById('val').value); }); } document.addEventListener('DOMContentLoaded', onReady); ``` -------------------------------- ### postText function Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Sends a POST request to the given path with optional body text. ```javascript function postText(path, bodyText = "") { const url = new URL(path, window.location.href); return fetch(url, { method: 'POST', body: bodyText }); } ``` -------------------------------- ### App List Modal Show/Hide Functions Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html These functions control the visibility of the app list modal by adding or removing the 'show' class. ```javascript function showAppListModal() { var modal = document.getElementById("myAppListModal"); modal.classList.add('show'); } function hideAppListModal() { var modal = document.getElementById("myAppListModal"); modal.classList.remove('show'); } ``` -------------------------------- ### Group header files by architecture for IDE display Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Uses source_group to organize header files into folders like 'Include\Common', 'Include\Engine', etc., for each supported architecture. This is for IDE project organization and does not affect the build. ```cmake source_group("Include\\Common" FILES ${HEADERS_COMMON}) source_group("Include\\Engine" FILES ${HEADERS_ENGINE}) source_group("Include\\ARM" FILES ${HEADERS_ARM}) source_group("Include\\ARM64" FILES ${HEADERS_ARM64}) source_group("Include\\Mips" FILES ${HEADERS_MIPS}) source_group("Include\\PowerPC" FILES ${HEADERS_PPC}) source_group("Include\\Sparc" FILES ${HEADERS_SPARC}) source_group("Include\\SystemZ" FILES ${HEADERS_SYSZ}) source_group("Include\\X86" FILES ${HEADERS_X86}) source_group("Include\\XCore" FILES ${HEADERS_XCORE}) source_group("Include\\M68K" FILES ${HEADERS_M68K}) source_group("Include\\TMS320C64x" FILES ${HEADERS_TMS320C64X}) source_group("Include\\M680X" FILES ${HEADERS_MC680X}) source_group("Include\\EVM" FILES ${HEADERS_EVM}) source_group("Include\\WASM" FILES ${HEADERS_WASM}) source_group("Include\\MOS65XX" FILES ${HEADERS_MOS65XX}) source_group("Include\\BPF" FILES ${HEADERS_BPF}) source_group("Include\\RISCV" FILES ${HEADERS_RISCV}) source_group("Include\\SH" FILES ${HEADERS_SH}) source_group("Include\\TriCore" FILES ${HEADERS_TRICORE}) ``` -------------------------------- ### Cleanup test signing and delete test driver Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/COMPILE_MSVC.TXT Commands to delete the test_winkernel service and disable test signing. Run in an elevated command prompt. ```batch >sc delete test_winkernel >bcdedit /deletevalue testsigning ``` -------------------------------- ### Build tests and fuzz target when CAPSTONE_BUILD_TESTS is enabled Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt When CAPSTONE_BUILD_TESTS is set, enables testing, creates an executable for each test source in TEST_SOURCES, links against the capstone object library, and registers each as a CTest test. If CAPSTONE_ARM_SUPPORT is set, adds an ARM regression test from suite/arm/test_arm_regression.c. Also builds the fuzz_disasm executable from three source files and links it to capstone. ```cmake if(CAPSTONE_BUILD_TESTS) set(CMAKE_FOLDER "Tests") enable_testing() foreach(TSRC ${TEST_SOURCES}) string(REGEX REPLACE ".c$" "" TBIN ${TSRC}) add_executable(${TBIN} "tests/${TSRC}") target_link_libraries(${TBIN} PRIVATE capstone) add_test(NAME "capstone_${TBIN}" COMMAND ${TBIN}) endforeach() if(CAPSTONE_ARM_SUPPORT) set(ARM_REGRESS_TEST test_arm_regression.c) string(REGEX REPLACE ".c$" "" ARM_REGRESS_BIN ${ARM_REGRESS_TEST}) add_executable(${ARM_REGRESS_BIN} "suite/arm/${ARM_REGRESS_TEST}") target_link_libraries(${ARM_REGRESS_BIN} PRIVATE capstone) add_test(NAME "capstone_${ARM_REGRESS_BIN}" COMMAND ${ARM_REGRESS_BIN}) endif() # fuzz target built with the tests add_executable(fuzz_disasm suite/fuzz/onefile.c suite/fuzz/fuzz_disasm.c suite/fuzz/platform.c) target_link_libraries(fuzz_disasm PRIVATE capstone) unset(CMAKE_FOLDER) endif() ``` -------------------------------- ### Group source files by architecture for IDE display Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Uses source_group to organize source files into folders like 'Source\Engine', 'Source\ARM', etc., for each supported architecture. This is for IDE project organization and does not affect the build. ```cmake source_group("Source\\Engine" FILES ${SOURCES_ENGINE}) source_group("Source\\ARM" FILES ${SOURCES_ARM}) source_group("Source\\ARM64" FILES ${SOURCES_ARM64}) source_group("Source\\Mips" FILES ${SOURCES_MIPS}) source_group("Source\\PowerPC" FILES ${SOURCES_PPC}) source_group("Source\\Sparc" FILES ${SOURCES_SPARC}) source_group("Source\\SystemZ" FILES ${SOURCES_SYSZ}) source_group("Source\\X86" FILES ${SOURCES_X86}) source_group("Source\\XCore" FILES ${SOURCES_XCORE}) source_group("Source\\M68K" FILES ${SOURCES_M68K}) source_group("Source\\TMS320C64x" FILES ${SOURCES_TMS320C64X}) source_group("Source\\M680X" FILES ${SOURCES_M680X}) source_group("Source\\EVM" FILES ${SOURCES_EVM}) source_group("Source\\WASM" FILES ${SOURCES_WASM}) source_group("Source\\MOS65XX" FILES ${SOURCES_MOS65XX}) source_group("Source\\BPF" FILES ${SOURCES_BPF}) source_group("Source\\RISCV" FILES ${SOURCES_RISCV}) source_group("Source\\SH" FILES ${SOURCES_SH}) source_group("Source\\TriCore" FILES ${SOURCES_TRICORE}) ``` -------------------------------- ### showLoadingIndicator and hideLoadingIndicator functions Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Shows or hides a loading indicator with custom text. ```javascript function showLoadingIndicator(text) { var loadingIndicator = document.getElementById('loadingIndicator'); var loadingText = document.getElementById('loadingText'); loadingText.innerHTML = text; loadingIndicator.style.display = 'flex'; } function hideLoadingIndicator(isShow) { var loadingIndicator = document.getElementById('loadingIndicator'); var loadingText = document.getElementById('loadingText'); loadingText.innerHTML = ''; loadingIndicator.style.display = 'none'; } ``` -------------------------------- ### copyToClipboard function Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html Copies text to clipboard using a temporary textarea and document.execCommand('copy'). ```javascript function copyToClipboard(text) { let tempTextarea = document.createElement('textarea'); document.body.appendChild(tempTextarea); tempTextarea.value = text; tempTextarea.select(); document.execCommand('copy'); document.body.removeChild(tempTextarea); } ``` -------------------------------- ### Set App List Modal Checkbox State Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html This function enables or disables the checkboxes for showing system apps, third-party apps, and running apps based on the isSuForeverInject flag. ```javascript function setAppListModalCheckbox(isSuForeverInject) { var showSystemAppsCheckbox = document.getElementById('showSystemApps'); var showThirdPartyAppsCheckbox = document.getElementById('showThirdPartyApps'); var showRunningAppsCheckbox = document.getElementById('showRunningApps'); showSystemAppsCheckbox.disabled = !isSuForeverInject; showThirdPartyAppsCheckbox.disabled = !isSuForeverInject; showRunningAppsCheckbox.disabled = !isSuForeverInject; } ``` -------------------------------- ### Add MIPS architecture support in CMake Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Conditionally adds MIPS support when CAPSTONE_MIPS_SUPPORT is enabled. Defines CAPSTONE_HAS_MIPS, sets SOURCES_MIPS and HEADERS_MIPS (note the second set overwrites the first, omitting MipsMappingInsn.inc), and appends test_mips.c to TEST_SOURCES. ```cmake if(CAPSTONE_MIPS_SUPPORT) add_definitions(-DCAPSTONE_HAS_MIPS) set(SOURCES_MIPS arch/Mips/MipsDisassembler.c arch/Mips/MipsInstPrinter.c arch/Mips/MipsMapping.c arch/Mips/MipsModule.c ) set(HEADERS_MIPS arch/Mips/MipsDisassembler.h arch/Mips/MipsGenAsmWriter.inc arch/Mips/MipsGenDisassemblerTables.inc arch/Mips/MipsGenInstrInfo.inc arch/Mips/MipsGenRegisterInfo.inc arch/Mips/MipsGenSubtargetInfo.inc arch/Mips/MipsInstPrinter.h arch/Mips/MipsMapping.h arch/Mips/MipsMappingInsn.inc ) set(HEADERS_MIPS arch/Mips/MipsDisassembler.h arch/Mips/MipsGenAsmWriter.inc arch/Mips/MipsGenDisassemblerTables.inc arch/Mips/MipsGenInstrInfo.inc arch/Mips/MipsGenRegisterInfo.inc arch/Mips/MipsGenSubtargetInfo.inc arch/Mips/MipsInstPrinter.h arch/Mips/MipsMapping.h ) set(TEST_SOURCES ${TEST_SOURCES} test_mips.c) endif() ``` -------------------------------- ### Add ARM64 architecture support in CMake Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/patch_kernel_root/3rdparty/capstone-5.0.7/src/CMakeLists.txt Conditionally adds ARM64 (AArch64) support when CAPSTONE_ARM64_SUPPORT is enabled. Defines CAPSTONE_HAS_ARM64, sets SOURCES_ARM64 and HEADERS_ARM64, and appends test_arm64.c to TEST_SOURCES. ```cmake if(CAPSTONE_ARM64_SUPPORT) add_definitions(-DCAPSTONE_HAS_ARM64) set(SOURCES_ARM64 arch/AArch64/AArch64BaseInfo.c arch/AArch64/AArch64Disassembler.c arch/AArch64/AArch64InstPrinter.c arch/AArch64/AArch64Mapping.c arch/AArch64/AArch64Module.c ) set(HEADERS_ARM64 arch/AArch64/AArch64AddressingModes.h arch/AArch64/AArch64BaseInfo.h arch/AArch64/AArch64Disassembler.h arch/AArch64/AArch64InstPrinter.h arch/AArch64/AArch64Mapping.h arch/AArch64/AArch64GenAsmWriter.inc arch/AArch64/AArch64GenDisassemblerTables.inc arch/AArch64/AArch64GenInstrInfo.inc arch/AArch64/AArch64GenRegisterInfo.inc arch/AArch64/AArch64GenRegisterName.inc arch/AArch64/AArch64GenRegisterV.inc arch/AArch64/AArch64GenSubtargetInfo.inc arch/AArch64/AArch64GenSystemOperands.inc arch/AArch64/AArch64GenSystemOperands_enum.inc arch/AArch64/AArch64MappingInsn.inc arch/AArch64/AArch64MappingInsnName.inc arch/AArch64/AArch64MappingInsnOp.inc ) set(TEST_SOURCES ${TEST_SOURCES} test_arm64.c) endif() ``` -------------------------------- ### Clean App List Modal Source: https://github.com/abcz316/skroot-linuxkernelroot/blob/master/Lite_version/src/testRoot/kernel_root_kit/src/jni/web_server/index.html This function removes all child elements from the app list items container, effectively clearing the list. ```javascript function cleanAppListModal() { var listItems = document.getElementById('listAppItems'); while (listItems.firstChild) { listItems.removeChild(listItems.firstChild); } } ```