File signature comparison tool, magic numbers.
Project description
filesignature
Tool that allows to search, extract, compare the signature of the files (magic numbers
) and return the obtained information.
The purpose of this project is to check that a file is valid, i.e. the extension and the hexadecimal signature correspond.
The "byte offset" refers to the position of a specific byte within a file or in a sequence of bytes. 11 byte offsets -> indicates that the first 11 bytes must be shifted to get the desired byte mark.
Install package
pip install filesignature
Usage
>>> from filesignature import FileSignature
>>>
>>> f = FileSignature()
>>>
>>> bytes_data = b'\xef\xbb\xbfhello'
>>> print(f.check_bytes_type(raw_data=bytes_data, extention='txt'))
('EF BB BF', '0', 'txt')
>>>
>>> print(f.check_file_type('file.pdf'))
{'filename': 'file', 'file_extention': 'pdf', 'mimetype': 'application/pdf', 'file_signature': True}
>>>
>>> print(f.check_file_type('file.pdf', get_bool=True))
True
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
filesignature-0.1.3.tar.gz
(4.7 kB
view details)
Built Distribution
File details
Details for the file filesignature-0.1.3.tar.gz
.
File metadata
- Download URL: filesignature-0.1.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.6 Linux/6.6.8-100.fc38.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31ccbb22134e1eb90b0c50fcec730c614f2feb3bd5680559a5936afc76adf178 |
|
MD5 | 181e952f8182680eeb27048513d50577 |
|
BLAKE2b-256 | 3945533607f0784bd1b6af0fc1827449c43cf9ece16ef6e38b0354201c58b0f8 |
File details
Details for the file filesignature-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: filesignature-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.6 Linux/6.6.8-100.fc38.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f14a7bd7095c0ffb8ac53d03516b175249a331c98f8fd2b56c5575d41c34548 |
|
MD5 | 0997ba1db72fc72dcaf2b6726d1b0cc1 |
|
BLAKE2b-256 | c5103d2c161bf8503882bd87f83b38114bf4bebb4b11f98b38ca5aed3ce97c55 |