function optimization

This commit is contained in:
hyugogirubato 2025-03-01 09:36:03 +01:00
parent 480de09271
commit 7c2f27df44

View File

@ -1,5 +1,5 @@
/** /**
* Date: 2025-01-18 * Date: 2025-03-01
* Description: DRM key extraction for research and educational purposes. * Description: DRM key extraction for research and educational purposes.
* Source: https://github.com/hyugogirubato/KeyDive * Source: https://github.com/hyugogirubato/KeyDive
*/ */
@ -69,19 +69,18 @@ const getVersion = () => Frida.version;
// @Utils // @Utils
const getLibraries = (name) => { const getLibraries = () => {
// https://github.com/hyugogirubato/KeyDive/issues/14#issuecomment-2146788792 // https://github.com/hyugogirubato/KeyDive/issues/14#issuecomment-2146788792
try { try {
const libraries = Process.enumerateModules(); return Process.enumerateModules();
return name ? libraries.filter(l => l.name.includes(name)) : libraries;
} catch (e) { } catch (e) {
print(Level.CRITICAL, e.message); print(Level.CRITICAL, e.message);
return []; return [];
} }
}; }
const getLibrary = (name) => { const getLibrary = (name) => {
const libraries = getLibraries(name); const libraries = getLibraries().filter(l => l.name === name);
return libraries.length === 1 ? libraries[0] : undefined; return libraries.length === 1 ? libraries[0] : undefined;
} }