Skip to main content

About

magic-identify implements a wrapper around both the python-magic module and the identify module to try and always return results, even if one fails. Finally, failing that it will try to guess some minimal shell script environments too (specifically looking at common keywords in malware droppers/downloaders that do not always have leading identification lines).

It returns two strings, one which may be a higher level text description and a second which should always be a mime-type identifier.

Example module use:

import magicidentify
c = magicidentify.MagicIdentify()
print(c.identify("/bin/ls"))
# ('application/x-pie-executable', 'application/x-pie-executable')

Example CLI use:

# magic-identify /bin/ls /sbin/ifup
/bin/ls: application/x-pie-executable, application/x-pie-executable
  using magic:    application/x-pie-executable, application/x-pie-executable
  using identify: unknown, unknown
  using hack:     unknown, unknown
/sbin/ifup: inode/symlink, inode/symlink
  using magic:    inode/symlink, inode/symlink
  using identify: bash/shell, text/x-bash
  using hack:     unknown, unknown

# magic-identify -q /bin/ls /sbin/ifup
application/x-pie-executable
inode/symlink

Todo

  • Handle more boring cases from some outputs (text/inode)

Acknowledgements

The following wonderful github accounts have contributed to the code base:

  • @JakeRoggenbuck

Metadata

Release files for magic-identify 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for magic-identify 0.2.2
File Size Uploaded
magic-identify-0.2.2.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for magic-identify 0.2.2
File Interpreter ABI Platform
magic_identify-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / magic-identify-0.2.2.tar.gz

Download URL magic-identify-0.2.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4b44bd62b06168fcb6f066ae32bdce81d0be29f726a54a076043f19911e84744
BLAKE2b-256 checksum
How to use checksums
0050fa44396a286e2c8fbe9adb118993cc6a3b0d0c700925942e4e0544495d19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 CPython/3.10.7

Release files / magic_identify-0.2.2-py3-none-any.whl

Download URL magic_identify-0.2.2-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
638bb77086b9e976c6fecf38f6fe937c587e91b5c0d1f6a0b2dfa0b81b739c7c
BLAKE2b-256 checksum
How to use checksums
f48e0ed4ed3a90e466bef6b5f1e6f5157c94dff97d924833bdb360c2efbbed47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page