2024-10-26 13:18:05 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
2024-07-06 18:01:47 +00:00
|
|
|
from keydive.vendor import Vendor
|
|
|
|
|
2025-01-19 13:13:07 +00:00
|
|
|
# https://cs.android.com/android/platform/superproject/+/android14-qpr3-release:bionic/libc/libc.map.txt
|
2024-07-06 18:01:47 +00:00
|
|
|
NATIVE_C_API = {
|
2024-10-28 20:30:10 +00:00
|
|
|
# BUILT-IN
|
2025-01-19 13:13:07 +00:00
|
|
|
"main",
|
2024-07-06 18:01:47 +00:00
|
|
|
# STDIO
|
2025-01-19 13:13:07 +00:00
|
|
|
"fclose", "fflush", "fgetc", "fgetpos", "fgets", "fopen", "fprintf", "fputc", "fputs", "fread", "freopen",
|
|
|
|
"fscanf", "fseek", "fsetpos", "ftell", "fwrite", "getc", "getchar", "gets", "perror", "printf", "putc",
|
|
|
|
"putchar", "puts", "remove", "rename", "rewind", "scanf", "setbuf", "setvbuf", "sprintf", "sscanf", "tmpfile",
|
|
|
|
"tmpnam", "ungetc", "vfprintf", "vprintf", "vsprintf", "fileno", "feof", "ferror", "snprintf",
|
2024-07-06 18:01:47 +00:00
|
|
|
# STDLIB
|
2025-01-19 13:13:07 +00:00
|
|
|
"abort", "abs", "atexit", "atof", "atoi", "atol", "bsearch", "calloc", "div", "exit", "free", "getenv", "labs",
|
|
|
|
"ldiv", "malloc", "mblen", "mbstowcs", "mbtowc", "qsort", "rand", "realloc", "srand", "strtod", "strtol",
|
|
|
|
"strtoul", "system", "wcstombs", "wctomb",
|
2024-07-06 18:01:47 +00:00
|
|
|
# STRING
|
2025-01-19 13:13:07 +00:00
|
|
|
"memchr", "memcmp", "memcpy", "memmove", "memset", "strcat", "strchr", "strcmp", "strcoll", "strcpy", "strcspn",
|
|
|
|
"strerror", "strlen", "strncat", "strncmp", "strncpy", "strpbrk", "strrchr", "strspn", "strstr", "strtok",
|
|
|
|
"strxfrm", "strncasecmp",
|
2024-07-06 18:01:47 +00:00
|
|
|
# MATH
|
2025-01-19 13:13:07 +00:00
|
|
|
"acos", "asin", "atan", "atan2", "cos", "cosh", "exp", "fabs", "floor", "fmod", "frexp", "ldexp", "log",
|
|
|
|
"log10", "modf", "pow", "sin", "sinh", "sqrt", "tan", "tanh",
|
2024-07-06 18:01:47 +00:00
|
|
|
# CTYPE
|
2025-01-19 13:13:07 +00:00
|
|
|
"isalnum", "isalpha", "iscntrl", "isdigit", "isgraph", "islower", "isprint", "ispunct", "isspace", "isupper",
|
|
|
|
"isxdigit", "tolower", "toupper",
|
2024-07-06 18:01:47 +00:00
|
|
|
# TIME
|
2025-01-19 13:13:07 +00:00
|
|
|
"asctime", "clock", "ctime", "difftime", "gmtime", "localtime", "mktime", "strftime", "time",
|
2024-07-06 18:01:47 +00:00
|
|
|
# UNISTD
|
2025-01-19 13:13:07 +00:00
|
|
|
"access", "alarm", "chdir", "chown", "close", "dup", "dup2", "execle", "execv", "execve", "execvp", "fork",
|
|
|
|
"fpathconf", "getcwd", "getegid", "geteuid", "getgid", "getgroups", "getlogin", "getopt", "getpgid", "getpgrp",
|
|
|
|
"getpid", "getppid", "getuid", "isatty", "lseek", "pathconf", "pause", "pipe", "read", "rmdir", "setgid",
|
|
|
|
"setpgid", "setsid", "setuid", "sleep", "sysconf", "tcgetpgrp", "tcsetpgrp", "ttyname", "ttyname_r", "write",
|
|
|
|
"fsync", "unlink", "syscall", "getpagesize",
|
2024-07-06 18:01:47 +00:00
|
|
|
# FCNTL
|
2025-01-19 13:13:07 +00:00
|
|
|
"creat", "fcntl", "open",
|
2024-07-06 18:01:47 +00:00
|
|
|
# SYS_TYPE
|
2025-01-19 13:13:07 +00:00
|
|
|
"fd_set", "FD_CLR", "FD_ISSET", "FD_SET", "FD_ZERO",
|
2024-07-06 18:01:47 +00:00
|
|
|
# SYS_STAT
|
2025-01-19 13:13:07 +00:00
|
|
|
"chmod", "fchmod", "fstat", "mkdir", "mkfifo", "stat", "umask",
|
2024-07-06 18:01:47 +00:00
|
|
|
# SYS_TIME
|
2025-01-19 13:13:07 +00:00
|
|
|
"gettimeofday", "select", "settimeofday",
|
2024-07-06 18:01:47 +00:00
|
|
|
# SIGNAL
|
2025-01-19 13:13:07 +00:00
|
|
|
"signal", "raise", "kill", "sigaction", "sigaddset", "sigdelset", "sigemptyset", "sigfillset", "sigismember",
|
|
|
|
"sigpending", "sigprocmask", "sigsuspend", "alarm", "pause",
|
2024-07-06 18:01:47 +00:00
|
|
|
# SETJMP
|
2025-01-19 13:13:07 +00:00
|
|
|
"longjmp", "setjmp",
|
2024-07-06 18:01:47 +00:00
|
|
|
# ERRNO
|
2025-01-19 13:13:07 +00:00
|
|
|
"errno", "strerror", "perror",
|
2024-07-06 18:01:47 +00:00
|
|
|
# ASSERT
|
2025-01-19 13:13:07 +00:00
|
|
|
"assert",
|
2024-07-06 18:01:47 +00:00
|
|
|
# LOCAL
|
2025-01-19 13:13:07 +00:00
|
|
|
"localeconv", "setlocale",
|
2024-07-06 18:01:47 +00:00
|
|
|
# WCHAR
|
2025-01-19 13:13:07 +00:00
|
|
|
"btowc", "fgetwc", "fgetws", "fputwc", "fputws", "fwide", "fwprintf", "fwscanf", "getwc", "getwchar", "mbrlen",
|
|
|
|
"mbrtowc", "mbsinit", "mbsrtowcs", "putwc", "putwchar", "swprintf", "swscanf", "ungetwc", "vfwprintf",
|
|
|
|
"vfwscanf", "vwprintf", "vwscanf", "wcrtomb", "wcscat", "wcschr", "wcscmp", "wcscoll", "wcscpy", "wcscspn",
|
|
|
|
"wcsftime", "wcslen", "wcsncat", "wcsncmp", "wcsncpy", "wcspbrk", "wcsrchr", "wcsrtombs", "wcsspn", "wcsstr",
|
|
|
|
"wcstod", "wcstok", "wcstol", "wcstombs", "wcstoul", "wcsxfrm", "wctob", "wmemchr", "wmemcmp", "wmemcpy",
|
|
|
|
"wmemmove", "wmemset", "wprintf", "wscanf",
|
2024-07-06 18:01:47 +00:00
|
|
|
# WCTYPE
|
2025-01-19 13:13:07 +00:00
|
|
|
"iswalnum", "iswalpha", "iswcntrl", "iswdigit", "iswgraph", "iswlower", "iswprint", "iswpunct", "iswspace",
|
|
|
|
"iswupper", "iswxdigit", "towlower", "towupper", "iswctype", "wctype",
|
2024-07-06 18:01:47 +00:00
|
|
|
# STDDEF
|
2025-01-19 13:13:07 +00:00
|
|
|
"NULL", "offsetof", "ptrdiff_t", "size_t", "wchar_t",
|
2024-07-06 18:01:47 +00:00
|
|
|
# STDARG
|
2025-01-19 13:13:07 +00:00
|
|
|
"va_arg", "va_end", "va_start",
|
2024-07-06 18:01:47 +00:00
|
|
|
# DLFCN
|
2025-01-19 13:13:07 +00:00
|
|
|
"dlclose", "dlerror", "dlopen", "dlsym",
|
2024-07-06 18:01:47 +00:00
|
|
|
# DIRENT
|
2025-01-19 13:13:07 +00:00
|
|
|
"closedir", "opendir", "readdir",
|
2024-07-06 18:01:47 +00:00
|
|
|
# SYS_SENDFILE
|
2025-01-19 13:13:07 +00:00
|
|
|
"sendfile",
|
2024-07-06 18:01:47 +00:00
|
|
|
# SYS_MMAN
|
2025-01-19 13:13:07 +00:00
|
|
|
"mmap", "mprotect", "munmap",
|
2024-07-06 18:01:47 +00:00
|
|
|
# SYS_UTSNAME
|
2025-01-19 13:13:07 +00:00
|
|
|
"uname",
|
2024-07-06 18:01:47 +00:00
|
|
|
# LINK
|
2025-01-19 13:13:07 +00:00
|
|
|
"dladdr"
|
2024-07-06 18:01:47 +00:00
|
|
|
}
|
|
|
|
|
2025-01-19 13:13:07 +00:00
|
|
|
# https://cs.android.com/search?q=oemcrypto&sq=&ss=android%2Fplatform%2Fsuperproject
|
2024-07-06 18:01:47 +00:00
|
|
|
OEM_CRYPTO_API = {
|
|
|
|
# Mapping of function names across different API levels (obfuscated names may vary).
|
2025-01-19 13:13:07 +00:00
|
|
|
"rnmsglvj", "polorucp", "kqzqahjq", "pldrclfq", "kgaitijd", "cwkfcplc", "crhqcdet", "ulns", "dnvffnze", "ygjiljer",
|
|
|
|
"qbjxtubz", "qkfrcjtw", "rbhjspoh", "zgtjmxko", "igrqajte", "ofskesua", "qllcoacg", "pukctkiv", "ehdqmfmd",
|
|
|
|
"xftzvkwx", "gndskkuk", "wcggmnnx", "kaatohcz", "ktmgdchz", "jkcwonus", "ehmduqyt", "vewtuecx", "mxrbzntq",
|
2025-01-19 18:23:10 +00:00
|
|
|
"isyowgmp", "flzfkhbc", "rtgejgqb"
|
2024-07-06 18:01:47 +00:00
|
|
|
# Add more as needed for different versions.
|
|
|
|
}
|
|
|
|
|
2024-10-18 18:34:42 +00:00
|
|
|
# https://developer.android.com/tools/releases/platforms
|
2024-07-06 18:01:47 +00:00
|
|
|
CDM_VENDOR_API = {
|
2025-01-19 13:13:07 +00:00
|
|
|
"mediaserver": [
|
|
|
|
Vendor(22, 11, "1.0", r"libwvdrmengine(?:@\S+)?\.so")
|
2024-07-07 16:14:18 +00:00
|
|
|
],
|
2025-01-19 13:13:07 +00:00
|
|
|
"mediadrmserver": [
|
|
|
|
Vendor(24, 11, "1.0", r"libwvdrmengine(?:@\S+)?\.so")
|
2024-07-07 16:14:18 +00:00
|
|
|
],
|
2025-01-19 13:13:07 +00:00
|
|
|
"android.hardware.drm@1.0-service.widevine": [
|
|
|
|
Vendor(26, 13, "5.1.0", r"libwvhidl(?:@\S+)?\.so")
|
2024-07-07 16:14:18 +00:00
|
|
|
],
|
2025-01-19 13:13:07 +00:00
|
|
|
"android.hardware.drm@1.1-service.widevine": [
|
|
|
|
Vendor(28, 14, "14.0.0", r"libwvhidl(?:@\S+)?\.so")
|
2024-07-07 16:14:18 +00:00
|
|
|
],
|
2025-01-19 13:13:07 +00:00
|
|
|
"android.hardware.drm@1.2-service.widevine": [
|
|
|
|
Vendor(29, 15, "15.0.0", r"libwvhidl(?:@\S+)?\.so")
|
2024-07-07 16:14:18 +00:00
|
|
|
],
|
2025-01-19 13:13:07 +00:00
|
|
|
"android.hardware.drm@1.3-service.widevine": [
|
|
|
|
Vendor(30, 16, "16.0.0", r"libwvhidl(?:@\S+)?\.so")
|
2024-07-07 16:14:18 +00:00
|
|
|
],
|
2025-01-19 13:13:07 +00:00
|
|
|
"android.hardware.drm@1.4-service.widevine": [
|
|
|
|
Vendor(31, 16, "16.1.0", r"libwvhidl(?:@\S+)?\.so")
|
2024-07-07 16:14:18 +00:00
|
|
|
],
|
2025-01-19 13:13:07 +00:00
|
|
|
"android.hardware.drm-service.widevine": [
|
|
|
|
Vendor(33, 17, "17.0.0", r"libwvaidl(?:@\S+)?\.so"),
|
|
|
|
Vendor(34, 18, "18.0.0", r"android\.hardware\.drm-service(?:-lazy)?\.widevine(?:@\S+)?"),
|
|
|
|
Vendor(35, 18, "19.0.1", r"android\.hardware\.drm-service(?:-lazy)?\.widevine(?:@\S+)?")
|
2024-07-07 16:14:18 +00:00
|
|
|
]
|
2024-07-06 18:01:47 +00:00
|
|
|
}
|
|
|
|
|
2024-07-06 20:01:48 +00:00
|
|
|
# https://developers.google.com/widevine
|
2024-07-06 18:01:47 +00:00
|
|
|
CDM_FUNCTION_API = {
|
2025-01-19 13:13:07 +00:00
|
|
|
"UsePrivacyMode",
|
|
|
|
"GetCdmClientPropertySet",
|
|
|
|
"PrepareKeyRequest",
|
|
|
|
"getOemcryptoDeviceId",
|
|
|
|
"lcc07",
|
|
|
|
"oecc07",
|
|
|
|
"Read",
|
|
|
|
"x1c36",
|
|
|
|
"runningcrc"
|
2024-07-06 18:01:47 +00:00
|
|
|
}
|
2024-10-26 13:18:05 +00:00
|
|
|
|
2025-01-19 13:13:07 +00:00
|
|
|
# Maximum clear API level for Keybox
|
|
|
|
# https://cs.android.com/android/platform/superproject/+/android14-qpr3-release:trusty/user/app/sample/hwcrypto/keybox/keybox.c
|
2024-11-03 13:02:16 +00:00
|
|
|
KEYBOX_MAX_CLEAR_API = 28
|
|
|
|
|
2024-10-26 13:18:05 +00:00
|
|
|
# https://github.com/kaltura/kaltura-device-info-android
|
|
|
|
DRM_PLAYER = {
|
2025-01-19 13:13:07 +00:00
|
|
|
"package": "com.kaltura.kalturadeviceinfo",
|
|
|
|
"path": Path(__file__).parent.parent / "docs" / "server" / "kaltura.apk",
|
|
|
|
"url": "https://github.com/kaltura/kaltura-device-info-android/releases/download/t3/kaltura-device-info-release.apk"
|
2024-10-26 13:18:05 +00:00
|
|
|
}
|