Added iOS Health SQLite (healthdb_secure.sqlite) plugin - #5027
Conversation
|
Thanks for the changes, unfortunately "Digital Corpora" is public domain. For context see https://opensource.org/blog/public-domain-is-not-open-source |
|
@annisadp can you rebase this PR with current HEAD and replace the test files with ones that are compatible with the Plaso license? |
joachimmetz
left a comment
There was a problem hiding this comment.
pending questions/comments
|
rebased with HEAD |
|
Looked into it a bit closer, we likely can use the test files, but they require a mention in the acknowledgement |
| """Tests the Process function on a healthdb_secure.sqlite file.""" | ||
| plugin = ios_health_all_watch_sleep.IOSHealthAllWatchSleepPlugin() | ||
| storage_writer = self._ParseDatabaseFileWithPlugin( | ||
| ['healthdb_secure.sqlite'], plugin) |
There was a problem hiding this comment.
this file does not exist, I assume this is healthdb_secure_iOS_13_3_1.sqlite ?
| from plaso.parsers.sqlite_plugins import ios_health_watch_by_sleep_period_latest | ||
| from plaso.parsers.sqlite_plugins import ios_health_watch_by_sleep_period | ||
| from plaso.parsers.sqlite_plugins import ios_health_watch_worn_data | ||
| from plaso.parsers.sqlite_plugins import ios_health_workout_latest |
There was a problem hiding this comment.
s missing, should be ios_health_workouts_latest
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() | ||
|
No newline at end of file |
|
Given these appear to be different plugins for the same database, they should be merged into 1 plugin that creates different events |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5027 +/- ##
==========================================
+ Coverage 85.16% 85.18% +0.01%
==========================================
Files 456 462 +6
Lines 40682 41073 +391
==========================================
+ Hits 34646 34986 +340
- Misses 6036 6087 +51 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0082ef0 to
d62240f
Compare
| QUERIES = [ | ||
| ( | ||
| ( | ||
| "WITH surface_temp AS (SELECT mv.object_id, mv.numerical_value " |
There was a problem hiding this comment.
both surface_temp and alg_ver return NULL values, is this query WAI?
| return None | ||
| text = str(value).replace("\xa0", " ").strip() | ||
| try: | ||
| fixed = text.encode("latin-1", errors="ignore").decode( |
There was a problem hiding this comment.
this is not transparant to the user and therefore debatable if forensically sound.
There was a problem hiding this comment.
| seconds = total % 60 | ||
| return f"{hours:02d}:{minutes:02d}:{seconds:02d}" | ||
|
|
||
| def _DistanceToKmMiles(self, total_distance): |
There was a problem hiding this comment.
Why not add this as an output formatter?
|
|
||
| if duration_seconds is not None: | ||
| try: | ||
| event_data.duration_in_minutes = float(duration_seconds) / 60.0 |
| QUERIES = [ | ||
| ( | ||
| ( | ||
| "WITH TimeData AS (SELECT s.start_date AS start_cocoa, s.end_date AS " |
There was a problem hiding this comment.
Why not do this in an analysis plugin?
| except (TypeError, ValueError): | ||
| code = None | ||
|
|
||
| if code not in (2, 3, 4, 5): |
There was a problem hiding this comment.
this is not transparent to the user or the reviewer. What is the reason for skipping these codes?
|
Heads up I'm splitting this PR, breaking out #5149 what has been refactored so far. There is more work needed on the remainder in this PR |
The parser created consists of achievements, all watch sleep, headphone audio levels, heart rate, height, resting heart rate, steps, source devices, all watch by sleep period, watch worn, weight, workouts and wrist temperature
| @@ -0,0 +1,129 @@ | |||
| """SQLite parser plugin for iOS Health - All Watch Sleep Data (iOS 17).""" | |||
There was a problem hiding this comment.
Note to self, this is basically the same as ios_health._ParseAllWatchSleepSample with the exception of filtering on several category values
| self.manufacturer = None | ||
| self.model = None | ||
| self.software = None | ||
| self.sync_identity = None |
There was a problem hiding this comment.
Note to self: Only major difference to IOSHealthSourceDevicesEventData is sync_identity, which does not seem to be in previous versions of the database schema
|
|
||
| QUERIES = [ | ||
| ( | ||
| ( |
There was a problem hiding this comment.
given this also uses sample type 63 as input should this be an analysis plugin?
The parser created consists of achievements, all watch sleep latest, all watch sleep, headphone audio levels, heart rate, height, resting heart rate, steps, source devices latest, source devices, watch by sleep period latest, watch by sleep period, watch worn data, weight, workouts latest, workouts and wrist temperature
One line description of pull request
Adds 17 new SQLite plugins for extracting iOS Health artifacts (iOS 13.3.1, iOS 13.4.1, iOS 15, iOS 16, iOS 17). Includes unit tests, formatters, ios.yaml and SQLite database
Description:
Plugins including:
plaso/plaso/parsers/sqlite plugins/ios_health_achievements.py
plaso/plaso/parsers/sqlite plugins/ios_health_all_watch_sleep_latest.py
plaso/plaso/parsers/sqlite plugins/ios_health_all_watch_sleep.py
plaso/plaso/parsers/sqlite plugins/ios_health_headphone_audio_levels.py
plaso/plaso/parsers/sqlite plugins/ios_health_heart_rate.py
plaso/plaso/parsers/sqlite plugins/ios_health_height.py
plaso/plaso/parsers/sqlite plugins/ios_health_resting_heart_rate.py
plaso/plaso/parsers/sqlite plugins/ios_health_steps.py
plaso/plaso/parsers/sqlite plugins/ios_health_source_devices_latest.py
plaso/plaso/parsers/sqlite plugins/ios_health_source_devices.py
plaso/plaso/parsers/sqlite plugins/ios_health_watch_by_sleep_period_latest.py
plaso/plaso/parsers/sqlite plugins/ios_health_watch_by_sleep_period.py
plaso/plaso/parsers/sqlite plugins/ios_health_watch_worn.py
plaso/plaso/parsers/sqlite plugins/ios_health_weight.py
plaso/plaso/parsers/sqlite plugins/ios_health_workout_latest.py
plaso/plaso/parsers/sqlite plugins/ios_health_workouts.py
plaso/plaso/parsers/sqlite plugins/ios_health_wrist_temperature.py
Unit Test including:
plaso/ test /parsers/sqlite plugins/ios_health_achievements.py
plaso/ test /parsers/sqlite plugins/ios_health_all_watch_sleep_latest.py
plaso/ test /parsers/sqlite plugins/ios_health_all_watch_sleep.py
plaso/ test /parsers/sqlite plugins/ios_health_headphone_audio_levels.py
plaso/ test /parsers/sqlite plugins/ios_health_heart_rate.py
plaso/ test /parsers/sqlite plugins/ios_health_height.py
plaso/ test /parsers/sqlite plugins/ios_health_resting_heart_rate.py
plaso/ test /parsers/sqlite plugins/ios_health_steps.py
plaso/ test /parsers/sqlite plugins/ios_health_source_devices_latest.py
plaso/ test /parsers/sqlite plugins/ios_health_source_devices.py
plaso/ test /parsers/sqlite plugins/ios_health_watch_by_sleep_period_latest.py
plaso/ test /parsers/sqlite plugins/ios_health_ watch_by_sleep_period.py
plaso/ test /parsers/sqlite plugins/ios_health_watch_worn.py
plaso/ test /parsers/sqlite plugins/ios_health_weight.py
plaso/ test /parsers/sqlite plugins/ios_health_workout_latest.py
plaso/ test /parsers/sqlite plugins/ios_health_workouts.py
plaso/ test /parsers/sqlite plugins/ios_health_wrist_temperature.py
SQLite database froom Digital Corpora places on plaso/test_data/:
healthdb_secure_iOS_13_3_1.sqlite
healthdb_secure_iOS_13_4_1.sqlite
healthdb_secure_iOS_15.sqlite
healthdb_secure_iOS_16.sqlite
healthdb_secure_iOS_17.sqlite
Notes:
All contributions to Plaso undergo code review.
This makes sure that the code has appropriate test coverage and conforms to the
Plaso style guide.
One of the maintainers will examine your code, and may request changes. Check off the items below in
order, and then a maintainer will review your code.
Checklist: