Check for "System/iOSSupport" Path

This commit is contained in:
Thomas A 2022-07-24 19:16:46 -07:00
parent 069445fbd8
commit 01c7d7965f
3 changed files with 31 additions and 11 deletions

View File

@ -6,6 +6,14 @@ mod symbols;
use std::path::Path; use std::path::Path;
fn analyse_system_path<P: AsRef<Path>>(path: &P, results_location: &location::ResultsLocation, whoami_username: &program::WhoAmIUserName, unique_folder :Option<&str>) {
let parse_filesystem_symbols_list = symbols::ParseBaseFilesystem::new(path);
for parse_filesystem_symbols in parse_filesystem_symbols_list {
parse_filesystem_symbols.traverse(&results_location.shared_cache_path, unique_folder, path, &whoami_username);
}
}
fn main() { fn main() {
let arguments = argument::Arguments::new(std::env::args()); let arguments = argument::Arguments::new(std::env::args());
let base_locations = location::BaseLocation::new(&arguments); let base_locations = location::BaseLocation::new(&arguments);
@ -19,20 +27,18 @@ fn main() {
let dyld_shared_cache_extractor = program::DyldSharedCacheExtractor::new(&base_locations, &results_location); let dyld_shared_cache_extractor = program::DyldSharedCacheExtractor::new(&base_locations, &results_location);
for path in dyld_shared_cache_extractor.extracted_paths.iter() { for path in dyld_shared_cache_extractor.extracted_paths.iter() {
let parse_filesystem_symbols = symbols::ParseBaseFilesystem::new(path); let shared_cache_folder = path.as_path().file_name().expect("Unable to obtain shared cache folder name").to_str();
let shared_cache_folder = path.file_name().expect("Unable to obtain shared cache folder name").to_str(); analyse_system_path(path,&results_location,&whoami_username,shared_cache_folder);
parse_filesystem_symbols.traverse(&results_location.shared_cache_path, shared_cache_folder, path, &whoami_username);
} }
clean::Cleanup::remove_temp(&results_location); clean::Cleanup::remove_temp(&results_location);
{ {
let path = Path::new(arguments.base_path.as_str()); let path = Path::new(arguments.base_path.as_str());
let parse_filesystem_symbols = symbols::ParseBaseFilesystem::new(path); let unique_folder = Some("standard");
parse_filesystem_symbols.traverse(&results_location.unique_version_path, Some("standard"), path, &whoami_username); analyse_system_path(&path,&results_location,&whoami_username,unique_folder);
clean::Cleanup::remove_temp(&results_location);
} }
clean::Cleanup::remove_temp(&results_location);
println!{"{:#?}",arguments} println!{"{:#?}",arguments}
println!{"{:#?}",system_version} println!{"{:#?}",system_version}

View File

@ -1,4 +1,4 @@
use std::{process::{Command, Output}, fs::{read_dir, ReadDir, File}, path::{Path, PathBuf}, io::Read, fmt::format}; use std::{process::{Command, Output}, fs::{read_dir, ReadDir, File}, path::{Path, PathBuf}, io::Read};
use crate::location::{BaseLocation, ResultsLocation}; use crate::location::{BaseLocation, ResultsLocation};

View File

@ -5,6 +5,7 @@ use crate::{location, program};
const SYSTEM_LIBRARY_FRAMEWORK_PATH: &str = "System/Library/Frameworks"; const SYSTEM_LIBRARY_FRAMEWORK_PATH: &str = "System/Library/Frameworks";
const SYSTEM_LIBRARY_PRIVATEFRAMEWORK_PATH: &str = "System/Library/PrivateFrameworks"; const SYSTEM_LIBRARY_PRIVATEFRAMEWORK_PATH: &str = "System/Library/PrivateFrameworks";
const USR_LIB_PATH: &str = "usr/lib"; const USR_LIB_PATH: &str = "usr/lib";
const SYSTEM_IOSSUPPORT: &str = "System/iOSSupport";
const MACHO_32BIT_MH_MAGIC: u32 = 0xfeedface; const MACHO_32BIT_MH_MAGIC: u32 = 0xfeedface;
const MACHO_32BIT_MH_CIGAM: u32 = 0xcefaedfe; const MACHO_32BIT_MH_CIGAM: u32 = 0xcefaedfe;
@ -53,11 +54,24 @@ const NM_TEXTFILE_NAME: &str = "nm.txt";
const OTOOL_TEXTFILE_NAME: &str = "otool.txt"; const OTOOL_TEXTFILE_NAME: &str = "otool.txt";
impl ParseBaseFilesystem { impl ParseBaseFilesystem {
pub fn new<P: AsRef<Path>>(location: P) -> ParseBaseFilesystem { pub fn new<P: AsRef<Path>>(location: &P) -> Vec<ParseBaseFilesystem> {
let mut base_filesystems: Vec<ParseBaseFilesystem> = Vec::new();
base_filesystems.push(ParseBaseFilesystem::build_parse_base_filesystem(location));
let iossupport_path = location.as_ref().join(SYSTEM_IOSSUPPORT);
if iossupport_path.is_dir() {
println!("Found iOSSupport Directory");
base_filesystems.push(ParseBaseFilesystem::build_parse_base_filesystem(iossupport_path));
}
base_filesystems
}
fn build_parse_base_filesystem<P: AsRef<Path>>(location: P) -> ParseBaseFilesystem {
let framework_path = location.as_ref().join(SYSTEM_LIBRARY_FRAMEWORK_PATH); let framework_path = location.as_ref().join(SYSTEM_LIBRARY_FRAMEWORK_PATH);
let privateframework_path = location.as_ref().join(SYSTEM_LIBRARY_PRIVATEFRAMEWORK_PATH); let privateframework_path = location.as_ref().join(SYSTEM_LIBRARY_PRIVATEFRAMEWORK_PATH);
let usr_lib_path = location.as_ref().join(USR_LIB_PATH); let usr_lib_path = location.as_ref().join(USR_LIB_PATH);
ParseBaseFilesystem { ParseBaseFilesystem {
framework_path, framework_path,
privateframework_path, privateframework_path,