mirror of
https://github.com/darlinghq/LibrarySymbols.git
synced 2025-02-13 18:40:15 +00:00
Mask Username From "nm" Output
I don't think this is actually needed, but just to be safe...
This commit is contained in:
parent
abc7d5fba2
commit
a6cfe70d1a
@ -66,8 +66,8 @@ fn gather_executables_and_save_output(output: &Path, common_symbol_locations: &C
|
||||
let Ok(relative_path) = macho_lib.strip_prefix(starting_path) else { continue };
|
||||
let output = output.join(relative_path);
|
||||
|
||||
let nm_output = NmLibrarySymbols::new(macho_lib);
|
||||
let otool_output = OtoolLibrarySymbols::new(macho_lib, &whoami);
|
||||
let nm_output = NmLibrarySymbols::new(macho_lib,whoami);
|
||||
let otool_output = OtoolLibrarySymbols::new(macho_lib,whoami);
|
||||
|
||||
save_output_to_file(&nm_output, &output.join("nm.txt"));
|
||||
save_output_to_file(&otool_output, &output.join("otool.txt"));
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::{path::Path, process::Command};
|
||||
|
||||
use crate::program::SaveOutput;
|
||||
use crate::program::WhoAmIUserName;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NmLibrarySymbols {
|
||||
@ -8,15 +9,15 @@ pub struct NmLibrarySymbols {
|
||||
}
|
||||
|
||||
impl NmLibrarySymbols {
|
||||
pub fn new(macho: &Path) -> NmLibrarySymbols {
|
||||
let raw_output = NmLibrarySymbols::launch_program(macho);
|
||||
pub fn new(macho: &Path, whoami: &WhoAmIUserName) -> NmLibrarySymbols {
|
||||
let raw_output = NmLibrarySymbols::launch_program(macho,whoami);
|
||||
|
||||
NmLibrarySymbols {
|
||||
raw_output
|
||||
}
|
||||
}
|
||||
|
||||
fn launch_program(macho: &Path) -> String {
|
||||
fn launch_program(macho: &Path, whoami: &WhoAmIUserName) -> String {
|
||||
let Some(macho_str) = macho.to_str() else { return String::new() };
|
||||
|
||||
let output = Command::new("nm")
|
||||
@ -24,7 +25,8 @@ impl NmLibrarySymbols {
|
||||
.output()
|
||||
.expect("Unable to launch 'nm' application");
|
||||
|
||||
String::from_utf8(output.stdout).expect("Unable to save output")
|
||||
let output = String::from_utf8(output.stdout).expect("Unable to save output");
|
||||
whoami.mask_user_account(&output)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,8 @@ impl OtoolLibrarySymbols {
|
||||
.output()
|
||||
.expect("Unable to launch 'otool' application");
|
||||
|
||||
OtoolLibrarySymbols::mask_user_account(String::from_utf8(output.stdout).expect("Unable to save output"),whoami)
|
||||
}
|
||||
|
||||
fn mask_user_account(value: String, whoami: &WhoAmIUserName) -> String {
|
||||
value.replace(whoami.macos_users_dir.as_str(), "/Users/[Removed Username]")
|
||||
let output = String::from_utf8(output.stdout).expect("Unable to save output");
|
||||
whoami.mask_user_account(&output)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,4 +24,8 @@ impl WhoAmIUserName {
|
||||
|
||||
parse_stdout(output).first().expect("Unable to obtain value").to_string()
|
||||
}
|
||||
|
||||
pub fn mask_user_account(&self, value: &String) -> String {
|
||||
value.replace(self.macos_users_dir.as_str(), "/Users/[Removed Username]")
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user