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] ...@@ -2,7 +2,7 @@ default_stages: [commit, push]
exclude: ^src/bin/ exclude: ^src/bin/
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0 rev: v4.0.1
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
args: [--maxkb=10000] args: [--maxkb=10000]
...@@ -13,6 +13,8 @@ repos: ...@@ -13,6 +13,8 @@ repos:
- id: check-yaml - id: check-yaml
- id: double-quote-string-fixer
- id: end-of-file-fixer - id: end-of-file-fixer
types: [python] types: [python]
...@@ -20,10 +22,7 @@ repos: ...@@ -20,10 +22,7 @@ repos:
args: [--remove] args: [--remove]
- id: file-contents-sorter - id: file-contents-sorter
files: src/unpacker/passwords|.gitignore|_list.txt files: .gitignore|_list.txt
- id: flake8
args: [--ignore=E501]
- id: forbid-new-submodules - id: forbid-new-submodules
...@@ -35,16 +34,20 @@ repos: ...@@ -35,16 +34,20 @@ repos:
- id: trailing-whitespace - id: trailing-whitespace
types: [python] types: [python]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-pylint - repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.2.2 rev: v3.0.0a4
hooks: hooks:
- id: pylint - id: pylint
language: system language: system
args: [--rcfile=.pylintrc] args: [--rcfile=pyproject.toml]
- repo: https://github.com/jumanjihouse/pre-commit-hooks - repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 1.11.0 rev: 2.1.5
hooks: hooks:
- id: shellcheck - id: shellcheck
...@@ -52,3 +55,18 @@ repos: ...@@ -52,3 +55,18 @@ repos:
rev: v0.1.0 rev: v0.1.0
hooks: hooks:
- id: dockerfilelint - 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 @@ ...@@ -461,3 +461,14 @@
# source: https://github.com/file/file/blob/master/magic/Magdir/filesystems # source: https://github.com/file/file/blob/master/magic/Magdir/filesystems
0x400 lelong 0xF2F52010 F2FS filesystem 0x400 lelong 0xF2F52010 F2FS filesystem
!:mime filesystem/f2fs !: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] [pytest]
addopts = --flake8 -v addopts = -v
flake8-ignore =
*.py E501
pre-commit
pylint
pytest pytest
pytest-cov pytest-cov
pytest-flake8
...@@ -44,7 +44,7 @@ with OperateInDirectory(str(MIME_DIR)): ...@@ -44,7 +44,7 @@ with OperateInDirectory(str(MIME_DIR)):
setup( setup(
name=MODULE_NAME, name=MODULE_NAME,
version='0.2.11', version='0.2.12',
description='Helper functions for file type generation', description='Helper functions for file type generation',
author='Johannes vom Dorp', author='Johannes vom Dorp',
url='https://github.com/fkie-cad/fact_helper_file', url='https://github.com/fkie-cad/fact_helper_file',
......
from pathlib import Path 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(): def test_get_file_type_system_magic():
zip_file = Path(__file__).parent.parent / 'data' / 'test.zip' zip_file = Path(__file__).parent.parent / 'data' / 'test.zip'
file_type = get_file_type_from_path(str(zip_file)) file_type = get_file_type_from_path(str(zip_file))
assert file_type['mime'] == 'application/zip', 'mime type not correct' 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()) 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