Compare commits

...

8 Commits
v2.2.0 ... main

Author SHA1 Message Date
hyugogirubato
d68dedc03a update CHANGELOG.md 2025-03-01 15:38:19 +01:00
hyugogirubato
3e4b9e54e7 release v2.2.1 2025-03-01 15:36:50 +01:00
hyugogirubato
54457c8f0d add issue reference 2025-03-01 14:17:36 +01:00
hyugogirubato
3628e42f45 fix symbols analysis crash 2025-03-01 14:16:02 +01:00
hyugogirubato
7c2f27df44 function optimization 2025-03-01 09:36:03 +01:00
hyugogirubato
480de09271 add private key function 2025-03-01 09:10:11 +01:00
hyugogirubato
fa86fd8392 add private key function 2025-03-01 09:06:41 +01:00
hyugogirubato
3c51fbbfa0 add private key function 2025-02-22 17:00:51 +01:00
6 changed files with 29 additions and 16 deletions

View File

@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.2.1] - 2025-03-01
### Added
- Added private key function.
### Fixed
- Error extracting functions (symbols) for old libraries.
## [2.2.0] - 2025-01-19 ## [2.2.0] - 2025-01-19
### Added ### Added
@ -436,6 +446,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Initial release of the project, laying the foundation for future enhancements and features. - Initial release of the project, laying the foundation for future enhancements and features.
[2.2.1]: https://github.com/hyugogirubato/KeyDive/releases/tag/v2.2.1
[2.2.0]: https://github.com/hyugogirubato/KeyDive/releases/tag/v2.2.0 [2.2.0]: https://github.com/hyugogirubato/KeyDive/releases/tag/v2.2.0
[2.1.5]: https://github.com/hyugogirubato/KeyDive/releases/tag/v2.1.5 [2.1.5]: https://github.com/hyugogirubato/KeyDive/releases/tag/v2.1.5
[2.1.4]: https://github.com/hyugogirubato/KeyDive/releases/tag/v2.1.4 [2.1.4]: https://github.com/hyugogirubato/KeyDive/releases/tag/v2.1.4

View File

@ -4,4 +4,4 @@ from .cdm import Cdm
from .vendor import Vendor from .vendor import Vendor
from .keybox import Keybox from .keybox import Keybox
__version__ = "2.2.0" __version__ = "2.2.1"

View File

@ -86,7 +86,7 @@ OEM_CRYPTO_API = {
"rnmsglvj", "polorucp", "kqzqahjq", "pldrclfq", "kgaitijd", "cwkfcplc", "crhqcdet", "ulns", "dnvffnze", "ygjiljer", "rnmsglvj", "polorucp", "kqzqahjq", "pldrclfq", "kgaitijd", "cwkfcplc", "crhqcdet", "ulns", "dnvffnze", "ygjiljer",
"qbjxtubz", "qkfrcjtw", "rbhjspoh", "zgtjmxko", "igrqajte", "ofskesua", "qllcoacg", "pukctkiv", "ehdqmfmd", "qbjxtubz", "qkfrcjtw", "rbhjspoh", "zgtjmxko", "igrqajte", "ofskesua", "qllcoacg", "pukctkiv", "ehdqmfmd",
"xftzvkwx", "gndskkuk", "wcggmnnx", "kaatohcz", "ktmgdchz", "jkcwonus", "ehmduqyt", "vewtuecx", "mxrbzntq", "xftzvkwx", "gndskkuk", "wcggmnnx", "kaatohcz", "ktmgdchz", "jkcwonus", "ehmduqyt", "vewtuecx", "mxrbzntq",
"isyowgmp", "flzfkhbc", "rtgejgqb" "isyowgmp", "flzfkhbc", "rtgejgqb", "sxxprljw", "ebxjbtxl", "pcmtpkrj"
# Add more as needed for different versions. # Add more as needed for different versions.
} }

View File

@ -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()

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,30 +69,29 @@ 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;
} }
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)) {
@ -112,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 => {
@ -396,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;
@ -410,7 +409,8 @@ const hookLibrary = (name) => {
address: library.base.add(s.address) address: library.base.add(s.address)
})); }));
} else { } else {
functions = getFunctions(library); // https://github.com/hyugogirubato/KeyDive/issues/50
functions = getFunctions(library, dynamic);
} }
functions = functions.filter(f => !NATIVE_C_API.includes(f.name)); functions = functions.filter(f => !NATIVE_C_API.includes(f.name));

View File

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "keydive" name = "keydive"
version = "2.2.0" version = "2.2.1"
description = "Extract Widevine L3 keys from Android devices effortlessly, spanning multiple Android versions for DRM research and education." description = "Extract Widevine L3 keys from Android devices effortlessly, spanning multiple Android versions for DRM research and education."
license = "MIT" license = "MIT"
authors = ["hyugogirubato <65763543+hyugogirubato@users.noreply.github.com>"] authors = ["hyugogirubato <65763543+hyugogirubato@users.noreply.github.com>"]