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.1.tar.gz
(14.7 kB
view hashes)
Built Distribution
Close
Hashes for filesignature-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00d0edf084f94cc0e49b923efdbf62a18e31b98e03bd87567b8786c1a3255333 |
|
MD5 | 4fea5b92f0125397d57b6799924c144d |
|
BLAKE2b-256 | 1b54a8a2be1428f90c2aad19c30f7376db5ab37550e8a6a25087fdc4f8e77fa1 |