mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Fixed codacy issues
This commit is contained in:
parent
95ea5adb0a
commit
1b4a70bdec
@ -67,8 +67,6 @@ import static java.util.TimeZone.getTimeZone;
|
|||||||
import org.openide.util.Lookup;
|
import org.openide.util.Lookup;
|
||||||
import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress;
|
import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException;
|
import org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestServices;
|
|
||||||
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
|
|
||||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
|
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
@ -876,7 +874,7 @@ class ExtractRegistry extends Extract {
|
|||||||
String userInfoSection = "User Information";
|
String userInfoSection = "User Information";
|
||||||
String previousLine = null;
|
String previousLine = null;
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
Set<HashMap<String, String>> userSet = new HashSet<>();
|
Set<Map<String, String>> userSet = new HashSet<>();
|
||||||
Map<String, List<String>> groupMap = null;
|
Map<String, List<String>> groupMap = null;
|
||||||
while (line != null) {
|
while (line != null) {
|
||||||
if (line.contains(SECTION_DIVIDER) && previousLine != null && previousLine.contains(userInfoSection)) {
|
if (line.contains(SECTION_DIVIDER) && previousLine != null && previousLine.contains(userInfoSection)) {
|
||||||
@ -890,9 +888,9 @@ class ExtractRegistry extends Extract {
|
|||||||
previousLine = line;
|
previousLine = line;
|
||||||
line = bufferedReader.readLine();
|
line = bufferedReader.readLine();
|
||||||
}
|
}
|
||||||
Map<String, HashMap<String, String>> userInfoMap = new HashMap<>();
|
Map<String, Map<String, String>> userInfoMap = new HashMap<>();
|
||||||
//load all the user info which was read into a map
|
//load all the user info which was read into a map
|
||||||
for (HashMap<String, String> userInfo : userSet) {
|
for (Map<String, String> userInfo : userSet) {
|
||||||
userInfoMap.put(userInfo.get(SID_KEY), userInfo);
|
userInfoMap.put(userInfo.get(SID_KEY), userInfo);
|
||||||
}
|
}
|
||||||
//get all existing OS account artifacts
|
//get all existing OS account artifacts
|
||||||
@ -903,7 +901,7 @@ class ExtractRegistry extends Extract {
|
|||||||
BlackboardAttribute existingUserId = osAccount.getAttribute(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_USER_ID));
|
BlackboardAttribute existingUserId = osAccount.getAttribute(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_USER_ID));
|
||||||
if (existingUserId != null) {
|
if (existingUserId != null) {
|
||||||
String userID = existingUserId.getValueString().trim();
|
String userID = existingUserId.getValueString().trim();
|
||||||
HashMap<String, String> userInfo = userInfoMap.remove(userID);
|
Map<String, String> userInfo = userInfoMap.remove(userID);
|
||||||
//if the existing user id matches a user id which we parsed information for check if that information exists and if it doesn't add it
|
//if the existing user id matches a user id which we parsed information for check if that information exists and if it doesn't add it
|
||||||
if (userInfo != null) {
|
if (userInfo != null) {
|
||||||
osAccount.addAttributes(getAttributesForAccount(userInfo, groupMap.get(userID), true));
|
osAccount.addAttributes(getAttributesForAccount(userInfo, groupMap.get(userID), true));
|
||||||
@ -912,7 +910,7 @@ class ExtractRegistry extends Extract {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//add remaining userinfos as accounts;
|
//add remaining userinfos as accounts;
|
||||||
for (HashMap<String, String> userInfo : userInfoMap.values()) {
|
for (Map<String, String> userInfo : userInfoMap.values()) {
|
||||||
BlackboardArtifact bbart = regAbstractFile.newArtifact(ARTIFACT_TYPE.TSK_OS_ACCOUNT);
|
BlackboardArtifact bbart = regAbstractFile.newArtifact(ARTIFACT_TYPE.TSK_OS_ACCOUNT);
|
||||||
bbart.addAttributes(getAttributesForAccount(userInfo, groupMap.get(userInfo.get(SID_KEY)), false));
|
bbart.addAttributes(getAttributesForAccount(userInfo, groupMap.get(userInfo.get(SID_KEY)), false));
|
||||||
// index the artifact for keyword search
|
// index the artifact for keyword search
|
||||||
@ -943,7 +941,7 @@ class ExtractRegistry extends Extract {
|
|||||||
*
|
*
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
Collection<BlackboardAttribute> getAttributesForAccount(HashMap<String, String> userInfo, List<String> groupList, boolean existingUser) throws ParseException {
|
Collection<BlackboardAttribute> getAttributesForAccount(Map<String, String> userInfo, List<String> groupList, boolean existingUser) throws ParseException {
|
||||||
Collection<BlackboardAttribute> bbattributes = new ArrayList<>();
|
Collection<BlackboardAttribute> bbattributes = new ArrayList<>();
|
||||||
|
|
||||||
SimpleDateFormat regRipperTimeFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy 'Z'");
|
SimpleDateFormat regRipperTimeFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy 'Z'");
|
||||||
@ -1062,8 +1060,8 @@ class ExtractRegistry extends Extract {
|
|||||||
getRAModuleName(), settingString));
|
getRAModuleName(), settingString));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupList != null && groupList.size() > 0) {
|
if (groupList != null && groupList.isEmpty()) {
|
||||||
String groups = new String();
|
String groups = "";
|
||||||
for (String group : groupList) {
|
for (String group : groupList) {
|
||||||
groups += group + ", ";
|
groups += group + ", ";
|
||||||
}
|
}
|
||||||
@ -1086,7 +1084,7 @@ class ExtractRegistry extends Extract {
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void readUsers(BufferedReader bufferedReader, Set<HashMap<String, String>> users) throws IOException {
|
private void readUsers(BufferedReader bufferedReader, Set<Map<String, String>> users) throws IOException {
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
//read until end of file or next section divider
|
//read until end of file or next section divider
|
||||||
String userName = "";
|
String userName = "";
|
||||||
@ -1131,7 +1129,7 @@ class ExtractRegistry extends Extract {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
Map<String, List<String>> readGroups(BufferedReader bufferedReader) throws IOException {
|
Map<String, List<String>> readGroups(BufferedReader bufferedReader) throws IOException {
|
||||||
HashMap<String, List<String>> groupMap = new HashMap<>();
|
Map<String, List<String>> groupMap = new HashMap<>();
|
||||||
|
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
|
||||||
@ -1193,8 +1191,6 @@ class ExtractRegistry extends Extract {
|
|||||||
value = "";
|
value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AbstractMap.SimpleEntry<>(key, value);
|
|
||||||
|
|
||||||
} else if (line.contains("-->")) {
|
} else if (line.contains("-->")) {
|
||||||
key = line.replace("-->", "").trim();
|
key = line.replace("-->", "").trim();
|
||||||
value = "true";
|
value = "true";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user