Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create plist parser plugins to read com.apple.MobileBackup.plist #4916

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rizabudi
Copy link

@rizabudi rizabudi commented Oct 16, 2024

One line description of pull request

Create plist parser plugins to read com.apple.MobileBackup.plist

Description:

Create plist parser plugins to read com.apple.MobileBackup.plist

Related issue (if applicable): fixes #

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:

  • Automated checks (GitHub Actions, AppVeyor) pass
  • No new new dependencies are required or l2tdevtools has been updated
  • Reviewer assigned

@rizabudi rizabudi changed the title Create plist parser plugins to read com.apple.MobileMBackup.plist Create plist parser plugins to read com.apple.MobileBackup.plist Oct 16, 2024
@joachimmetz joachimmetz self-assigned this Oct 16, 2024
@joachimmetz
Copy link
Member

Thanks for the suggested changes, I'll take a look later this week when time permits

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.07%. Comparing base (9869a61) to head (0daf932).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4916      +/-   ##
==========================================
+ Coverage   85.05%   85.07%   +0.01%     
==========================================
  Files         431      432       +1     
  Lines       38648    38684      +36     
==========================================
+ Hits        32873    32911      +38     
+ Misses       5775     5773       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@joachimmetz joachimmetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI left a couple of comments, some for educational purposes. Could you take a look at the questions regarding the meaning of some of the date and time values.

@@ -233,3 +233,12 @@ short_message:
- 'Message: {text}'
short_source: 'Twitter iOS'
source: 'Twitter iOS Status'
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the contents of this file in alphabetic order.

@@ -1795,3 +1795,9 @@ attribute_mappings:
- name: 'recorded_time'
description: 'Recorded Time'
place_holder_event: true
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the contents of this file in alphabetic order.


PLIST_KEYS = frozenset(['AccountEnabledDate','BackupStateInfo'])

def _getEventData(self, description, datetime_value):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method name does not align with style guide and missing docstring

for key, value in plist_key.items():
if key == "date":
parser_mediator.ProduceEventData(
self._getEventData("BackupStateInfo - date", value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation indentation does not align with style guide

match (Optional[dict[str: object]]): keys extracted from PLIST_KEYS.
"""

datetime_value = match.get('AccountEnabledDate', {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not produce 1 event data with the different date and time values?

event_data.activity_description = description
timestamp = datetime.datetime.timestamp(datetime_value)
timestamp = int(timestamp * definitions.NANOSECONDS_PER_SECOND)
event_data.activity_time = dfdatetime_posix_time.PosixTimeInNanoseconds(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use _GetDateTimeValueFromPlistKey ?

PLIST_PATH_FILTERS = frozenset([
interface.PlistPathFilter('com.apple.MobileBackup.plist')])

PLIST_KEYS = frozenset(['AccountEnabledDate','BackupStateInfo'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit: space missing after ,

)

plist_key = match.get('BackupStateInfo', {})
for key, value in plist_key.items():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why iterate all keys if you're only interested in 'date' and 'errors' keys ?

for key, value in plist_key.items():
if key == "date":
parser_mediator.ProduceEventData(
self._getEventData("BackupStateInfo - date", value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this date and time represent? Is this the creation date of the backup state info?

for val in value:
parser_mediator.ProduceEventData(
self._getEventData(
f"BackupStateInfo - {val['localizedDescription']}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the start or end time of the backup ?

@joachimmetz joachimmetz added the pending reporter input Issue is pending input from the reporter label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending reporter input Issue is pending input from the reporter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants