MCPcopy Create free account
hub / github.com/GrowthEase/GameSentry / dump_lua

Function dump_lua

lib/cli/module/lua-dump.js:4–33  ·  view source on GitHub ↗
(package_name, module_dlopen,sendflag)

Source from the content-addressed store, hash-verified

2const utils = require("../utils/utils")
3
4function dump_lua(package_name, module_dlopen,sendflag) {
5 const app_path = `/data/data/${package_name}/luadump/`;
6 Interceptor.attach(module_dlopen.findExportByName("luaL_loadbufferx"), {
7 onEnter: function (args) {
8 const name = Memory.readCString(args[3]);
9 if (name.length < 50 && name.length > 0) {
10 this.Path = name.substring(0, name.lastIndexOf("/"));
11 this.file = name.substring(name.lastIndexOf("/") + 1, name.length);
12 if (utils.access(app_path + this.Path) == -1) {
13 utils.folder_mkdirs(this.Path, app_path);
14 }
15 if (utils.access(app_path + name) == 0) {
16 if (name != "chunk" && name != "Init") {
17 const data = utils.readFile(app_path + name);
18 if(data.data == null){
19 helper.send_message("error","open "+app_path + name+" failed !")
20 return
21 }
22 args[2] = new NativePointer(ptr(data.size));
23 args[1].writeByteArray(data.data.readByteArray(data.size));
24 helper.send_message(sendflag, "load lua file :"+app_path + name)
25 }
26 } else {
27 utils.Dump(app_path + name, args[1], args[2].toInt32());
28 helper.send_message(sendflag, "dump :"+app_path + name)
29 }
30 }
31 }
32 })
33}
34
35module.exports = {
36 dump_lua

Callers

nothing calls this directly

Calls 1

attachMethod · 0.80

Tested by

no test coverage detected