mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-07-30 07:18:37 -09:00
Updated help to show again when the user clicks in a find results table
This commit is contained in:
@@ -392,6 +392,8 @@
|
||||
|
||||
<H3><A name="Demangler_Analyzer"></A>Demangler Analyzer</H3>
|
||||
|
||||
<H3>Demangler GNU or Demangeler Microsoft</H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>This analyzer examines the name of the newly created function. If the name appears to be
|
||||
a <I>GCC v3</I> or <I>Microsoft Visual Studio</I> mangled symbol, then it will demangle the
|
||||
@@ -577,25 +579,14 @@
|
||||
|
||||
<P><U>Started By:</U> Importing or adding to a program, Auto Analyze command</P>
|
||||
</BLOCKQUOTE>
|
||||
<H3><A name="Format_String_Analyzer"></A>Format String Analyzer</H3>
|
||||
|
||||
|
||||
<H3><A name="Image"></A>Embedded Media Analyzer</H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>This analyzer detects variadic function calls in the bodies of each function that intersect
|
||||
the current selection. It then parses their format string arguments to infer the correct function
|
||||
call signatures. Currently, this analyzer only supports printf, scanf, and their variants (e.g., snprintf, fscanf).
|
||||
If the current selection is empty, it searches through every function within the binary. Once
|
||||
the signatures are inferred, they are overridden.</P>
|
||||
|
||||
<P><U>Started By:</U> Importing or adding to a program, Auto Analyze command</P>
|
||||
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H3><A name="Image"></A>Image Analyzer</H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>This analyzer searches the program for images. If a valid image is found an appropriate
|
||||
image data type is applied at that location with the corresponding visual representation of
|
||||
the image. Also, a bookmark is added to indicate an image.</P>
|
||||
<P>Finds embedded media data types (e.g., png, gif, jpeg, wav). If a valid image is found an
|
||||
appropriate image data type is applied at that location with the corresponding visual
|
||||
representation of image. Also, a bookmark is added to indicate an image.</P>
|
||||
|
||||
<P><U>Started By</U>: Importing or adding to a program, Auto Analyze command</P>
|
||||
</BLOCKQUOTE>
|
||||
@@ -727,6 +718,22 @@
|
||||
|
||||
<P><U>Started By</U>: Auto Analyze command</P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H3><A name="Format_String_Analyzer"></A>Format String Analyzer</H3>
|
||||
<H3>(Variadic Function Signature Override)</H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>This analyzer detects variadic function calls in the bodies of each function that intersect
|
||||
the current selection. It then parses their format string arguments to infer the correct function
|
||||
call signatures. Currently, this analyzer only supports printf, scanf, and their variants (e.g., snprintf, fscanf).
|
||||
If the current selection is empty, it searches through every function within the binary. Once
|
||||
the signatures are inferred, they are overridden.</P>
|
||||
|
||||
<P><U>Started By:</U> Importing or adding to a program, Auto Analyze command</P>
|
||||
|
||||
</BLOCKQUOTE>
|
||||
|
||||
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<P class="providedbyplugin">Provided by: <I>AutoAnalysisPlugin</I><BR>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -35,11 +35,12 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class EmbeddedMediaAnalyzer extends AbstractAnalyzer {
|
||||
private static final String NAME = "Embedded Media";
|
||||
private static final String DESCRIPTION =
|
||||
"Finds embedded media data types (ie png, gif, jpeg, wav)";
|
||||
"Finds embedded media data types (e.g., png, gif, jpeg, wav)";
|
||||
|
||||
private static final String OPTION_NAME_CREATE_BOOKMARKS = "Create Analysis Bookmarks";
|
||||
private static final String OPTION_DESCRIPTION_CREATE_BOOKMARKS =
|
||||
"If checked, an analysis bookmark will be created at each location where embedded media data is identified.";
|
||||
"If checked, an analysis bookmark will be created at each location where embedded media " +
|
||||
"data is identified.";
|
||||
private static final boolean OPTION_DEFAULT_CREATE_BOOKMARKS_ENABLED = true;
|
||||
|
||||
private boolean createBookmarksEnabled = OPTION_DEFAULT_CREATE_BOOKMARKS_ENABLED;
|
||||
@@ -101,14 +102,16 @@ public class EmbeddedMediaAnalyzer extends AbstractAnalyzer {
|
||||
private void addByteSearchPattern(MemoryBytePatternSearcher searcher, Program program,
|
||||
List<Address> foundMedia, DataType mediaDT, String mediaName, byte[] bytes,
|
||||
byte[] mask) {
|
||||
|
||||
if (bytes == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
GenericMatchAction<DataType> action = new GenericMatchAction<DataType>(mediaDT) {
|
||||
|
||||
@Override
|
||||
public void apply(Program prog, Address addr, Match match) {
|
||||
//See if it is already an applied media data type
|
||||
public void apply(Program prog, Address addr, Match<Pattern> match) {
|
||||
// See if it is already an applied media data type
|
||||
if (!program.getListing().isUndefined(addr, addr)) {
|
||||
return;
|
||||
}
|
||||
@@ -117,23 +120,26 @@ public class EmbeddedMediaAnalyzer extends AbstractAnalyzer {
|
||||
CreateDataCmd cmd = new CreateDataCmd(addr, mediaDT);
|
||||
if (cmd.applyTo(program)) {
|
||||
if (createBookmarksEnabled) {
|
||||
program.getBookmarkManager().setBookmark(addr, BookmarkType.ANALYSIS,
|
||||
"Embedded Media", "Found " + mediaName + " Embedded Media");
|
||||
program.getBookmarkManager()
|
||||
.setBookmark(addr, BookmarkType.ANALYSIS,
|
||||
"Embedded Media", "Found " + mediaName + " Embedded Media");
|
||||
}
|
||||
foundMedia.add(addr);
|
||||
}
|
||||
|
||||
// If media does not apply correctly then it is not really that media data type
|
||||
// or there is other data in the way.
|
||||
}
|
||||
//If media does not apply correctly then it is not really a that media data type or there is other data in the way
|
||||
catch (Exception e) {
|
||||
// Not a valid embedded media or no room to apply it so just ignore it and skip it
|
||||
// Not a valid embedded media or no room to apply it so just ignore it and skip
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GenericByteSequencePattern<DataType> genericByteMatchPattern =
|
||||
new GenericByteSequencePattern<DataType>(bytes, mask, action);
|
||||
|
||||
searcher.addPattern(genericByteMatchPattern);
|
||||
GenericByteSequencePattern<DataType> pattern =
|
||||
new GenericByteSequencePattern<>(bytes, mask, action);
|
||||
searcher.addPattern(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -25,7 +25,8 @@ import ghidra.xml.XmlPullParser;
|
||||
public class DummyMatchAction implements MatchAction {
|
||||
|
||||
@Override
|
||||
public void apply(Program program, Address addr, Match match) {
|
||||
public void apply(Program program, Address addr, Match<Pattern> match) {
|
||||
// stub
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -21,7 +21,7 @@ package ghidra.util.bytesearch;
|
||||
* The associated value can be retrieved when the sequence is matched.
|
||||
*
|
||||
* @param <T> - object to attach to match sequence, generally used to specify
|
||||
* a specialized momento to be used by the action when it is "applied".
|
||||
* a specialized memento to be used by the action when it is "applied".
|
||||
*/
|
||||
public class GenericMatchAction<T> extends DummyMatchAction {
|
||||
T matchValue;
|
||||
|
||||
@@ -20,14 +20,14 @@ import ghidra.program.model.listing.Program;
|
||||
import ghidra.xml.XmlPullParser;
|
||||
|
||||
/**
|
||||
* Interface for a match action to be taken for the Program@Address for a ditted bit seqence pattern
|
||||
* Interface for a match action to be taken for the Program@Address for a ditted bit sequence pattern
|
||||
*/
|
||||
public interface MatchAction {
|
||||
/**
|
||||
* Apply the match action to the program at the address.
|
||||
*
|
||||
* @param program program in which the match occurred
|
||||
* @param addr where the match occured
|
||||
* @param addr where the match occurred
|
||||
* @param match information about the match that occurred
|
||||
*/
|
||||
public void apply(Program program, Address addr, Match<Pattern> match);
|
||||
|
||||
@@ -102,6 +102,11 @@ public class HelpManager implements HelpService {
|
||||
Help.installHelpService(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowing() {
|
||||
return mainHB.isDisplayed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean helpExists() {
|
||||
return isValidHelp && hasMergedHelpSets;
|
||||
|
||||
@@ -39,6 +39,8 @@ import generic.util.WindowUtilities;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
import ghidra.util.worker.Worker;
|
||||
import help.Help;
|
||||
import help.HelpService;
|
||||
|
||||
/**
|
||||
* Enables the Find Dialog for searching through the current page of a help document.
|
||||
@@ -273,6 +275,12 @@ class HelpViewSearcher {
|
||||
|
||||
@Override
|
||||
public void activate() {
|
||||
|
||||
HelpService help = Help.getHelpService();
|
||||
if (!help.isShowing()) {
|
||||
help.showHelp(searchUrl);
|
||||
}
|
||||
|
||||
//
|
||||
// When we activate, a new page load may get triggered. When that happens the caret
|
||||
// position will get moved by the help viewer. We will put back the last active search
|
||||
|
||||
@@ -33,6 +33,11 @@ public class DefaultHelpService implements HelpService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showHelp(java.net.URL url) {
|
||||
// no-op
|
||||
|
||||
@@ -28,6 +28,11 @@ public interface HelpService {
|
||||
|
||||
public static final String DUMMY_HELP_SET_NAME = "Dummy_HelpSet.hs";
|
||||
|
||||
/**
|
||||
* {@return true if the main help window is showing}
|
||||
*/
|
||||
public boolean isShowing();
|
||||
|
||||
/**
|
||||
* Display the Help content identified by the help object.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user