-
Notifications
You must be signed in to change notification settings - Fork 0
/
called_exported_functions.js
33 lines (26 loc) · 1.04 KB
/
called_exported_functions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Check for exported functions called by an EXE.
let dllName = "KernelBase.dll";
let dllModule = Process.findModuleByName(dllName);
if (dllModule) {
send("[+] " + dllName + " is loaded at base address: " + dllModule.base);
// Enumerate all exported functions from the DLL
let exports = dllModule.enumerateExports();
send("[+] Hooking exported functions from " + dllName + ":");
// Hook each exported function
exports.forEach(function (exp) {
try {
send(" |_ Hooking " + exp.name + " @ " + exp.address);
// Attach an interceptor to each exported function
Interceptor.attach(exp.address, {
onEnter: function (args) {
send("[+] Called function: " + exp.name);
}
});
} catch (err) {
// If an error occurs, log it and continue with the next function
send("[-] Failed to hook " + exp.name + ": " + err.message);
}
});
} else {
send("[-] " + dllName + " is not loaded.");
}