mirror of
https://github.com/mvt-project/mvt.git
synced 2026-02-12 16:42:45 +00:00
Adds androidqf files module (#541)
* Adds androidqf files module * Add new files module to module list --------- Co-authored-by: Donncha Ó Cearbhaill <donncha.ocearbhaill@amnesty.org>
This commit is contained in:
25
tests/android_androidqf/test_files.py
Normal file
25
tests/android_androidqf/test_files.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Mobile Verification Toolkit (MVT)
|
||||
# Copyright (c) 2021-2023 The MVT Authors.
|
||||
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||
# https://license.mvt.re/1.1/
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from mvt.android.modules.androidqf.files import Files
|
||||
from mvt.common.module import run_module
|
||||
|
||||
from ..utils import get_android_androidqf, list_files
|
||||
|
||||
|
||||
class TestAndroidqfFilesAnalysis:
|
||||
def test_androidqf_files(self):
|
||||
data_path = get_android_androidqf()
|
||||
m = Files(target_path=data_path, log=logging)
|
||||
files = list_files(data_path)
|
||||
parent_path = Path(data_path).absolute().parent.as_posix()
|
||||
m.from_folder(parent_path, files)
|
||||
run_module(m)
|
||||
assert len(m.results) == 3
|
||||
assert len(m.timeline) == 6
|
||||
assert len(m.detected) == 0
|
||||
1
tests/artifacts/androidqf/files.json
Normal file
1
tests/artifacts/androidqf/files.json
Normal file
@@ -0,0 +1 @@
|
||||
[{"path":"/sdcard/.profig.os","size":36,"mode":"-rw-rw----","user_id":0,"user_name":"","group_id":1015,"group_name":"","changed_time":1550155672,"modified_time":1593109532,"access_time":1593109532,"error":"","context":"u:object_r:sdcardfs:s0","sha1":"","sha256":"","sha512":"","md5":""},{"path":"/sdcard/Android/data/.nomedia","size":0,"mode":"-rw-rw----","user_id":0,"user_name":"","group_id":1015,"group_name":"","changed_time":1550155672,"modified_time":1588851245,"access_time":1588851245,"error":"","context":"u:object_r:sdcardfs:s0","sha1":"","sha256":"","sha512":"","md5":""},{"path":"/sdcard/Android/data/com.android.providers.media/albumthumbs/1588851275201","size":1343477,"mode":"-rw-rw----","user_id":10016,"user_name":"","group_id":1015,"group_name":"","changed_time":1550155672,"modified_time":1588851275,"access_time":1588851275,"error":"","context":"u:object_r:sdcardfs:s0","sha1":"","sha256":"","sha512":"","md5":""}]
|
||||
@@ -62,7 +62,7 @@ class TestHashes:
|
||||
def test_hash_from_folder(self):
|
||||
path = os.path.join(get_artifact_folder(), "androidqf")
|
||||
hashes = list(generate_hashes_from_path(path, logging))
|
||||
assert len(hashes) == 6
|
||||
assert len(hashes) == 7
|
||||
# Sort the files to have reliable order for tests.
|
||||
hashes = sorted(hashes, key=lambda x: x["file_path"])
|
||||
assert hashes[0]["file_path"] == os.path.join(path, "backup.ab")
|
||||
|
||||
Reference in New Issue
Block a user