mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
fixed KeywordSearhLists
This commit is contained in:
parent
4b8f0dc6d4
commit
e86e3d509d
@ -36,7 +36,7 @@ import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
public abstract class KeywordSearchListsAbstract {
|
||||
|
||||
protected String filePath;
|
||||
public Map<String, KeywordSearchList> theLists; //the keyword data
|
||||
Map<String, KeywordSearchList> theLists; //the keyword data
|
||||
static KeywordSearchListsXML currentInstance = null;
|
||||
private static final String CUR_LISTS_FILE_NAME = "keywords.xml";
|
||||
private static String CUR_LISTS_FILE = PlatformUtil.getUserConfigDirectory() + File.separator + CUR_LISTS_FILE_NAME;
|
||||
@ -425,6 +425,10 @@ public abstract class KeywordSearchListsAbstract {
|
||||
return f.exists() && f.canRead() && f.canWrite();
|
||||
}
|
||||
|
||||
public void setUseForIngest(String key, boolean flag)
|
||||
{
|
||||
theLists.get(key).setUseForIngest(flag);
|
||||
}
|
||||
/**
|
||||
* a representation of a single keyword list created or loaded
|
||||
*/
|
||||
@ -473,43 +477,43 @@ public abstract class KeywordSearchListsAbstract {
|
||||
return hash;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Date getDateCreated() {
|
||||
Date getDateCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public Date getDateModified() {
|
||||
Date getDateModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public Boolean getUseForIngest() {
|
||||
Boolean getUseForIngest() {
|
||||
return useForIngest;
|
||||
}
|
||||
|
||||
public void setUseForIngest(boolean use) {
|
||||
void setUseForIngest(boolean use) {
|
||||
this.useForIngest = use;
|
||||
}
|
||||
|
||||
public Boolean getIngestMessages() {
|
||||
Boolean getIngestMessages() {
|
||||
return ingestMessages;
|
||||
}
|
||||
|
||||
public void setIngestMessages(boolean ingestMessages) {
|
||||
void setIngestMessages(boolean ingestMessages) {
|
||||
this.ingestMessages = ingestMessages;
|
||||
}
|
||||
|
||||
public List<Keyword> getKeywords() {
|
||||
List<Keyword> getKeywords() {
|
||||
return keywords;
|
||||
}
|
||||
|
||||
public boolean hasKeyword(Keyword keyword) {
|
||||
boolean hasKeyword(Keyword keyword) {
|
||||
return keywords.contains(keyword);
|
||||
}
|
||||
|
||||
public boolean hasKeyword(String keyword) {
|
||||
boolean hasKeyword(String keyword) {
|
||||
//note, this ignores isLiteral
|
||||
for (Keyword k : keywords) {
|
||||
if (k.getQuery().equals(keyword)) {
|
||||
@ -519,7 +523,7 @@ public abstract class KeywordSearchListsAbstract {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Boolean isLocked() {
|
||||
Boolean isLocked() {
|
||||
return locked;
|
||||
}
|
||||
}
|
||||
|
@ -213,8 +213,7 @@ public class RegressionTest extends TestCase{
|
||||
logger.info("Search Configure");
|
||||
JDialog jd = JDialogOperator.waitJDialog("Advanced Keyword Search Configuration", false, false);
|
||||
JDialogOperator jdo = new JDialogOperator(jd);
|
||||
KeywordSearchListsXML curr = KeywordSearchListsXML.getCurrent();
|
||||
curr.theLists.get("URLs").setUseForIngest(true);
|
||||
setListForIngest();
|
||||
String words = System.getProperty("keyword_path");
|
||||
JButtonOperator jbo0 = new JButtonOperator(jdo, "Import List", 0);
|
||||
jbo0.pushNoBlock();
|
||||
@ -325,34 +324,7 @@ public class RegressionTest extends TestCase{
|
||||
}
|
||||
private void setListForIngest()
|
||||
{
|
||||
try {
|
||||
Method getter = org.sleuthkit.autopsy.keywordsearch.KeywordSearchListsAbstract.class.getDeclaredMethod("getCurrent");
|
||||
KeywordSearchListsXML curr = (KeywordSearchListsXML)getter.invoke(null, null);
|
||||
Field lsts = org.sleuthkit.autopsy.keywordsearch.KeywordSearchListsAbstract.class.getDeclaredField("theLists");
|
||||
lsts.setAccessible(true);
|
||||
Map mplst = (Map)lsts.get(curr);
|
||||
Object aplr = mplst.get("URLs");
|
||||
Method[] setters = aplr.getClass().getDeclaredMethods();
|
||||
int i = -1;
|
||||
for(int x = 0; x < setters.length; x++)
|
||||
{
|
||||
if(setters[x].getName().equals("setUseForIngest"))
|
||||
i = x;
|
||||
}
|
||||
Method setter = setters[i];
|
||||
setter.invoke(aplr.getClass().cast(aplr), true);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (SecurityException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (InvocationTargetException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (NoSuchFieldException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
KeywordSearchListsXML curr = KeywordSearchListsXML.getCurrent();
|
||||
curr.setUseForIngest("URLs", true);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user