Update prefetch recent activity#7989
Conversation
Program will parse prefetch and other artifacts so no need for multiple programs anymore for different artifacts. Programs will also support the following architectures, Windows, Macos and Linux for Intel platform and Macos and Raspberry Pi for Aarch platform.
Remove double __ in name
Add functions to check if the OS is macos or linux or
Add different os's and architectures to run prefetch module on.
Update JNA
change from macos to mac to determine if macos platform
remove line
Update comments
Update comment
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughTwo files are enhanced: Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PMD (7.23.0)RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractPrefetch.java[ERROR] Cannot load ruleset rulesets/java/basic.xml/SimplifiedTernary: Cannot resolve rule/ruleset reference 'rulesets/java/basic.xml/SimplifiedTernary'. Make sure the resource is a valid file or URL and is on the CLASSPATH. Use --debug (or a fine log level) to see the current classpath. Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java[ERROR] Cannot load ruleset rulesets/java/basic.xml/SimplifiedTernary: Cannot resolve rule/ruleset reference 'rulesets/java/basic.xml/SimplifiedTernary'. Make sure the resource is a valid file or URL and is on the CLASSPATH. Use --debug (or a fine log level) to see the current classpath. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractPrefetch.java (1)
223-249:⚠️ Potential issue | 🟠 MajorPotential NullPointerException if OS is unrecognized.
If none of the OS conditions match (e.g., an unexpected OS name or a BSD variant),
pathremainsnulland line 241 will throw aNullPointerExceptionwhen callingpath.toString().🐛 Proposed fix: Add null check before using path
} else if (PlatformUtil.isMacOS()) { if ("aarch64".equals(PlatformUtil.getOSArch())) { path = Paths.get(PREFETCH_TOOL_FOLDER, PREFETCH_TOOL_NAME_AARCH64_MACOS); } else { path = Paths.get(PREFETCH_TOOL_FOLDER, PREFETCH_TOOL_NAME_X64_MACOS); } } + + if (path == null) { + logger.log(Level.SEVERE, "Unsupported operating system: " + PlatformUtil.getOSName()); //NON-NLS + return null; + } + File prefetchToolFile = InstalledFileLocator.getDefault().locate(path.toString(), ExtractPrefetch.class.getPackage().getName(), false);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractPrefetch.java` around lines 223 - 249, getPathForPrefetchDumper currently can leave local variable path null for unrecognized OSes, causing a NullPointerException when calling path.toString() for InstalledFileLocator.locate; update getPathForPrefetchDumper to check if path is null before calling InstalledFileLocator.locate (e.g., return null or log an unsupported OS via process logger) and only call InstalledFileLocator.locate when path is non-null so the method safely handles unknown OS/arch combinations.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractPrefetch.java`:
- Around line 223-249: getPathForPrefetchDumper currently can leave local
variable path null for unrecognized OSes, causing a NullPointerException when
calling path.toString() for InstalledFileLocator.locate; update
getPathForPrefetchDumper to check if path is null before calling
InstalledFileLocator.locate (e.g., return null or log an unsupported OS via
process logger) and only call InstalledFileLocator.locate when path is non-null
so the method safely handles unknown OS/arch combinations.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7f5925f1-ed9c-4eac-91d6-579a0d388d91
⛔ Files ignored due to path filters (2)
thirdparty/markmckinnon/mm_artifact_parser_x64_win.exeis excluded by!**/*.exethirdparty/markmckinnon/parse_prefetch.exeis excluded by!**/*.exe
📒 Files selected for processing (7)
Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.javaRecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractPrefetch.javathirdparty/markmckinnon/mm_artifact_parser_aarch64_linuxthirdparty/markmckinnon/mm_artifact_parser_aarch64_macosthirdparty/markmckinnon/mm_artifact_parser_x64_linuxthirdparty/markmckinnon/mm_artifact_parser_x64_macosthirdparty/markmckinnon/parse_prefetch_linux
Update prefetch recent activity parser
Summary by CodeRabbit