Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/mvt/android/cmd_download_apks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
import logging
import os
from typing import Callable, Optional
from typing import Callable, Optional, Union

from rich.progress import track

Expand Down Expand Up @@ -52,7 +52,9 @@ def from_json(cls, json_path: str) -> Callable:
packages = json.load(handle)
return cls(packages=packages)

def pull_package_file(self, package_name: str, remote_path: str) -> None:
def pull_package_file(
self, package_name: str, remote_path: str
) -> Union[str, None]:
"""Pull files related to specific package from the device.

:param package_name: Name of the package to download
Expand Down
1 change: 1 addition & 0 deletions src/mvt/android/modules/androidqf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(
log=log,
results=results,
)
self.parent_path = None
self._path: str = target_path
self.files: List[str] = []
self.archive: Optional[zipfile.ZipFile] = None
Expand Down
2 changes: 0 additions & 2 deletions src/mvt/android/modules/bugreport/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,3 @@ def _get_dumpstate_file(self) -> bytes:
return None

return self._get_file_content(dumpstate_logs[0])

return None
6 changes: 3 additions & 3 deletions src/mvt/common/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_latest_check(self) -> int:
return 0

def set_latest_check(self) -> None:
timestamp = int(datetime.utcnow().timestamp())
timestamp = int(datetime.now().timestamp())
with open(self.latest_check_path, "w", encoding="utf-8") as handle:
handle.write(str(timestamp))

Expand All @@ -80,7 +80,7 @@ def get_latest_update(self) -> int:
return 0

def set_latest_update(self) -> None:
timestamp = int(datetime.utcnow().timestamp())
timestamp = int(datetime.now().timestamp())
with open(self.latest_update_path, "w", encoding="utf-8") as handle:
handle.write(str(timestamp))

Expand Down Expand Up @@ -195,7 +195,7 @@ def _get_remote_file_latest_commit(
return latest_commit_ts

def should_check(self) -> Tuple[bool, int]:
now = datetime.utcnow()
now = datetime.now()
latest_check_ts = self.get_latest_check()
latest_check_dt = datetime.fromtimestamp(latest_check_ts)

Expand Down
4 changes: 0 additions & 4 deletions src/mvt/common/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,6 @@ def __init__(self, url: str) -> None:
def get_domain(self) -> str:
"""Get the domain from a URL.

:param url: URL to parse
:type url: str
:returns: Domain name extracted from URL
:rtype: str

Expand All @@ -349,8 +347,6 @@ def get_domain(self) -> str:
def get_top_level(self) -> str:
"""Get only the top-level domain from a URL.

:param url: URL to parse
:type url: str
:returns: Top-level domain name extracted from URL
:rtype: str

Expand Down
6 changes: 3 additions & 3 deletions src/mvt/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def convert_chrometime_to_datetime(timestamp: int) -> datetime.datetime:
def convert_datetime_to_iso(date_time: datetime.datetime) -> str:
"""Converts datetime to ISO string.

:param datetime: datetime, naive or timezone aware
:type datetime: datetime.datetime
:param date_time: datetime, naive or timezone aware
:type date_time: datetime.datetime
:returns: ISO datetime string in YYYY-mm-dd HH:MM:SS.ms format.
:rtype: str

Expand All @@ -78,7 +78,7 @@ def convert_unix_to_utc_datetime(
:returns: datetime.

"""
return datetime.datetime.utcfromtimestamp(float(timestamp))
return datetime.datetime.fromtimestamp(float(timestamp), tz=datetime.timezone.utc)


def convert_unix_to_iso(timestamp: Union[int, float, str]) -> str:
Expand Down
8 changes: 5 additions & 3 deletions src/mvt/ios/modules/backup/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ def serialize(self, record: dict) -> []:
if "modified" not in record or "status_changed" not in record:
return records

for timestamp in set(
[record["created"], record["modified"], record["status_changed"]]
):
for timestamp in {
record["created"],
record["modified"],
record["status_changed"],
}:
macb = ""
macb += "M" if timestamp == record["modified"] else "-"
macb += "-"
Expand Down
3 changes: 1 addition & 2 deletions src/mvt/ios/modules/fs/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ def _extract_analytics_data(self):
data["isodate"] = isodate
elif row[0]:
isodate = convert_mactime_to_iso(row[0], False)
data = {}
data["isodate"] = isodate
data = {"isodate": isodate}
elif row[1]:
isodate = ""
data = plistlib.loads(row[1])
Expand Down
7 changes: 4 additions & 3 deletions src/mvt/ios/modules/mixed/shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ def run(self) -> None:
action_data = plistlib.load(io.BytesIO(shortcut.pop("action_data", [])))
actions = []
for action_entry in action_data:
action = {}
action["identifier"] = action_entry["WFWorkflowActionIdentifier"]
action["parameters"] = action_entry["WFWorkflowActionParameters"]
action = {
"identifier": action_entry["WFWorkflowActionIdentifier"],
"parameters": action_entry["WFWorkflowActionParameters"],
}

# URLs might be in multiple fields, do a simple regex search
# across the parameters.
Expand Down
Loading