add platform list of platform api
This commit is contained in:
parent
3cc02a3292
commit
1f2de8b60d
15 changed files with 654199 additions and 11 deletions
9
androscalpel_platform_api_list/Cargo.toml
Normal file
9
androscalpel_platform_api_list/Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "androscalpel_platform_api_list"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[features]
|
||||
sdk34 = []
|
||||
5
androscalpel_platform_api_list/README.md
Normal file
5
androscalpel_platform_api_list/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Android Platform API
|
||||
|
||||
List of android platform API (API that are either in the android SDK or hidden API).
|
||||
|
||||
The list is extracted from the default android emulator the respective SDKs.
|
||||
20
androscalpel_platform_api_list/src/lib.rs
Normal file
20
androscalpel_platform_api_list/src/lib.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
pub mod sdk34;
|
||||
pub use sdk34::*;
|
||||
|
||||
// TODO: automate addign a new SDK
|
||||
// TODO: different version with different features
|
||||
|
||||
/// Test if the class is part of the platform classes.
|
||||
pub fn is_platform_class(smali: &str) -> bool {
|
||||
is_sdk34_platform_class(smali)
|
||||
}
|
||||
|
||||
/// Test if the field is part of the platform classes.
|
||||
pub fn is_platform_field(smali: &str) -> bool {
|
||||
is_sdk34_platform_field(smali)
|
||||
}
|
||||
|
||||
/// Test if the method is part of the platform classes.
|
||||
pub fn is_platform_method(smali: &str) -> bool {
|
||||
is_sdk34_platform_method(smali)
|
||||
}
|
||||
48935
androscalpel_platform_api_list/src/sdk34/classes.txt
Normal file
48935
androscalpel_platform_api_list/src/sdk34/classes.txt
Normal file
File diff suppressed because it is too large
Load diff
230283
androscalpel_platform_api_list/src/sdk34/fields.txt
Normal file
230283
androscalpel_platform_api_list/src/sdk34/fields.txt
Normal file
File diff suppressed because it is too large
Load diff
374815
androscalpel_platform_api_list/src/sdk34/methods.txt
Normal file
374815
androscalpel_platform_api_list/src/sdk34/methods.txt
Normal file
File diff suppressed because it is too large
Load diff
60
androscalpel_platform_api_list/src/sdk34/mod.rs
Normal file
60
androscalpel_platform_api_list/src/sdk34/mod.rs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
use std::collections::HashSet;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub static PLATFORM_CLASSES_SDK34: LazyLock<HashSet<&'static str>> =
|
||||
LazyLock::new(|| include_str!("classes.txt").lines().collect());
|
||||
pub static PLATFORM_FIELDS_SDK34: LazyLock<HashSet<&'static str>> =
|
||||
LazyLock::new(|| include_str!("fields.txt").lines().collect());
|
||||
pub static PLATFORM_METHODS_SDK34: LazyLock<HashSet<&'static str>> =
|
||||
LazyLock::new(|| include_str!("methods.txt").lines().collect());
|
||||
|
||||
/// Test if the class is part of the platform classes of the SDK 34.
|
||||
pub fn is_sdk34_platform_class(smali: &str) -> bool {
|
||||
PLATFORM_CLASSES_SDK34.contains(smali)
|
||||
}
|
||||
|
||||
/// Test if the field is part of the platform classes of the SDK 34.
|
||||
pub fn is_sdk34_platform_field(smali: &str) -> bool {
|
||||
PLATFORM_FIELDS_SDK34.contains(smali)
|
||||
}
|
||||
|
||||
/// Test if the method is part of the platform classes of the SDK 34.
|
||||
pub fn is_sdk34_platform_method(smali: &str) -> bool {
|
||||
PLATFORM_METHODS_SDK34.contains(smali)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_classes_sdk34_set() {
|
||||
assert!(PLATFORM_CLASSES_SDK34
|
||||
.contains("Landroid/accessibilityservice/AccessibilityGestureEvent;"));
|
||||
let s: String = "Landroid/accessibilityservice/AccessibilityInputMethodSession;".into();
|
||||
assert!(PLATFORM_CLASSES_SDK34.contains(s.as_str()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fields_sdk34_set() {
|
||||
assert!(PLATFORM_FIELDS_SDK34.contains(
|
||||
"Landroid/accessibilityservice/AccessibilityButtonController$$\
|
||||
ExternalSyntheticLambda1;->f$0:Landroid/accessibilityservice/\
|
||||
AccessibilityButtonController;"
|
||||
));
|
||||
let s: String = "Landroid/accessibilityservice/AccessibilityButtonController;->mLock:Ljava/lang/Object;".into();
|
||||
assert!(PLATFORM_FIELDS_SDK34.contains(s.as_str()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_methods_sdk34_set() {
|
||||
assert!(PLATFORM_METHODS_SDK34
|
||||
.contains("Landroid/accessibilityservice/AccessibilityButtonController$$ExternalSyntheticLambda1;->run()V"));
|
||||
let s: String = "Landroid/accessibilityservice/AccessibilityButtonController;->\
|
||||
$r8$lambda$h5Na0_pkg6ffhlKQPqxrTXannSI(\
|
||||
Landroid/accessibilityservice/AccessibilityButtonController;\
|
||||
Landroid/accessibilityservice/AccessibilityButtonController$AccessibilityButtonCallback;\
|
||||
)V".into();
|
||||
assert!(PLATFORM_METHODS_SDK34.contains(s.as_str()));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue