# 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
```bash
pip install filesignature
```
# Usage
```python
>>> 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/kurotom/filesignature",
"name": "filesignature",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "filesignature,file signature,magicnumbers,magic numbers",
"author": "kurotom",
"author_email": "55354389+kurotom@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/39/45/533607f0784bd1b6af0fc1827449c43cf9ece16ef6e38b0354201c58b0f8/filesignature-0.1.3.tar.gz",
"platform": null,
"description": "# filesignature\n\nTool that allows to search, extract, compare the signature of the files (`magic numbers`) and return the obtained information.\n\nThe purpose of this project is to check that a file is valid, i.e. the extension and the hexadecimal signature correspond.\n\n\n>\n> The \"byte offset\" refers to the position of a specific byte within a file or in a sequence of bytes.\n> 11 byte offsets -> indicates that the first 11 bytes must be shifted to get the desired byte mark.\n>\n\n# Install package\n\n```bash\npip install filesignature\n```\n\n\n# Usage\n\n```python\n>>> from filesignature import FileSignature\n>>>\n>>> f = FileSignature()\n>>>\n>>> bytes_data = b'\\xef\\xbb\\xbfhello'\n>>> print(f.check_bytes_type(raw_data=bytes_data, extention='txt'))\n('EF BB BF', '0', 'txt')\n>>>\n>>> print(f.check_file_type('file.pdf'))\n{'filename': 'file', 'file_extention': 'pdf', 'mimetype': 'application/pdf', 'file_signature': True}\n>>>\n>>> print(f.check_file_type('file.pdf', get_bool=True))\nTrue\n```\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "File signature comparison tool, magic numbers.",
"version": "0.1.3",
"project_urls": {
"Bug Tracker": "https://github.com/kurotom/filesignature/issues",
"Homepage": "https://github.com/kurotom/filesignature",
"Repository": "https://github.com/kurotom/filesignature"
},
"split_keywords": [
"filesignature",
"file signature",
"magicnumbers",
"magic numbers"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c5103d2c161bf8503882bd87f83b38114bf4bebb4b11f98b38ca5aed3ce97c55",
"md5": "0997ba1db72fc72dcaf2b6726d1b0cc1",
"sha256": "1f14a7bd7095c0ffb8ac53d03516b175249a331c98f8fd2b56c5575d41c34548"
},
"downloads": -1,
"filename": "filesignature-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0997ba1db72fc72dcaf2b6726d1b0cc1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 5776,
"upload_time": "2024-02-21T01:47:05",
"upload_time_iso_8601": "2024-02-21T01:47:05.109462Z",
"url": "https://files.pythonhosted.org/packages/c5/10/3d2c161bf8503882bd87f83b38114bf4bebb4b11f98b38ca5aed3ce97c55/filesignature-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3945533607f0784bd1b6af0fc1827449c43cf9ece16ef6e38b0354201c58b0f8",
"md5": "181e952f8182680eeb27048513d50577",
"sha256": "31ccbb22134e1eb90b0c50fcec730c614f2feb3bd5680559a5936afc76adf178"
},
"downloads": -1,
"filename": "filesignature-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "181e952f8182680eeb27048513d50577",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 4749,
"upload_time": "2024-02-21T01:47:06",
"upload_time_iso_8601": "2024-02-21T01:47:06.954881Z",
"url": "https://files.pythonhosted.org/packages/39/45/533607f0784bd1b6af0fc1827449c43cf9ece16ef6e38b0354201c58b0f8/filesignature-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-21 01:47:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kurotom",
"github_project": "filesignature",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "filesignature"
}