Skip to content

clach04/magic-fork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

magic-fork

https://github.com/clach04/magic-fork/

Python 3 and 2 version of Jason Petrone's magic.py

Pure python implemenation of file magic identification using Unix standard metadata magic.mgc files (https://github.com/freebsd/freebsd/tree/master/contrib/file/magic/Magdir) for the Unix file command https://www.freebsd.org/cgi/man.cgi?query=magic&sektion=5

WARNING There are no tests nor documentation.

Example:

>python magic.py magic.py
magic.py: application/x-python

>py -3 magic.py magic.py
magic.py: application/x-python

https://pypi.org/project/magic/ (as of 2020-04) has dead links and has not been updated which is why this fork exists.

Alternatives to this pure python file magic implementation are the various libmagic wrappers and file wrapper. See https://bbs.archlinux.org/viewtopic.php?id=240109 for some background.

There are other forks of magic.py but they are Python 2 only and are part of a larger tool and can not be used standalone:

There is a similar but different metadata system at https://github.com/floyernick/fleep-py - its Python 3 only and more information is available at https://hackernoon.com/determining-file-format-using-python-c4e7b18d4fc4

Windows only, includes a python extension https://mark0.net/code-tridlib-e.html

Alternative metadata systems (no Python implementations):