-
Notifications
You must be signed in to change notification settings - Fork 0
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
Auto detect library #13
Comments
After a long look into Ghidra's API I am no longer sure this is actually possible. (Sorry for the ugly code, for some reason my IDE wouldn't let me loop over the iterator without doing it by hand…) for (Reference e : p.getReferenceManager().getReferencesFrom(add)) {
Map<String, List<String>> out = new HashMap<>();
for (String externalLibraryName : p.getExternalManager().getExternalLibraryNames()) {
List<String> functionNames = new LinkedList<>();
out.put(externalLibraryName, functionNames);
Iterator<ExternalLocation> it = p.getExternalManager().getExternalLocations(externalLibraryName);
for (; it.hasNext();) {
ExternalLocation ex = it.next();
functionNames.add(ex.getLabel());
}
}
System.out.println(out.entrySet().stream().map(
entry -> entry.getKey() + entry.getValue().stream().collect(Collectors.joining(", ", ": ", "")))
.collect(Collectors.joining("\n")));
}
This seems to suggest that while Ghidra knows about Specifically, in the mentioned example, the following line does not work on my machine (returns String libPath = currentProgram.getExternalManager().getExternalLibrary(externalLocation.getLibraryName()).getAssociatedProgramPath() I do not see an other way to bridge the gap between the output of |
Further evidence that the above is correct. Error message when importing a file into Ghidra:
|
See #11
Should also rework handlers in lists for hook adding.
The text was updated successfully, but these errors were encountered: