mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
keyword search - change attribute ordering, cleanup escaping (now done in BB), do not write selector attribute (should go to gen info)
This commit is contained in:
parent
dd6222da75
commit
8f101145e2
@ -131,10 +131,7 @@ public class KeywordSearchUtil {
|
||||
//TODO escaping should be handled by blackboard
|
||||
public static String escapeForBlackBoard(String text) {
|
||||
try {
|
||||
//text = text.replaceAll("\\\\'", URLEncoder.encode("\\'", "UTF-8"));
|
||||
text = text.replaceAll("'", URLEncoder.encode("'", "UTF-8"));
|
||||
//text = text.replaceAll("\"", URLEncoder.encode("\"", "UTF-8"));
|
||||
//text = text.replaceAll("\\\\", URLEncoder.encode("\\", "UTF-8"));
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
}
|
||||
return text;
|
||||
|
@ -195,12 +195,9 @@ public class TermComponentQuery implements KeywordSearchQuery {
|
||||
continue;
|
||||
}
|
||||
|
||||
//regex keyword, escape and store
|
||||
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID(), MODULE_NAME, "", KeywordSearchUtil.escapeForBlackBoard(termsQuery)));
|
||||
|
||||
//regex match
|
||||
final String regexMatchEscaped = KeywordSearchUtil.escapeForBlackBoard(regexMatch);
|
||||
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID(), MODULE_NAME, "", regexMatchEscaped));
|
||||
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID(), MODULE_NAME, "", regexMatch));
|
||||
//list
|
||||
if (listName == null) {
|
||||
listName = "";
|
||||
@ -208,17 +205,20 @@ public class TermComponentQuery implements KeywordSearchQuery {
|
||||
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_SET.getTypeID(), MODULE_NAME, "", listName));
|
||||
|
||||
//preview
|
||||
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID(), MODULE_NAME, "", KeywordSearchUtil.escapeForBlackBoard(snippet)));
|
||||
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID(), MODULE_NAME, "", snippet));
|
||||
|
||||
//regex keyword
|
||||
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID(), MODULE_NAME, "", termsQuery));
|
||||
|
||||
//selector
|
||||
//selector TODO move to general info artifact
|
||||
/*
|
||||
if (keywordQuery != null) {
|
||||
BlackboardAttribute.ATTRIBUTE_TYPE selType = keywordQuery.getType();
|
||||
if (selType != null) {
|
||||
BlackboardAttribute selAttr = new BlackboardAttribute(selType.getTypeID(), MODULE_NAME, "", regexMatchEscaped);
|
||||
BlackboardAttribute selAttr = new BlackboardAttribute(selType.getTypeID(), MODULE_NAME, "", regexMatch);
|
||||
attributes.add(selAttr);
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
try {
|
||||
bba.addAttributes(attributes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user