Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fact_helper_file
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
fact_helper_file
Commits
f35022e1
Unverified
Commit
f35022e1
authored
Oct 24, 2022
by
René Helmke
Committed by
GitHub
Oct 24, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #20 from fkie-cad/android-simg
Android simg
parents
2676af3e
c446ea3b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
15 deletions
+83
-15
.flake8
.flake8
+6
-0
.pre-commit-config.yaml
.pre-commit-config.yaml
+26
-8
custom_mime_file_systems
fact_helper_file/mime/custom_mime_file_systems
+11
-0
pyproject.toml
pyproject.toml
+34
-0
pytest.ini
pytest.ini
+1
-3
requirements-dev.txt
requirements-dev.txt
+2
-1
setup.py
setup.py
+1
-1
test_type.py
test/unit/test_type.py
+2
-2
No files found.
.flake8
0 → 100644
View file @
f35022e1
[flake8]
extend-ignore = E501,W503
extend-select = E504
exclude =
.git,
__pycache__
.pre-commit-config.yaml
View file @
f35022e1
...
...
@@ -2,7 +2,7 @@ default_stages: [commit, push]
exclude
:
^src/bin/
repos
:
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
rev
:
v
2.1.0
rev
:
v
4.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
:
v
2.2.2
rev
:
v
3.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
fact_helper_file/mime/custom_mime_file_systems
View file @
f35022e1
...
...
@@ -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.
pyproject.toml
0 → 100644
View file @
f35022e1
[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.ini
View file @
f35022e1
[pytest]
addopts
=
--flake8 -v
flake8-ignore
=
*.py E501
addopts
=
-v
requirements-dev.txt
View file @
f35022e1
pre-commit
pylint
pytest
pytest-cov
pytest-flake8
setup.py
View file @
f35022e1
...
...
@@ -44,7 +44,7 @@ with OperateInDirectory(str(MIME_DIR)):
setup
(
name
=
MODULE_NAME
,
version
=
'0.2.1
1
'
,
version
=
'0.2.1
2
'
,
description
=
'Helper functions for file type generation'
,
author
=
'Johannes vom Dorp'
,
url
=
'https://github.com/fkie-cad/fact_helper_file'
,
...
...
test/unit/test_type.py
View file @
f35022e1
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
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment