mirror of
https://github.com/mvt-project/mvt.git
synced 2026-08-17 16:37:23 +02:00
Improves code PEP8 compliance and adds ruff check
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
name: Ruff
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ruff_py3:
|
||||||
|
name: Ruff syntax check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
architecture: x64
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: |
|
||||||
|
pip install ruff
|
||||||
|
- name: ruff
|
||||||
|
run: |
|
||||||
|
ruff check .
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
PWD = $(shell pwd)
|
PWD = $(shell pwd)
|
||||||
|
|
||||||
|
check:
|
||||||
|
flake8
|
||||||
|
pytest -q
|
||||||
|
ruff check -q .
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(PWD)/build $(PWD)/dist $(PWD)/mvt.egg-info
|
rm -rf $(PWD)/build $(PWD)/dist $(PWD)/mvt.egg-info
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -9,10 +9,9 @@ import click
|
|||||||
from rich.logging import RichHandler
|
from rich.logging import RichHandler
|
||||||
|
|
||||||
from mvt.common.cmd_check_iocs import CmdCheckIOCS
|
from mvt.common.cmd_check_iocs import CmdCheckIOCS
|
||||||
from mvt.common.help import (HELP_MSG_FAST, HELP_MSG_IOC,
|
from mvt.common.help import (HELP_MSG_FAST, HELP_MSG_HASHES, HELP_MSG_IOC,
|
||||||
HELP_MSG_LIST_MODULES, HELP_MSG_MODULE,
|
HELP_MSG_LIST_MODULES, HELP_MSG_MODULE,
|
||||||
HELP_MSG_OUTPUT, HELP_MSG_SERIAL,
|
HELP_MSG_OUTPUT, HELP_MSG_SERIAL)
|
||||||
HELP_MSG_HASHES)
|
|
||||||
from mvt.common.logo import logo
|
from mvt.common.logo import logo
|
||||||
from mvt.common.updates import IndicatorsUpdates
|
from mvt.common.updates import IndicatorsUpdates
|
||||||
|
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable, Optional, List
|
from typing import List, Optional
|
||||||
|
|
||||||
from rich.prompt import Prompt
|
from rich.prompt import Prompt
|
||||||
|
|
||||||
|
from mvt.android.modules.backup.base import BackupExtraction
|
||||||
from mvt.android.parsers.backup import (AndroidBackupParsingError,
|
from mvt.android.parsers.backup import (AndroidBackupParsingError,
|
||||||
InvalidBackupPassword, parse_ab_header,
|
InvalidBackupPassword, parse_ab_header,
|
||||||
parse_backup_file)
|
parse_backup_file)
|
||||||
from mvt.common.command import Command
|
from mvt.common.command import Command
|
||||||
from mvt.android.modules.backup.base import BackupExtraction
|
|
||||||
|
|
||||||
from .modules.backup import BACKUP_MODULES
|
from .modules.backup import BACKUP_MODULES
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable, Optional, List
|
from typing import List, Optional
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
from mvt.common.command import Command
|
|
||||||
from mvt.android.modules.bugreport.base import BugReportModule
|
from mvt.android.modules.bugreport.base import BugReportModule
|
||||||
|
from mvt.common.command import Command
|
||||||
|
|
||||||
from .modules.bugreport import BUGREPORT_MODULES
|
from .modules.bugreport import BUGREPORT_MODULES
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional, Union, List
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.progress import track
|
from rich.progress import track
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import fnmatch
|
import fnmatch
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import Union, List, Dict, Any, Optional
|
from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
||||||
from mvt.common.module import MVTModule
|
from mvt.common.module import MVTModule
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,12 @@
|
|||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from typing import Any, Dict, List, Optional, Union
|
||||||
from typing import Optional, Union, List, Any, Dict
|
|
||||||
|
|
||||||
from mvt.android.modules.adb.packages import (DANGEROUS_PERMISSIONS,
|
from mvt.android.modules.adb.packages import (DANGEROUS_PERMISSIONS,
|
||||||
DANGEROUS_PERMISSIONS_THRESHOLD,
|
DANGEROUS_PERMISSIONS_THRESHOLD,
|
||||||
ROOT_PACKAGES)
|
ROOT_PACKAGES)
|
||||||
from mvt.android.parsers.dumpsys import parse_dumpsys_packages
|
from mvt.android.parsers.dumpsys import parse_dumpsys_packages
|
||||||
from mvt.common.utils import convert_datetime_to_iso
|
|
||||||
|
|
||||||
from .base import AndroidQFModule
|
from .base import AndroidQFModule
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional, List, Dict, Union, Any
|
from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
||||||
from mvt.android.modules.adb.dumpsys_receivers import (
|
from mvt.android.modules.adb.dumpsys_receivers import (
|
||||||
INTENT_DATA_SMS_RECEIVED, INTENT_NEW_OUTGOING_CALL,
|
INTENT_DATA_SMS_RECEIVED, INTENT_NEW_OUTGOING_CALL,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Mobile Verification Toolkit (MVT) - Private
|
# Mobile Verification Toolkit (MVT)
|
||||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||||
# This file is part of MVT Private and its content is confidential.
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# Please refer to the project maintainers before sharing with others.
|
# https://license.mvt.re/1.1
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import fnmatch
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from tarfile import TarFile
|
from tarfile import TarFile
|
||||||
from typing import Optional, List
|
from typing import List, Optional
|
||||||
|
|
||||||
from mvt.common.module import MVTModule
|
from mvt.common.module import MVTModule
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import fnmatch
|
import fnmatch
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import Optional, List
|
from typing import List, Optional
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
from mvt.common.module import MVTModule
|
from mvt.common.module import MVTModule
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from typing import List, Dict, Any
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from mvt.common.utils import convert_datetime_to_iso
|
from mvt.common.utils import convert_datetime_to_iso
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,18 @@
|
|||||||
# Use of this software is governed by the MVT License 1.1 that can be found at
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import hashlib
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Callable, Optional
|
from typing import Optional
|
||||||
|
|
||||||
from mvt.common.indicators import Indicators
|
from mvt.common.indicators import Indicators
|
||||||
from mvt.common.module import run_module, save_timeline, MVTModule
|
from mvt.common.module import MVTModule, run_module, save_timeline
|
||||||
from mvt.common.utils import convert_datetime_to_iso, generate_hashes_from_path, get_sha256_from_file_path
|
from mvt.common.utils import (convert_datetime_to_iso,
|
||||||
|
generate_hashes_from_path,
|
||||||
|
get_sha256_from_file_path)
|
||||||
from mvt.common.version import MVT_VERSION
|
from mvt.common.version import MVT_VERSION
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import csv
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from typing import Callable, Optional, Union, List, Any, Dict
|
from typing import Any, Callable, Dict, List, Optional, Union
|
||||||
|
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,11 +3,11 @@
|
|||||||
# Use of this software is governed by the MVT License 1.1 that can be found at
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import os
|
|
||||||
import datetime
|
import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
from typing import Union, Iterator
|
from typing import Iterator, Union
|
||||||
|
|
||||||
|
|
||||||
def convert_chrometime_to_datetime(timestamp: int) -> datetime.datetime:
|
def convert_chrometime_to_datetime(timestamp: int) -> datetime.datetime:
|
||||||
|
|||||||
+3
-3
@@ -3,18 +3,18 @@
|
|||||||
# Use of this software is governed by the MVT License 1.1 that can be found at
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import json
|
|
||||||
|
|
||||||
import click
|
import click
|
||||||
from rich.logging import RichHandler
|
from rich.logging import RichHandler
|
||||||
from rich.prompt import Prompt
|
from rich.prompt import Prompt
|
||||||
|
|
||||||
from mvt.common.cmd_check_iocs import CmdCheckIOCS
|
from mvt.common.cmd_check_iocs import CmdCheckIOCS
|
||||||
from mvt.common.help import (HELP_MSG_FAST, HELP_MSG_IOC,
|
from mvt.common.help import (HELP_MSG_FAST, HELP_MSG_HASHES, HELP_MSG_IOC,
|
||||||
HELP_MSG_LIST_MODULES, HELP_MSG_MODULE,
|
HELP_MSG_LIST_MODULES, HELP_MSG_MODULE,
|
||||||
HELP_MSG_OUTPUT, HELP_MSG_HASHES)
|
HELP_MSG_OUTPUT)
|
||||||
from mvt.common.logo import logo
|
from mvt.common.logo import logo
|
||||||
from mvt.common.options import MutuallyExclusiveOption
|
from mvt.common.options import MutuallyExclusiveOption
|
||||||
from mvt.common.updates import IndicatorsUpdates
|
from mvt.common.updates import IndicatorsUpdates
|
||||||
|
|||||||
+1
-2
@@ -2,9 +2,8 @@
|
|||||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||||
# Use of this software is governed by the MVT License 1.1 that can be found at
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
from typing import Dict
|
|
||||||
from logging import Logger
|
from logging import Logger
|
||||||
from typing import Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
import packaging
|
import packaging
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Never enforce `E501` (line length violations).
|
||||||
|
ignore = ["E501"]
|
||||||
|
|
||||||
|
# Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`.
|
||||||
|
[per-file-ignores]
|
||||||
|
"__init__.py" = ["F401"]
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
# Mobile Verification Toolkit (MVT) - Private
|
# Mobile Verification Toolkit (MVT)
|
||||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||||
# This file is part of MVT Private and its content is confidential.
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# Please refer to the project maintainers before sharing with others.
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from mvt.android.modules.androidqf.dumpsys_accessibility import \
|
from mvt.android.modules.androidqf.dumpsys_accessibility import \
|
||||||
DumpsysAccessibility
|
DumpsysAccessibility
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
# Mobile Verification Toolkit (MVT) - Private
|
# Mobile Verification Toolkit (MVT)
|
||||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||||
# This file is part of MVT Private and its content is confidential.
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# Please refer to the project maintainers before sharing with others.
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from mvt.android.modules.androidqf.dumpsys_appops import DumpsysAppops
|
from mvt.android.modules.androidqf.dumpsys_appops import DumpsysAppops
|
||||||
from mvt.common.module import run_module
|
from mvt.common.module import run_module
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Mobile Verification Toolkit (MVT) - Private
|
# Mobile Verification Toolkit (MVT)
|
||||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||||
# This file is part of MVT Private and its content is confidential.
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# Please refer to the project maintainers before sharing with others.
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
# Mobile Verification Toolkit (MVT) - Private
|
# Mobile Verification Toolkit (MVT)
|
||||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||||
# This file is part of MVT Private and its content is confidential.
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# Please refer to the project maintainers before sharing with others.
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from mvt.android.modules.androidqf.dumpsys_receivers import DumpsysReceivers
|
from mvt.android.modules.androidqf.dumpsys_receivers import DumpsysReceivers
|
||||||
from mvt.common.module import run_module
|
from mvt.common.module import run_module
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Mobile Verification Toolkit (MVT) - Private
|
# Mobile Verification Toolkit (MVT)
|
||||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||||
# This file is part of MVT Private and its content is confidential.
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# Please refer to the project maintainers before sharing with others.
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
from mvt.android.modules.androidqf.settings import Settings
|
from mvt.android.modules.androidqf.settings import Settings
|
||||||
from mvt.common.module import run_module
|
from mvt.common.module import run_module
|
||||||
|
|||||||
@@ -3,15 +3,17 @@
|
|||||||
# Use of this software is governed by the MVT License 1.1 that can be found at
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
from ..utils import get_artifact_folder
|
import os
|
||||||
|
|
||||||
from mvt.common.utils import (convert_datetime_to_iso, convert_mactime_to_iso,
|
from mvt.common.utils import (convert_datetime_to_iso, convert_mactime_to_iso,
|
||||||
convert_unix_to_iso,
|
convert_unix_to_iso,
|
||||||
convert_unix_to_utc_datetime,
|
convert_unix_to_utc_datetime,
|
||||||
generate_hashes_from_path,
|
generate_hashes_from_path,
|
||||||
get_sha256_from_file_path)
|
get_sha256_from_file_path)
|
||||||
|
|
||||||
|
from ..utils import get_artifact_folder
|
||||||
|
|
||||||
TEST_DATE_EPOCH = 1626566400
|
TEST_DATE_EPOCH = 1626566400
|
||||||
TEST_DATE_ISO = "2021-07-18 00:00:00.000000"
|
TEST_DATE_ISO = "2021-07-18 00:00:00.000000"
|
||||||
TEST_DATE_MAC = TEST_DATE_EPOCH - 978307200
|
TEST_DATE_MAC = TEST_DATE_EPOCH - 978307200
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
# Use of this software is governed by the MVT License 1.1 that can be found at
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||||
# https://license.mvt.re/1.1/
|
# https://license.mvt.re/1.1/
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from mvt.common.indicators import Indicators
|
|
||||||
from mvt.common.module import run_module
|
from mvt.common.module import run_module
|
||||||
from mvt.ios.modules.mixed.webkit_resource_load_statistics import \
|
from mvt.ios.modules.mixed.webkit_resource_load_statistics import \
|
||||||
WebkitResourceLoadStatistics
|
WebkitResourceLoadStatistics
|
||||||
|
|||||||
Reference in New Issue
Block a user