Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new setting to skip HEAD requests for localhost servers #5481

Closed
1 change: 1 addition & 0 deletions python/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Settings:
"title" string None No Concise Setting Title
"type" string None No {"array", "boolean", "number", "string"}
"elementType" string "type" is "array" No {"string"}
"sorted" boolean "type" is "array" Yes Automatically sort list items (default is true)
"enum" array : {string} "type" is "string" Yes Enumeration definitions
"enumDescriptions" array : {string} "type" is "string" Yes Enumeration descriptions that match "enum" array
"minValue" number "type" is "number" Yes Specify 0 to infer unsigned (default is signed)
Expand Down
107 changes: 93 additions & 14 deletions rust/examples/pdb-ng/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ fn sym_store_exists(path: &String) -> Result<bool> {
if !Settings::new("").get_bool("network.pdbAutoDownload", None, None) {
return Err(anyhow!("Auto download disabled"));
}

// If the user doesn't want to check the network path
// (in the case of using a symbol server proxy that doesn't accept HEAD requests),
// just assume the path exists and return true.
if path.contains("localhost:") && Settings::new("").get_bool("network.pdbSkipNetworkPathCheck", None, None) {
return Ok(true);
}

info!("HEAD: {}", path);

// Download from remote
Expand Down Expand Up @@ -412,13 +420,27 @@ impl PDBParser {
if check_guid {
return Err(anyhow!("PDB GUID does not match"));
} else {
if interaction::show_message_box(
"Mismatched PDB",
"This PDB does not look like it matches your binary. Do you want to load it anyway?",
MessageBoxButtonSet::YesNoButtonSet,
binaryninja::interaction::MessageBoxIcon::QuestionIcon
) == MessageBoxButtonResult::NoButton {
return Err(anyhow!("User cancelled mismatched load"));
let ask = Settings::new("").get_string(
"pdb.features.loadMismatchedPDB",
Some(view),
None,
);

match ask.as_str() {
"true" => {},
"ask" => {
if interaction::show_message_box(
"Mismatched PDB",
"This PDB does not look like it matches your binary. Do you want to load it anyway?",
MessageBoxButtonSet::YesNoButtonSet,
binaryninja::interaction::MessageBoxIcon::QuestionIcon
) == MessageBoxButtonResult::NoButton {
return Err(anyhow!("User cancelled mismatched load"));
}
}
_ => {
return Err(anyhow!("PDB GUID does not match"));
}
}
}
}
Expand Down Expand Up @@ -513,13 +535,27 @@ impl PDBParser {
if check_guid {
return Err(anyhow!("File not compiled with PDB information"));
} else {
if interaction::show_message_box(
"No PDB Information",
"This file does not look like it was compiled with a PDB, so your PDB might not correctly apply to the analysis. Do you want to load it anyway?",
MessageBoxButtonSet::YesNoButtonSet,
binaryninja::interaction::MessageBoxIcon::QuestionIcon
) == MessageBoxButtonResult::NoButton {
return Err(anyhow!("User cancelled missing info load"));
let ask = Settings::new("").get_string(
"pdb.features.loadMismatchedPDB",
Some(view),
None,
);

match ask.as_str() {
"true" => {},
"ask" => {
if interaction::show_message_box(
"No PDB Information",
"This file does not look like it was compiled with a PDB, so your PDB might not correctly apply to the analysis. Do you want to load it anyway?",
MessageBoxButtonSet::YesNoButtonSet,
binaryninja::interaction::MessageBoxIcon::QuestionIcon
) == MessageBoxButtonResult::NoButton {
return Err(anyhow!("User cancelled missing info load"));
}
}
_ => {
return Err(anyhow!("File not compiled with PDB information"));
}
}
}
}
Expand Down Expand Up @@ -756,12 +792,25 @@ fn init_plugin() -> bool {
}"#,
);

settings.register_setting_json(
"network.pdbSkipNetworkPathCheck",
r#"{
"title" : "Skip Network Path Check",
"type" : "boolean",
"default" : false,
"aliases" : ["pdb.SkipNetworkPathCheck", "pdb.skip-network-path-check"],
"description" : "Skip the HEAD http request that verifies if a PDB network path exists (only for localhost servers).",
"ignore" : []
}"#,
);

settings.register_setting_json(
"pdb.files.symbolServerList",
r#"{
"title" : "Symbol Server List",
"type" : "array",
"elementType" : "string",
"sorted" : false,
"default" : ["https://msdl.microsoft.com/download/symbols"],
"aliases" : ["pdb.symbol-server-list", "pdb.symbolServerList"],
"description" : "List of servers to query for pdb symbols.",
Expand Down Expand Up @@ -841,6 +890,36 @@ fn init_plugin() -> bool {
}"#,
);

settings.register_setting_json(
"pdb.features.loadMismatchedPDB",
r#"{
"title" : "Load Mismatched PDB",
"type" : "string",
"default" : "ask",
"enum" : ["true", "ask", "false"],
"enumDescriptions" : [
"Always load the PDB",
"Use the Interaction system to ask if the PDB should be loaded",
"Never load the PDB"
],
"aliases" : [],
"description" : "If a manually loaded PDB has a mismatched GUID, should it be loaded?",
"ignore" : []
}"#,
);

settings.register_setting_json(
"pdb.features.parseSymbols",
r#"{
"title" : "Parse PDB Symbols",
"type" : "boolean",
"default" : true,
"aliases" : [],
"description" : "Parse Symbol names and types. If you turn this off, you will only load Types.",
"ignore" : []
}"#,
);

true
}

Expand Down
Loading
Loading