mirror of
https://github.com/hyugogirubato/KeyDive.git
synced 2025-04-29 12:14:25 +02:00
fix symbols analysis crash
This commit is contained in:
parent
7c2f27df44
commit
3628e42f45
@ -215,7 +215,9 @@ class Core:
|
|||||||
elif not minimum and vendor.oem > 17 and not self.functions:
|
elif not minimum and vendor.oem > 17 and not self.functions:
|
||||||
self.logger.warning("For OEM API > 17, specifying '--functions' is required. Refer to https://github.com/hyugogirubato/KeyDive/blob/main/docs/FUNCTIONS.md")
|
self.logger.warning("For OEM API > 17, specifying '--functions' is required. Refer to https://github.com/hyugogirubato/KeyDive/blob/main/docs/FUNCTIONS.md")
|
||||||
|
|
||||||
return script.exports_sync.hooklibrary(library["name"])
|
# Enable dynamic analysis (symbols) only when necessary
|
||||||
|
dynamic = minimum and vendor.oem > 17 and not self.functions
|
||||||
|
return script.exports_sync.hooklibrary(library["name"], dynamic)
|
||||||
|
|
||||||
# Unload the script if the target library is not found.
|
# Unload the script if the target library is not found.
|
||||||
script.unload()
|
script.unload()
|
||||||
|
@ -84,14 +84,14 @@ const getLibrary = (name) => {
|
|||||||
return libraries.length === 1 ? libraries[0] : undefined;
|
return libraries.length === 1 ? libraries[0] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFunctions = (library) => {
|
const getFunctions = (library, dynamic) => {
|
||||||
try {
|
try {
|
||||||
// https://frida.re/news/2025/01/09/frida-16-6-0-released/
|
// https://frida.re/news/2025/01/09/frida-16-6-0-released/
|
||||||
const functions = library.enumerateSymbols().map(item => ({
|
const functions = dynamic ? library.enumerateSymbols().map(item => ({
|
||||||
type: item.type,
|
type: item.type,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
address: item.address
|
address: item.address
|
||||||
}));
|
})) : [];
|
||||||
|
|
||||||
library.enumerateExports().forEach(item => {
|
library.enumerateExports().forEach(item => {
|
||||||
if (!functions.includes(item)) {
|
if (!functions.includes(item)) {
|
||||||
@ -111,7 +111,7 @@ const disableLibrary = (name) => {
|
|||||||
const library = getLibrary(name);
|
const library = getLibrary(name);
|
||||||
if (library) {
|
if (library) {
|
||||||
// https://github.com/hyugogirubato/KeyDive/issues/23#issuecomment-2230374415
|
// https://github.com/hyugogirubato/KeyDive/issues/23#issuecomment-2230374415
|
||||||
const functions = getFunctions(library);
|
const functions = getFunctions(library, false);
|
||||||
const disabled = [];
|
const disabled = [];
|
||||||
|
|
||||||
functions.forEach(func => {
|
functions.forEach(func => {
|
||||||
@ -395,7 +395,7 @@ const RunningCRC = (address) => {
|
|||||||
|
|
||||||
|
|
||||||
// @Hooks
|
// @Hooks
|
||||||
const hookLibrary = (name) => {
|
const hookLibrary = (name, dynamic) => {
|
||||||
// https://github.com/poxyran/misc/blob/master/frida-enumerate-imports.py
|
// https://github.com/poxyran/misc/blob/master/frida-enumerate-imports.py
|
||||||
let library = getLibrary(name);
|
let library = getLibrary(name);
|
||||||
if (!library) return false;
|
if (!library) return false;
|
||||||
@ -409,7 +409,7 @@ const hookLibrary = (name) => {
|
|||||||
address: library.base.add(s.address)
|
address: library.base.add(s.address)
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
functions = getFunctions(library);
|
functions = getFunctions(library, dynamic);
|
||||||
}
|
}
|
||||||
|
|
||||||
functions = functions.filter(f => !NATIVE_C_API.includes(f.name));
|
functions = functions.filter(f => !NATIVE_C_API.includes(f.name));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user