()
| 32 | |
| 33 | #[test] |
| 34 | fn load_android_libraries() { |
| 35 | let mut hooks = HashMap::new(); |
| 36 | hooks.insert("arc4random".to_owned(), arc4random as usize); |
| 37 | hooks.insert("chmod".to_owned(), chmod as usize); |
| 38 | hooks.insert("close".to_owned(), close as usize); |
| 39 | hooks.insert("free".to_owned(), free as usize); |
| 40 | hooks.insert("fstat".to_owned(), fstat as usize); |
| 41 | hooks.insert("ftruncate".to_owned(), ftruncate as usize); |
| 42 | hooks.insert("gettimeofday".to_owned(), gettimeofday as usize); |
| 43 | hooks.insert("lstat".to_owned(), lstat as usize); |
| 44 | hooks.insert("malloc".to_owned(), malloc as usize); |
| 45 | hooks.insert("mkdir".to_owned(), mkdir as usize); |
| 46 | hooks.insert("open".to_owned(), open as usize); |
| 47 | hooks.insert("read".to_owned(), read as usize); |
| 48 | hooks.insert("strncpy".to_owned(), strncpy as usize); |
| 49 | hooks.insert("umask".to_owned(), umask as usize); |
| 50 | hooks.insert("write".to_owned(), write as usize); |
| 51 | crate::hook_manager::add_hooks(hooks); |
| 52 | |
| 53 | let store_services_core = |
| 54 | AndroidLibrary::load("lib/x86_64/libstoreservicescore.so") |
| 55 | .expect("Cannot load StoreServicesCore"); |
| 56 | |
| 57 | println!("Library loaded. Let's start."); |
| 58 | let load_library_with_path: sysv64_type!(fn(*const c_char) -> i32) = |
| 59 | unsafe { std::mem::transmute(store_services_core.get_symbol("kq56gsgHG6").unwrap()) }; // Sph98paBcz abort |
| 60 | let library_path = CString::new("lib/x86_64/").unwrap(); |
| 61 | let ret = load_library_with_path(library_path.as_ptr() as *const c_char); |
| 62 | println!("provisioning path, ADI returned {}", ret); |
| 63 | |
| 64 | let set_android_identifier: sysv64_type!(fn(*const c_char, u32) -> i32) = |
| 65 | unsafe { std::mem::transmute(store_services_core.get_symbol("Sph98paBcz").unwrap()) }; // Sph98paBcz abort |
| 66 | // println!("{:p}", set_android_identifier as *const ()); |
| 67 | let identifier = "f213456789abcde0"; |
| 68 | let str = CString::new(identifier).unwrap(); |
| 69 | let len = identifier.len() as u32; |
| 70 | let ret = set_android_identifier(str.as_ptr() as *const c_char, len); |
| 71 | println!("Fin ? ADI returned {}", ret); |
| 72 | } |
| 73 | } |
nothing calls this directly
no test coverage detected