ahupp/python-magic — Issue #15: Ignores data in user's .magic file
Author: jhutchins
Created: 2012-03-07 21:28:03+00:00
State: open

It is possible to extend the ability of the file command on a per user biases by adding magic definitions to a .magic file in a users home directory.

Currently I have a .magic file in the home directory of a user named sendfax. The file looks like to following:

```conf
#------------------------------------------------------------------------------
# Detection for MS OOXML Documents

0 belong 0x504B0304
>4 belong 0x14000600 MS OOXML Document
```

When the file command is run from the command line on an MS docx file I get the following output

```terminal
# su sendfax
$ file test.docx
test.docx: MS OOXML Document
$ whoami
sendfax
```

If I do something similar in python using the magic module I get an entirely different response.

```python
>>> from magic import Magic
>>> m = Magic()
>>> print m.from_file('test.docx')
Zip archive data, at least v2.0 to extract
>>> import getpass
>>> print getpass.getuser()
sendfax
```