Unverified Commit f35022e1 by René Helmke Committed by GitHub

Merge pull request #20 from fkie-cad/android-simg

Android simg
parents 2676af3e c446ea3b
[flake8]
extend-ignore = E501,W503
extend-select = E504
exclude =
.git,
__pycache__
......@@ -2,7 +2,7 @@ default_stages: [commit, push]
exclude: ^src/bin/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
rev: v4.0.1
hooks:
- id: check-added-large-files
args: [--maxkb=10000]
......@@ -13,6 +13,8 @@ repos:
- id: check-yaml
- id: double-quote-string-fixer
- id: end-of-file-fixer
types: [python]
......@@ -20,10 +22,7 @@ repos:
args: [--remove]
- id: file-contents-sorter
files: src/unpacker/passwords|.gitignore|_list.txt
- id: flake8
args: [--ignore=E501]
files: .gitignore|_list.txt
- id: forbid-new-submodules
......@@ -35,16 +34,20 @@ repos:
- id: trailing-whitespace
types: [python]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.2.2
rev: v3.0.0a4
hooks:
- id: pylint
language: system
args: [--rcfile=.pylintrc]
args: [--rcfile=pyproject.toml]
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 1.11.0
rev: 2.1.5
hooks:
- id: shellcheck
......@@ -52,3 +55,18 @@ repos:
rev: v0.1.0
hooks:
- id: dockerfilelint
- repo: https://github.com/pre-commit/mirrors-jshint
rev: v2.13.0
hooks:
- id: jshint
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.9.3
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
......@@ -461,3 +461,14 @@
# source: https://github.com/file/file/blob/master/magic/Magdir/filesystems
0x400 lelong 0xF2F52010 F2FS filesystem
!:mime filesystem/f2fs
# Android sparse img format
# From https://android.googlesource.com/\
# platform/system/core/+/master/libsparse/sparse_format.h
0 lelong 0xed26ff3a Android sparse image
!:mime filesystem/android-simg
>4 leshort x \b, version: %d
>6 leshort x \b.%d
>16 lelong x \b, Total of %d
>12 lelong x \b %d-byte output blocks in
>20 lelong x \b %d input chunks.
[tool.black]
line-length = 120
skip-string-normalization = true
target-version = ['py37']
[tool.pylint.main]
init-hook = 'import sys; sys.path.append("./src")'
load-plugins = ["pylint.extensions.bad_builtin", "pylint.extensions.mccabe"]
jobs = 0
include-naming-hint = true
good-names = ["i", "j", "k", "Run", "_", "db", "ex", "fd", "fo", "fp", "fw", "pw", "rv", "sc", "tc"]
[tool.pylint."messages control"]
confidence = []
disable = ["missing-docstring" , "locally-disabled", "logging-format-interpolation", "logging-fstring-interpolation"]
[tool.pylint.reports]
output-format = "colorized"
msg-template="{path}:{line}: [{symbol}:{obj}] {msg}"
[tool.pylint.format]
max-line-length = 120
[tool.pylint.design]
max-args=7
max-complexity = 7
min-public-methods = 0
max-public-methods = 40
[tool.isort]
line_length=120
default_section = "THIRDPARTY"
profile = "black"
[pytest]
addopts = --flake8 -v
flake8-ignore =
*.py E501
addopts = -v
pre-commit
pylint
pytest
pytest-cov
pytest-flake8
......@@ -44,7 +44,7 @@ with OperateInDirectory(str(MIME_DIR)):
setup(
name=MODULE_NAME,
version='0.2.11',
version='0.2.12',
description='Helper functions for file type generation',
author='Johannes vom Dorp',
url='https://github.com/fkie-cad/fact_helper_file',
......
from pathlib import Path
from fact_helper_file.type import get_file_type_from_path, get_file_type_from_binary
from fact_helper_file.type import get_file_type_from_binary, get_file_type_from_path
def test_get_file_type_system_magic():
zip_file = Path(__file__).parent.parent / 'data' / 'test.zip'
file_type = get_file_type_from_path(str(zip_file))
assert file_type['mime'] == 'application/zip', 'mime type not correct'
assert file_type['full'] == 'Zip archive data, at least v2.0 to extract', 'full type not correct'
assert file_type['full'].startswith('Zip archive data, at least v2.0 to extract'), 'full type not correct'
assert file_type == get_file_type_from_binary(zip_file.read_bytes())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment