mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Merge branch 'GP-0_ryanmkurtz_PR-7885_cyberkaida_stripped-rust-detect'
This commit is contained in:
commit
85b24c686d
2 changed files with 13 additions and 5 deletions
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -21,6 +21,7 @@ public class RustConstants {
|
||||||
public static final CategoryPath RUST_CATEGORYPATH = new CategoryPath("/rust");
|
public static final CategoryPath RUST_CATEGORYPATH = new CategoryPath("/rust");
|
||||||
public static final byte[] RUST_SIGNATURE_1 = "RUST_BACKTRACE".getBytes();
|
public static final byte[] RUST_SIGNATURE_1 = "RUST_BACKTRACE".getBytes();
|
||||||
public static final byte[] RUST_SIGNATURE_2 = "/rustc/".getBytes();
|
public static final byte[] RUST_SIGNATURE_2 = "/rustc/".getBytes();
|
||||||
|
public static final byte[] RUST_SIGNATURE_3 = "RUST_MIN_STACK".getBytes();
|
||||||
public static final String RUST_EXTENSIONS_PATH = "extensions/rust/";
|
public static final String RUST_EXTENSIONS_PATH = "extensions/rust/";
|
||||||
public static final String RUST_EXTENSIONS_UNIX = "unix";
|
public static final String RUST_EXTENSIONS_UNIX = "unix";
|
||||||
public static final String RUST_EXTENSIONS_WINDOWS = "windows";
|
public static final String RUST_EXTENSIONS_WINDOWS = "windows";
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -38,7 +38,11 @@ import ghidra.xml.XmlParseException;
|
||||||
public class RustUtilities {
|
public class RustUtilities {
|
||||||
/**
|
/**
|
||||||
* Checks if a given {@link MemoryBlock} contains a Rust signature
|
* Checks if a given {@link MemoryBlock} contains a Rust signature
|
||||||
*
|
* <p>
|
||||||
|
* This may be used by loaders to determine if a program was compiled with rust.
|
||||||
|
* If the program is determined to be rust, then the compiler property is set to
|
||||||
|
* {@link RustConstants#RUST_COMPILER}.
|
||||||
|
*
|
||||||
* @param block The {@link MemoryBlock} to scan for Rust signatures
|
* @param block The {@link MemoryBlock} to scan for Rust signatures
|
||||||
* @return True if the given {@link MemoryBlock} is not null and contains a Rust signature;
|
* @return True if the given {@link MemoryBlock} is not null and contains a Rust signature;
|
||||||
* otherwise, false
|
* otherwise, false
|
||||||
|
@ -55,6 +59,9 @@ public class RustUtilities {
|
||||||
if (containsBytes(bytes, RustConstants.RUST_SIGNATURE_2)) {
|
if (containsBytes(bytes, RustConstants.RUST_SIGNATURE_2)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (containsBytes(bytes, RustConstants.RUST_SIGNATURE_3)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue