Gnumed.pycommon.gmMimeMagic

Package Gnumed :: Package pycommon :: Module gmMimeMagic |
[frames] | no frames]

# Source Code for Module Gnumed.pycommon.gmMimeMagic

       1  """magic.py
       2   determines a file type by its magic number
       3
       4   (C)opyright 2000 Jason Petrone <jp@demonseed.net>
       5   All Rights Reserved
       6
       7   Command Line Usage: running as `python magic.py file` will print
       8                                                                                   a description of what 'file' is.
       9
      10   Module Usage:
      11                   magic.whatis(data): when passed a string 'data' containing
      12                                                                                                   binary or text data, a description of
      13                                                                                                   what the data is will be returned.
      14
      15                   magic.file(filename): returns a description of what the file
      16                                                                                                           'filename' contains.
      17
      18  Acknowledgements: This module has been pulled from the web. Thanks to
      19  Jason Petrone for providing it to the community. It is based on his
      20  __version__ = '0.1'
      21  """
      22  # TODO
      23  # - load alternative data on platforms (win: image/x-xbitmap)
      24
      25  #=================================================================
      26  # $Source: /home/ncq/Projekte/cvs2git/vcs-mirror/gnumed/gnumed/client/pycommon/gmMimeMagic.py,v $
      27  # $Id: gmMimeMagic.py,v 1.2 2009-09-13 18:31:57 ncq Exp $
      28  __version__ = "$Revision: 1.2 $"
      29  __author__ = "Jason Petrone <jp@demonseed.net>, Karsten Hilbert <Karsten.Hilbert@gmx.net>"
      30  __license__ = "GPL"
      31
      32  import re, struct, string
      33  #=================================================================
      34  magic = [
      35          [0L, 'leshort', '=', 1538L, 'application/x-alan-adventure-game'],
      36          [0L, 'string', '=', 'TADS', 'application/x-tads-game'],
      37          [0L, 'short', '=', 420L, 'application/x-executable-file'],
      38          [0L, 'short', '=', 421L, 'application/x-executable-file'],
      39          [0L, 'leshort', '=', 603L, 'application/x-executable-file'],
      40          [0L, 'string', '=', 'Core\001', 'application/x-executable-file'],
      41          [0L, 'string', '=', 'AMANDA: TAPESTART DATE', 'application/x-amanda-header'],
      42          [0L, 'belong', '=', 1011L, 'application/x-executable-file'],
      43          [0L, 'belong', '=', 999L, 'application/x-library-file'],
      44          [0L, 'belong', '=', 435L, 'video/mpeg'],
      45          [0L, 'belong', '=', 442L, 'video/mpeg'],
      46          [0L, 'beshort&0xfff0', '=', 65520L, 'audio/mpeg'],
      47          [4L, 'leshort', '=', 44817L, 'video/fli'],
      48          [4L, 'leshort', '=', 44818L, 'video/flc'],
      49          [0L, 'string', '=', 'MOVI', 'video/x-sgi-movie'],
      50          [4L, 'string', '=', 'moov', 'video/quicktime'],
      51          [4L, 'string', '=', 'mdat', 'video/quicktime'],
      52          [0L, 'long', '=', 100554L, 'application/x-apl-workspace'],
      53          [0L, 'string', '=', 'FiLeStArTfIlEsTaRt', 'text/x-apple-binscii'],
      54          [0L, 'string', '=', '\012GL', 'application/data'],
      55          [0L, 'string', '=', 'v\377', 'application/data'],
      56          [0L, 'string', '=', 'NuFile', 'application/data'],
      57          [0L, 'string', '=', 'N\365F\351l\345', 'application/data'],
      58          [0L, 'belong', '=', 333312L, 'application/data'],
      59          [0L, 'belong', '=', 333319L, 'application/data'],
      60          [257L, 'string', '=', 'ustar\000', 'application/x-tar'],
      61          [257L, 'string', '=', 'ustar  \000', 'application/x-gtar'],
      62          [0L, 'short', '=', 70707L, 'application/x-cpio'],
      63          [0L, 'short', '=', 143561L, 'application/x-bcpio'],
      64          [0L, 'string', '=', '070707', 'application/x-cpio'],
      65          [0L, 'string', '=', '070701', 'application/x-cpio'],
      66          [0L, 'string', '=', '070702', 'application/x-cpio'],
      67          [0L, 'string', '=', '!<arch>\012debian', 'application/x-dpkg'],
      68          [0L, 'long', '=', 177555L, 'application/x-ar'],
      69          [0L, 'short', '=', 177555L, 'application/data'],
      70          [0L, 'long', '=', 177545L, 'application/data'],
      71          [0L, 'short', '=', 177545L, 'application/data'],
      72          [0L, 'long', '=', 100554L, 'application/x-apl-workspace'],
      73          [0L, 'string', '=', '<ar>', 'application/x-ar'],
      74          [0L, 'string', '=', '!<arch>\012__________E', 'application/x-ar'],
      75          [0L, 'string', '=', '-h-', 'application/data'],
      76          [0L, 'string', '=', '!<arch>', 'application/x-ar'],
      77          [0L, 'string', '=', '<ar>', 'application/x-ar'],
      78          [0L, 'string', '=', '<ar>', 'application/x-ar'],
      79          [0L, 'belong', '=', 1711210496L, 'application/x-ar'],
      80          [0L, 'belong', '=', 1013019198L, 'application/x-ar'],
      81          [0L, 'long', '=', 557605234L, 'application/x-ar'],
      82          [0L, 'lelong', '=', 177555L, 'application/data'],
      83          [0L, 'leshort', '=', 177555L, 'application/data'],
      84          [0L, 'lelong', '=', 177545L, 'application/data'],
      85          [0L, 'leshort', '=', 177545L, 'application/data'],
      86          [0L, 'lelong', '=', 236525L, 'application/data'],
      87          [0L, 'lelong', '=', 236526L, 'application/data'],
      88          [0L, 'lelong&0x8080ffff', '=', 2074L, 'application/x-arc'],
      89          [0L, 'lelong&0x8080ffff', '=', 2330L, 'application/x-arc'],
      90          [0L, 'lelong&0x8080ffff', '=', 538L, 'application/x-arc'],
      91          [0L, 'lelong&0x8080ffff', '=', 794L, 'application/x-arc'],
      92          [0L, 'lelong&0x8080ffff', '=', 1050L, 'application/x-arc'],
      93          [0L, 'lelong&0x8080ffff', '=', 1562L, 'application/x-arc'],
      94          [0L, 'string', '=', '\032archive', 'application/data'],
      95          [0L, 'leshort', '=', 60000L, 'application/x-arj'],
      96          [0L, 'string', '=', 'HPAK', 'application/data'],
      97          [0L, 'string', '=', '\351,\001JAM application/data', ''],
      98          [2L, 'string', '=', '-lh0-', 'application/x-lha'],
      99          [2L, 'string', '=', '-lh1-', 'application/x-lha'],
     100          [2L, 'string', '=', '-lz4-', 'application/x-lha'],
     101          [2L, 'string', '=', '-lz5-', 'application/x-lha'],
     102          [2L, 'string', '=', '-lzs-', 'application/x-lha'],
     103          [2L, 'string', '=', '-lh -', 'application/x-lha'],
     104          [2L, 'string', '=', '-lhd-', 'application/x-lha'],
     105          [2L, 'string', '=', '-lh2-', 'application/x-lha'],
     106          [2L, 'string', '=', '-lh3-', 'application/x-lha'],
     107          [2L, 'string', '=', '-lh4-', 'application/x-lha'],
     108          [2L, 'string', '=', '-lh5-', 'application/x-lha'],
     109          [0L, 'string', '=', 'Rar!', 'application/x-rar'],
     110          [0L, 'string', '=', 'SQSH', 'application/data'],
     111          [0L, 'string', '=', 'UC2\032', 'application/data'],
     112          [0L, 'string', '=', 'PK\003\004', 'application/zip'],
     113          [20L, 'lelong', '=', 4257523676L, 'application/x-zoo'],
     114          [10L, 'string', '=', '# This is a shell archive', 'application/x-shar'],
     115          [0L, 'string', '=', '*STA', 'application/data'],
     116          [0L, 'string', '=', '2278', 'application/data'],
     117          [0L, 'beshort', '=', 560L, 'application/x-executable-file'],
     118          [0L, 'beshort', '=', 561L, 'application/x-executable-file'],
     119          [0L, 'string', '=', '\000\004\036\212\200', 'application/core'],
     120          [0L, 'string', '=', '.snd', 'audio/basic'],
     121          [0L, 'lelong', '=', 6583086L, 'audio/basic'],
     122          [0L, 'string', '=', 'MThd', 'audio/midi'],
     123          [0L, 'string', '=', 'CTMF', 'audio/x-cmf'],
     124          [0L, 'string', '=', 'SBI', 'audio/x-sbi'],
     125          [0L, 'string', '=', 'Creative Voice File', 'audio/x-voc'],
     126          [0L, 'belong', '=', 1314148939L, 'audio/x-multitrack'],
     127          [0L, 'string', '=', 'RIFF', 'audio/x-wav'],
     128          [0L, 'string', '=', 'EMOD', 'audio/x-emod'],
     129          [0L, 'belong', '=', 779248125L, 'audio/x-pn-realaudio'],
     130          [0L, 'string', '=', 'MTM', 'audio/x-multitrack'],
     131          [0L, 'string', '=', 'if', 'audio/x-669-mod'],
     132          [0L, 'string', '=', 'FAR', 'audio/mod'],
     133          [0L, 'string', '=', 'MAS_U', 'audio/x-multimate-mod'],
     134          [44L, 'string', '=', 'SCRM', 'audio/x-st3-mod'],
     135          [0L, 'string', '=', 'GF1PATCH110\000ID#000002\000', 'audio/x-gus-patch'],
     136          [0L, 'string', '=', 'GF1PATCH100\000ID#000002\000', 'audio/x-gus-patch'],
     137          [0L, 'string', '=', 'JN', 'audio/x-669-mod'],
     138          [0L, 'string', '=', 'UN05', 'audio/x-mikmod-uni'],
     139          [0L, 'string', '=', 'Extended Module:', 'audio/x-ft2-mod'],
     140          [21L, 'string', '=', '!SCREAM!', 'audio/x-st2-mod'],
     141          [1080L, 'string', '=', 'M.K.', 'audio/x-protracker-mod'],
     142          [1080L, 'string', '=', 'M!K!', 'audio/x-protracker-mod'],
     143          [1080L, 'string', '=', 'FLT4', 'audio/x-startracker-mod'],
     144          [1080L, 'string', '=', '4CHN', 'audio/x-fasttracker-mod'],
     145          [1080L, 'string', '=', '6CHN', 'audio/x-fasttracker-mod'],
     146          [1080L, 'string', '=', '8CHN', 'audio/x-fasttracker-mod'],
     147          [1080L, 'string', '=', 'CD81', 'audio/x-oktalyzer-mod'],
     148          [1080L, 'string', '=', 'OKTA', 'audio/x-oktalyzer-mod'],
     149          [1080L, 'string', '=', '16CN', 'audio/x-taketracker-mod'],
     150          [1080L, 'string', '=', '32CN', 'audio/x-taketracker-mod'],
     151          [0L, 'string', '=', 'TOC', 'audio/x-toc'],
     152          [0L, 'short', '=', 3401L, 'application/x-executable-file'],
     153          [0L, 'long', '=', 406L, 'application/x-executable-file'],
     154          [0L, 'short', '=', 406L, 'application/x-executable-file'],
     155          [0L, 'short', '=', 3001L, 'application/x-executable-file'],
     156          [0L, 'lelong', '=', 314L, 'application/x-executable-file'],
     157          [0L, 'string', '=', '//', 'text/cpp'],
     158          [0L, 'string', '=', '\\\\1cw\\', 'application/data'],
     159          [0L, 'string', '=', '\\\\1cw', 'application/data'],
     160          [0L, 'belong&0xffffff00', '=', 2231440384L, 'application/data'],
     161          [0L, 'belong&0xffffff00', '=', 2231487232L, 'application/data'],
     162          [0L, 'short', '=', 575L, 'application/x-executable-file'],
     163          [0L, 'short', '=', 577L, 'application/x-executable-file'],
     164          [4L, 'string', '=', 'pipe', 'application/data'],
     165          [4L, 'string', '=', 'prof', 'application/data'],
     166          [0L, 'string', '=', ': shell', 'application/data'],
     167          [0L, 'string', '=', '#!/bin/sh', 'application/x-sh'],
     168          [0L, 'string', '=', '#! /bin/sh', 'application/x-sh'],
     169          [0L, 'string', '=', '#! /bin/sh', 'application/x-sh'],
     170          [0L, 'string', '=', '#!/bin/csh', 'application/x-csh'],
     171          [0L, 'string', '=', '#! /bin/csh', 'application/x-csh'],
     172          [0L, 'string', '=', '#! /bin/csh', 'application/x-csh'],
     173          [0L, 'string', '=', '#!/bin/ksh', 'application/x-ksh'],
     174          [0L, 'string', '=', '#! /bin/ksh', 'application/x-ksh'],
     175          [0L, 'string', '=', '#! /bin/ksh', 'application/x-ksh'],
     176          [0L, 'string', '=', '#!/bin/tcsh', 'application/x-csh'],
     177          [0L, 'string', '=', '#! /bin/tcsh', 'application/x-csh'],
     178          [0L, 'string', '=', '#! /bin/tcsh', 'application/x-csh'],
     179          [0L, 'string', '=', '#!/usr/local/tcsh', 'application/x-csh'],
     180          [0L, 'string', '=', '#! /usr/local/tcsh', 'application/x-csh'],
     181          [0L, 'string', '=', '#!/usr/local/bin/tcsh', 'application/x-csh'],
     182          [0L, 'string', '=', '#! /usr/local/bin/tcsh', 'application/x-csh'],
     183          [0L, 'string', '=', '#! /usr/local/bin/tcsh', 'application/x-csh'],
     184          [0L, 'string', '=', '#!/usr/local/bin/zsh', 'application/x-zsh'],
     185          [0L, 'string', '=', '#! /usr/local/bin/zsh', 'application/x-zsh'],
     186          [0L, 'string', '=', '#! /usr/local/bin/zsh', 'application/x-zsh'],
     187          [0L, 'string', '=', '#!/usr/local/bin/ash', 'application/x-sh'],
     188          [0L, 'string', '=', '#! /usr/local/bin/ash', 'application/x-zsh'],
     189          [0L, 'string', '=', '#! /usr/local/bin/ash', 'application/x-zsh'],
     190          [0L, 'string', '=', '#!/usr/local/bin/ae', 'text/script'],
     191          [0L, 'string', '=', '#! /usr/local/bin/ae', 'text/script'],
     192          [0L, 'string', '=', '#! /usr/local/bin/ae', 'text/script'],
     193          [0L, 'string', '=', '#!/bin/nawk', 'application/x-awk'],
     194          [0L, 'string', '=', '#! /bin/nawk', 'application/x-awk'],
     195          [0L, 'string', '=', '#! /bin/nawk', 'application/x-awk'],
     196          [0L, 'string', '=', '#!/usr/bin/nawk', 'application/x-awk'],
     197          [0L, 'string', '=', '#! /usr/bin/nawk', 'application/x-awk'],
     198          [0L, 'string', '=', '#! /usr/bin/nawk', 'application/x-awk'],
     199          [0L, 'string', '=', '#!/usr/local/bin/nawk', 'application/x-awk'],
     200          [0L, 'string', '=', '#! /usr/local/bin/nawk', 'application/x-awk'],
     201          [0L, 'string', '=', '#! /usr/local/bin/nawk', 'application/x-awk'],
     202          [0L, 'string', '=', '#!/bin/gawk', 'application/x-awk'],
     203          [0L, 'string', '=', '#! /bin/gawk', 'application/x-awk'],
     204          [0L, 'string', '=', '#! /bin/gawk', 'application/x-awk'],
     205          [0L, 'string', '=', '#!/usr/bin/gawk', 'application/x-awk'],
     206          [0L, 'string', '=', '#! /usr/bin/gawk', 'application/x-awk'],
     207          [0L, 'string', '=', '#! /usr/bin/gawk', 'application/x-awk'],
     208          [0L, 'string', '=', '#!/usr/local/bin/gawk', 'application/x-awk'],
     209          [0L, 'string', '=', '#! /usr/local/bin/gawk', 'application/x-awk'],
     210          [0L, 'string', '=', '#! /usr/local/bin/gawk', 'application/x-awk'],
     211          [0L, 'string', '=', '#!/bin/awk', 'application/x-awk'],
     212          [0L, 'string', '=', '#! /bin/awk', 'application/x-awk'],
     213          [0L, 'string', '=', '#! /bin/awk', 'application/x-awk'],
     214          [0L, 'string', '=', '#!/usr/bin/awk', 'application/x-awk'],
     215          [0L, 'string', '=', '#! /usr/bin/awk', 'application/x-awk'],
     216          [0L, 'string', '=', '#! /usr/bin/awk', 'application/x-awk'],
     217          [0L, 'string', '=', 'BEGIN', 'application/x-awk'],
     218          [0L, 'string', '=', '#!/bin/perl', 'application/x-perl'],
     219          [0L, 'string', '=', '#! /bin/perl', 'application/x-perl'],
     220          [0L, 'string', '=', '#! /bin/perl', 'application/x-perl'],
     221          [0L, 'string', '=', 'eval "exec /bin/perl', 'application/x-perl'],
     222          [0L, 'string', '=', '#!/usr/bin/perl', 'application/x-perl'],
     223          [0L, 'string', '=', '#! /usr/bin/perl', 'application/x-perl'],
     224          [0L, 'string', '=', '#! /usr/bin/perl', 'application/x-perl'],
     225          [0L, 'string', '=', 'eval "exec /usr/bin/perl', 'application/x-perl'],
     226          [0L, 'string', '=', '#!/usr/local/bin/perl', 'application/x-perl'],
     227          [0L, 'string', '=', '#! /usr/local/bin/perl', 'application/x-perl'],
     228          [0L, 'string', '=', '#! /usr/local/bin/perl', 'application/x-perl'],
     229          [0L, 'string', '=', 'eval "exec /usr/local/bin/perl', 'application/x-perl'],
     230          [0L, 'string', '=', '#!/bin/python', 'application/x-python'],
     231          [0L, 'string', '=', '#! /bin/python', 'application/x-python'],
     232          [0L, 'string', '=', '#! /bin/python', 'application/x-python'],
     233          [0L, 'string', '=', 'eval "exec /bin/python', 'application/x-python'],
     234          [0L, 'string', '=', '#!/usr/bin/python', 'application/x-python'],
     235          [0L, 'string', '=', '#! /usr/bin/python', 'application/x-python'],
     236          [0L, 'string', '=', '#! /usr/bin/python', 'application/x-python'],
     237          [0L, 'string', '=', 'eval "exec /usr/bin/python', 'application/x-python'],
     238          [0L, 'string', '=', '#!/usr/local/bin/python', 'application/x-python'],
     239          [0L, 'string', '=', '#! /usr/local/bin/python', 'application/x-python'],
     240          [0L, 'string', '=', '#! /usr/local/bin/python', 'application/x-python'],
     241          [0L, 'string', '=', 'eval "exec /usr/local/bin/python', 'application/x-python'],
     242          [0L, 'string', '=', '#!/usr/bin/env python', 'application/x-python'],
     243          [0L, 'string', '=', '#! /usr/bin/env python', 'application/x-python'],
     244          [0L, 'string', '=', '#!/bin/rc', 'text/script'],
     245          [0L, 'string', '=', '#! /bin/rc', 'text/script'],
     246          [0L, 'string', '=', '#! /bin/rc', 'text/script'],
     247          [0L, 'string', '=', '#!/bin/bash', 'application/x-sh'],
     248          [0L, 'string', '=', '#! /bin/bash', 'application/x-sh'],
     249          [0L, 'string', '=', '#! /bin/bash', 'application/x-sh'],
     250          [0L, 'string', '=', '#!/usr/local/bin/bash', 'application/x-sh'],
     251          [0L, 'string', '=', '#! /usr/local/bin/bash', 'application/x-sh'],
     252          [0L, 'string', '=', '#! /usr/local/bin/bash', 'application/x-sh'],
     253          [0L, 'string', '=', '#! /', 'text/script'],
     254          [0L, 'string', '=', '#! /', 'text/script'],
     255          [0L, 'string', '=', '#!/', 'text/script'],
     256          [0L, 'string', '=', '#! text/script', ''],
     257          [0L, 'string', '=', '\037\235', 'application/compress'],
     258          [0L, 'string', '=', '\037\213', 'application/x-gzip'],
     259          [0L, 'string', '=', '\037\036', 'application/data'],
     260          [0L, 'short', '=', 17437L, 'application/data'],
     261          [0L, 'short', '=', 8191L, 'application/data'],
     262          [0L, 'string', '=', '\377\037', 'application/data'],
     263          [0L, 'short', '=', 145405L, 'application/data'],
     264          [0L, 'string', '=', 'BZh', 'application/x-bzip2'],
     265          [0L, 'leshort', '=', 65398L, 'application/data'],
     266          [0L, 'leshort', '=', 65142L, 'application/data'],
     267          [0L, 'leshort', '=', 64886L, 'application/x-lzh'],
     268          [0L, 'string', '=', '\037\237', 'application/data'],
     269          [0L, 'string', '=', '\037\236', 'application/data'],
     270          [0L, 'string', '=', '\037\240', 'application/data'],
     271          [0L, 'string', '=', 'BZ', 'application/x-bzip'],
     272          [0L, 'string', '=', '\211LZO\000\015\012\032\012', 'application/data'],
     273          [0L, 'belong', '=', 507L, 'application/x-object-file'],
     274          [0L, 'belong', '=', 513L, 'application/x-executable-file'],
     275          [0L, 'belong', '=', 515L, 'application/x-executable-file'],
     276          [0L, 'belong', '=', 517L, 'application/x-executable-file'],
     277          [0L, 'belong', '=', 70231L, 'application/core'],
     278          [24L, 'belong', '=', 60011L, 'application/data'],
     279          [24L, 'belong', '=', 60012L, 'application/data'],
     280          [24L, 'belong', '=', 60013L, 'application/data'],
     281          [24L, 'belong', '=', 60014L, 'application/data'],
     282          [0L, 'belong', '=', 601L, 'application/x-object-file'],
     283          [0L, 'belong', '=', 607L, 'application/data'],
     284          [0L, 'belong', '=', 324508366L, 'application/x-gdbm'],
     285          [0L, 'lelong', '=', 324508366L, 'application/x-gdbm'],
     286          [0L, 'string', '=', 'GDBM', 'application/x-gdbm'],
     287          [0L, 'belong', '=', 398689L, 'application/x-db'],
     288          [0L, 'belong', '=', 340322L, 'application/x-db'],
     289          [0L, 'string', '=', '<list>\012<protocol bbn-m', 'application/data'],
     290          [0L, 'string', '=', 'diff text/x-patch', ''],
     291          [0L, 'string', '=', '*** text/x-patch', ''],
     292          [0L, 'string', '=', 'Only in text/x-patch', ''],
     293          [0L, 'string', '=', 'Common subdirectories: text/x-patch', ''],
     294          [0L, 'string', '=', '!<arch>\012________64E', 'application/data'],
     295          [0L, 'leshort', '=', 387L, 'application/x-executable-file'],
     296          [0L, 'leshort', '=', 392L, 'application/x-executable-file'],
     297          [0L, 'leshort', '=', 399L, 'application/x-object-file'],
     298          [0L, 'string', '=', '\377\377\177', 'application/data'],
     299          [0L, 'string', '=', '\377\377|', 'application/data'],
     300          [0L, 'string', '=', '\377\377~', 'application/data'],
     301          [0L, 'string', '=', '\033c\033', 'application/data'],
     302          [0L, 'long', '=', 4553207L, 'image/x11'],
     303          [0L, 'string', '=', '!<PDF>!\012', 'application/x-prof'],
     304          [0L, 'short', '=', 1281L, 'application/x-locale'],
     305          [24L, 'belong', '=', 60012L, 'application/x-dump'],
     306          [24L, 'belong', '=', 60011L, 'application/x-dump'],
     307          [24L, 'lelong', '=', 60012L, 'application/x-dump'],
     308          [24L, 'lelong', '=', 60011L, 'application/x-dump'],
     309          [0L, 'string', '=', '\177ELF', 'application/x-executable-file'],
     310          [0L, 'short', '=', 340L, 'application/data'],
     311          [0L, 'short', '=', 341L, 'application/x-executable-file'],
     312          [1080L, 'leshort', '=', 61267L, 'application/x-linux-ext2fs'],
     313          [0L, 'string', '=', '\366\366\366\366', 'application/x-pc-floppy'],
     314          [774L, 'beshort', '=', 55998L, 'application/data'],
     315          [510L, 'leshort', '=', 43605L, 'application/data'],
     316          [1040L, 'leshort', '=', 4991L, 'application/x-filesystem'],
     317          [1040L, 'leshort', '=', 5007L, 'application/x-filesystem'],
     318          [1040L, 'leshort', '=', 9320L, 'application/x-filesystem'],
     319          [1040L, 'leshort', '=', 9336L, 'application/x-filesystem'],
     320          [0L, 'string', '=', '-rom1fs-\000', 'application/x-filesystem'],
     321          [395L, 'string', '=', 'OS/2', 'application/x-bootable'],
     322          [0L, 'string', '=', 'FONT', 'font/x-vfont'],
     323          [0L, 'short', '=', 436L, 'font/x-vfont'],
     324          [0L, 'short', '=', 17001L, 'font/x-vfont'],
     325          [0L, 'string', '=', '%!PS-AdobeFont-1.0', 'font/type1'],
     326          [6L, 'string', '=', '%!PS-AdobeFont-1.0', 'font/type1'],
     327          [0L, 'belong', '=', 4L, 'font/x-snf'],
     328          [0L, 'lelong', '=', 4L, 'font/x-snf'],
     329          [0L, 'string', '=', 'STARTFONT font/x-bdf', ''],
     330          [0L, 'string', '=', '\001fcp', 'font/x-pcf'],
     331          [0L, 'string', '=', 'D1.0\015', 'font/x-speedo'],
     332          [0L, 'string', '=', 'flf', 'font/x-figlet'],
     333          [0L, 'string', '=', 'flc', 'application/x-font'],
     334          [0L, 'belong', '=', 335698201L, 'font/x-libgrx'],
     335          [0L, 'belong', '=', 4282797902L, 'font/x-dos'],
     336          [7L, 'belong', '=', 4540225L, 'font/x-dos'],
     337          [7L, 'belong', '=', 5654852L, 'font/x-dos'],
     338          [4098L, 'string', '=', 'DOSFONT', 'font/x-dos'],
     339          [0L, 'string', '=', '<MakerFile', 'application/x-framemaker'],
     340          [0L, 'string', '=', '<MIFFile', 'application/x-framemaker'],
     341          [0L, 'string', '=', '<MakerDictionary', 'application/x-framemaker'],
     342          [0L, 'string', '=', '<MakerScreenFont', 'font/x-framemaker'],
     343          [0L, 'string', '=', '<MML', 'application/x-framemaker'],
     344          [0L, 'string', '=', '<BookFile', 'application/x-framemaker'],
     345          [0L, 'string', '=', '<Maker', 'application/x-framemaker'],
     346          [0L, 'lelong&0377777777', '=', 41400407L, 'application/x-executable-file'],
     347          [0L, 'lelong&0377777777', '=', 41400410L, 'application/x-executable-file'],
     348          [0L, 'lelong&0377777777', '=', 41400413L, 'application/x-executable-file'],
     349          [0L, 'lelong&0377777777', '=', 41400314L, 'application/x-executable-file'],
     350          [7L, 'string', '=', '\357\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000', 'application/core'],
     351          [0L, 'lelong', '=', 11421044151L, 'application/data'],
     352          [0L, 'string', '=', 'GIMP Gradient', 'application/x-gimp-gradient'],
     353          [0L, 'string', '=', 'gimp xcf', 'application/x-gimp-image'],
     354          [20L, 'string', '=', 'GPAT', 'application/x-gimp-pattern'],
     355          [20L, 'string', '=', 'GIMP', 'application/x-gimp-brush'],
     356          [0L, 'string', '=', '\336\022\004\225', 'application/x-locale'],
     357          [0L, 'string', '=', '\225\004\022\336', 'application/x-locale'],
     358          [0L, 'beshort', '=', 627L, 'application/x-executable-file'],
     359          [0L, 'beshort', '=', 624L, 'application/x-executable-file'],
     360          [0L, 'string', '=', '\000\001\000\000\000', 'font/ttf'],
     361          [0L, 'long', '=', 1203604016L, 'application/data'],
     362          [0L, 'long', '=', 1702407010L, 'application/data'],
     363          [0L, 'long', '=', 1003405017L, 'application/data'],
     364          [0L, 'long', '=', 1602007412L, 'application/data'],
     365          [0L, 'belong', '=', 34603270L, 'application/x-object-file'],
     366          [0L, 'belong', '=', 34603271L, 'application/x-executable-file'],
     367          [0L, 'belong', '=', 34603272L, 'application/x-executable-file'],
     368          [0L, 'belong', '=', 34603275L, 'application/x-executable-file'],
     369          [0L, 'belong', '=', 34603278L, 'application/x-library-file'],
     370          [0L, 'belong', '=', 34603277L, 'application/x-library-file'],
     371          [0L, 'belong', '=', 34865414L, 'application/x-object-file'],
     372          [0L, 'belong', '=', 34865415L, 'application/x-executable-file'],
     373          [0L, 'belong', '=', 34865416L, 'application/x-executable-file'],
     374          [0L, 'belong', '=', 34865419L, 'application/x-executable-file'],
     375          [0L, 'belong', '=', 34865422L, 'application/x-library-file'],
     376          [0L, 'belong', '=', 34865421L, 'application/x-object-file'],
     377          [0L, 'belong', '=', 34275590L, 'application/x-object-file'],
     378          [0L, 'belong', '=', 34275591L, 'application/x-executable-file'],
     379          [0L, 'belong', '=', 34275592L, 'application/x-executable-file'],
     380          [0L, 'belong', '=', 34275595L, 'application/x-executable-file'],
     381          [0L, 'belong', '=', 34275598L, 'application/x-library-file'],
     382          [0L, 'belong', '=', 34275597L, 'application/x-library-file'],
     383          [0L, 'belong', '=', 557605234L, 'application/x-ar'],
     384          [0L, 'long', '=', 34078982L, 'application/x-executable-file'],
     385          [0L, 'long', '=', 34078983L, 'application/x-executable-file'],
     386          [0L, 'long', '=', 34078984L, 'application/x-executable-file'],
     387          [0L, 'belong', '=', 34341128L, 'application/x-executable-file'],
     388          [0L, 'belong', '=', 34341127L, 'application/x-executable-file'],
     389          [0L, 'belong', '=', 34341131L, 'application/x-executable-file'],
     390          [0L, 'belong', '=', 34341126L, 'application/x-executable-file'],
     391          [0L, 'belong', '=', 34210056L, 'application/x-executable-file'],
     392          [0L, 'belong', '=', 34210055L, 'application/x-executable-file'],
     393          [0L, 'belong', '=', 34341134L, 'application/x-library-file'],
     394          [0L, 'belong', '=', 34341133L, 'application/x-library-file'],
     395          [0L, 'long', '=', 65381L, 'application/x-library-file'],
     396          [0L, 'long', '=', 34275173L, 'application/x-library-file'],
     397          [0L, 'long', '=', 34406245L, 'application/x-library-file'],
     398          [0L, 'long', '=', 34144101L, 'application/x-library-file'],
     399          [0L, 'long', '=', 22552998L, 'application/core'],
     400          [0L, 'long', '=', 1302851304L, 'font/x-hp-windows'],
     401          [0L, 'string', '=', 'Bitmapfile', 'image/unknown'],
     402          [0L, 'string', '=', 'IMGfile', 'CIS image/unknown'],
     403          [0L, 'long', '=', 34341132L, 'application/x-lisp'],
     404          [0L, 'string', '=', 'msgcat01', 'application/x-locale'],
     405          [0L, 'string', '=', 'HPHP48-', 'HP48 binary'],
     406          [0L, 'string', '=', '%%HP:', 'HP48 text'],
     407          [0L, 'beshort', '=', 200L, 'hp200 (68010) BSD'],
     408          [0L, 'beshort', '=', 300L, 'hp300 (68020+68881) BSD'],
     409          [0L, 'beshort', '=', 537L, '370 XA sysV executable'],
     410          [0L, 'beshort', '=', 532L, '370 XA sysV pure executable'],
     411          [0L, 'beshort', '=', 54001L, '370 sysV pure executable'],
     412          [0L, 'beshort', '=', 55001L, '370 XA sysV pure executable'],
     413          [0L, 'beshort', '=', 56401L, '370 sysV executable'],
     414          [0L, 'beshort', '=', 57401L, '370 XA sysV executable'],
     415          [0L, 'beshort', '=', 531L, 'SVR2 executable (Amdahl-UTS)'],
     416          [0L, 'beshort', '=', 534L, 'SVR2 pure executable (Amdahl-UTS)'],
     417          [0L, 'beshort', '=', 530L, 'SVR2 pure executable (USS/370)'],
     418          [0L, 'beshort', '=', 535L, 'SVR2 executable (USS/370)'],
     419          [0L, 'beshort', '=', 479L, 'executable (RISC System/6000 V3.1) or obj module'],
     420          [0L, 'beshort', '=', 260L, 'shared library'],
     421          [0L, 'beshort', '=', 261L, 'ctab data'],
     422          [0L, 'beshort', '=', 65028L, 'structured file'],
     423          [0L, 'string', '=', '0xabcdef', 'AIX message catalog'],
     424          [0L, 'belong', '=', 505L, 'AIX compiled message catalog'],
     425          [0L, 'string', '=', '<aiaff>', 'archive'],
     426          [0L, 'string', '=', 'FORM', 'IFF data'],
     427          [0L, 'string', '=', 'P1', 'image/x-portable-bitmap'],
     428          [0L, 'string', '=', 'P2', 'image/x-portable-graymap'],
     429          [0L, 'string', '=', 'P3', 'image/x-portable-pixmap'],
     430          [0L, 'string', '=', 'P4', 'image/x-portable-bitmap'],
     431          [0L, 'string', '=', 'P5', 'image/x-portable-graymap'],
     432          [0L, 'string', '=', 'P6', 'image/x-portable-pixmap'],
     433          [0L, 'string', '=', 'IIN1', 'image/tiff'],
     434          [0L, 'string', '=', 'MM\000*', 'image/tiff'],
     435          [0L, 'string', '=', 'II*\000', 'image/tiff'],
     436          [0L, 'string', '=', '\211PNG', 'image/x-png'],
     437          [1L, 'string', '=', 'PNG', 'image/x-png'],
     438          [0L, 'string', '=', 'GIF8', 'image/gif'],
     439          [0L, 'string', '=', '\361\000@\273', 'image/x-cmu-raster'],
     440          [0L, 'string', '=', 'id=ImageMagick', 'MIFF image data'],
     441          [0L, 'long', '=', 1123028772L, 'Artisan image data'],
     442          [0L, 'string', '=', '#FIG', 'FIG image text'],
     443          [0L, 'string', '=', 'ARF_BEGARF', 'PHIGS clear text archive'],
     444          [0L, 'string', '=', '@(#)SunPHIGS', 'SunPHIGS'],
     445          [0L, 'string', '=', 'GKSM', 'GKS Metafile'],
     446          [0L, 'string', '=', 'BEGMF', 'clear text Computer Graphics Metafile'],
     447          [0L, 'beshort&0xffe0', '=', 32L, 'binary Computer Graphics Metafile'],
     448          [0L, 'beshort', '=', 12320L, 'character Computer Graphics Metafile'],
     449          [0L, 'string', '=', 'yz', 'MGR bitmap, modern format, 8-bit aligned'],
     450          [0L, 'string', '=', 'zz', 'MGR bitmap, old format, 1-bit deep, 16-bit aligned'],
     451          [0L, 'string', '=', 'xz', 'MGR bitmap, old format, 1-bit deep, 32-bit aligned'],
     452          [0L, 'string', '=', 'yx', 'MGR bitmap, modern format, squeezed'],
     453          [0L, 'string', '=', '%bitmap\000', 'FBM image data'],
     454          [1L, 'string', '=', 'PC Research, Inc', 'group 3 fax data'],
     455          [0L, 'beshort', '=', 65496L, 'image/jpeg'],
     456          [0L, 'string', '=', 'hsi1', 'image/x-jpeg-proprietary'],
     457          [0L, 'string', '=', 'BM', 'image/x-ms-bmp'],
     458          [0L, 'string', '=', 'IC', 'image/x-ico'],
     459          [0L, 'string', '=', 'PI', 'PC pointer image data'],
     460          [0L, 'string', '=', 'CI', 'PC color icon data'],
     461          [0L, 'string', '=', 'CP', 'PC color pointer image data'],
     462          [0L, 'string', '=', '/* XPM */', 'X pixmap image text'],
     463          [0L, 'leshort', '=', 52306L, 'RLE image data,'],
     464          [0L, 'string', '=', 'Imagefile version-', 'iff image data'],
     465          [0L, 'belong', '=', 1504078485L, 'x/x-image-sun-raster'],
     466          [0L, 'beshort', '=', 474L, 'x/x-image-sgi'],
     467          [0L, 'string', '=', 'IT01', 'FIT image data'],
     468          [0L, 'string', '=', 'IT02', 'FIT image data'],
     469          [2048L, 'string', '=', 'PCD_IPI', 'x/x-photo-cd-pack-file'],
     470          [0L, 'string', '=', 'PCD_OPA', 'x/x-photo-cd-overfiew-file'],
     471          [0L, 'string', '=', 'SIMPLE  =', 'FITS image data'],
     472          [0L, 'string', '=', 'This is a BitMap file', 'Lisp Machine bit-array-file'],
     473          [0L, 'string', '=', '!!', 'Bennet Yee\'s "face" format'],
     474          [0L, 'beshort', '=', 4112L, 'PEX Binary Archive'],
     475          [3000L, 'string', '=', 'Visio (TM) Drawing', '%s'],
     476          [0L, 'leshort', '=', 502L, 'basic-16 executable'],
     477          [0L, 'leshort', '=', 503L, 'basic-16 executable (TV)'],
     478          [0L, 'leshort', '=', 510L, 'application/x-executable-file'],
     479          [0L, 'leshort', '=', 511L, 'application/x-executable-file'],
     480          [0L, 'leshort', '=', 512L, 'application/x-executable-file'],
     481          [0L, 'leshort', '=', 522L, 'application/x-executable-file'],
     482          [0L, 'leshort', '=', 514L, 'application/x-executable-file'],
     483          [0L, 'string', '=', '\210OPS', 'Interleaf saved data'],
     484          [0L, 'string', '=', '<!OPS', 'Interleaf document text'],
     485          [4L, 'string', '=', 'pgscriptver', 'IslandWrite document'],
     486          [13L, 'string', '=', 'DrawFile', 'IslandDraw document'],
     487          [0L, 'leshort&0xFFFC', '=', 38400L, 'little endian ispell'],
     488          [0L, 'beshort&0xFFFC', '=', 38400L, 'big endian ispell'],
     489          [0L, 'belong', '=', 3405691582L, 'compiled Java class data,'],
     490          [0L, 'beshort', '=', 44269L, 'Java serialization data'],
     491          [0L, 'string', '=', 'KarmaRHD', 'Version Karma Data Structure Version'],
     492          [0L, 'string', '=', 'lect', 'DEC SRC Virtual Paper Lectern file'],
     493          [53L, 'string', '=', 'yyprevious', 'C program text (from lex)'],
     494          [21L, 'string', '=', 'generated by flex', 'C program text (from flex)'],
     495          [0L, 'string', '=', '%{', 'lex description text'],
     496          [0L, 'short', '=', 32768L, 'lif file'],
     497          [0L, 'lelong', '=', 6553863L, 'Linux/i386 impure executable (OMAGIC)'],
     498          [0L, 'lelong', '=', 6553864L, 'Linux/i386 pure executable (NMAGIC)'],
     499          [0L, 'lelong', '=', 6553867L, 'Linux/i386 demand-paged executable (ZMAGIC)'],
     500          [0L, 'lelong', '=', 6553804L, 'Linux/i386 demand-paged executable (QMAGIC)'],
     501          [0L, 'string', '=', '\007\001\000', 'Linux/i386 object file'],
     502          [0L, 'string', '=', '\001\003\020\004', 'Linux-8086 impure executable'],
     503          [0L, 'string', '=', '\001\003 \004', 'Linux-8086 executable'],
     504          [0L, 'string', '=', '\243\206\001\000', 'Linux-8086 object file'],
     505          [0L, 'string', '=', '\001\003\020\020', 'Minix-386 impure executable'],
     506          [0L, 'string', '=', '\001\003 \020', 'Minix-386 executable'],
     507          [0L, 'string', '=', '*nazgul*', 'Linux compiled message catalog'],
     508          [216L, 'lelong', '=', 421L, 'Linux/i386 core file'],
     509          [2L, 'string', '=', 'LILO', 'Linux/i386 LILO boot/chain loader'],
     510          [0L, 'string', '=', '0.9', ''],
     511          [0L, 'leshort', '=', 1078L, 'font/linux-psf'],
     512          [4086L, 'string', '=', 'SWAP-SPACE', 'Linux/i386 swap file'],
     513          [0L, 'leshort', '=', 387L, 'ECOFF alpha'],
     514          [514L, 'string', '=', 'HdrS', 'Linux kernel'],
     515          [0L, 'belong', '=', 3099592590L, 'Linux kernel'],
     516          [0L, 'string', '=', 'Begin3', 'Linux Software Map entry text'],
     517          [0L, 'string', '=', ';;', 'Lisp/Scheme program text'],
     518          [0L, 'string', '=', '\012(', 'byte-compiled Emacs-Lisp program data'],
     519          [0L, 'string', '=', ';ELC\023\000\000\000', 'byte-compiled Emacs-Lisp program data'],
     520          [0L, 'string', '=', "(SYSTEM::VERSION '", 'CLISP byte-compiled Lisp program text'],
     521          [0L, 'long', '=', 1886817234L, 'CLISP memory image data'],
     522          [0L, 'long', '=', 3532355184L, 'CLISP memory image data, other endian'],
     523          [0L, 'long', '=', 3725722773L, 'GNU-format message catalog data'],
     524          [0L, 'long', '=', 2500072158L, 'GNU-format message catalog data'],
     525          [0L, 'belong', '=', 3405691582L, 'mach-o fat file'],
     526          [0L, 'belong', '=', 4277009102L, 'mach-o'],
     527          [11L, 'string', '=', 'must be converted with BinHex', 'BinHex binary text'],
     528          [0L, 'string', '=', 'SIT!', 'StuffIt Archive (data)'],
     529          [65L, 'string', '=', 'SIT!', 'StuffIt Archive (rsrc + data)'],
     530          [0L, 'string', '=', 'SITD', 'StuffIt Deluxe (data)'],
     531          [65L, 'string', '=', 'SITD', 'StuffIt Deluxe (rsrc + data)'],
     532          [0L, 'string', '=', 'Seg', 'StuffIt Deluxe Segment (data)'],
     533          [65L, 'string', '=', 'Seg', 'StuffIt Deluxe Segment (rsrc + data)'],
     534          [0L, 'string', '=', 'APPL', 'Macintosh Application (data)'],
     535          [65L, 'string', '=', 'APPL', 'Macintosh Application (rsrc + data)'],
     536          [0L, 'string', '=', 'zsys', 'Macintosh System File (data)'],
     537          [65L, 'string', '=', 'zsys', 'Macintosh System File(rsrc + data)'],
     538          [0L, 'string', '=', 'FNDR', 'Macintosh Finder (data)'],
     539          [65L, 'string', '=', 'FNDR', 'Macintosh Finder(rsrc + data)'],
     540          [0L, 'string', '=', 'libr', 'Macintosh Library (data)'],
     541          [65L, 'string', '=', 'libr', 'Macintosh Library(rsrc + data)'],
     542          [0L, 'string', '=', 'shlb', 'Macintosh Shared Library (data)'],
     543          [65L, 'string', '=', 'shlb', 'Macintosh Shared Library(rsrc + data)'],
     544          [0L, 'string', '=', 'cdev', 'Macintosh Control Panel (data)'],
     545          [65L, 'string', '=', 'cdev', 'Macintosh Control Panel(rsrc + data)'],
     546          [0L, 'string', '=', 'INIT', 'Macintosh Extension (data)'],
     547          [65L, 'string', '=', 'INIT', 'Macintosh Extension(rsrc + data)'],
     548          [0L, 'string', '=', 'FFIL', 'font/ttf'],
     549          [65L, 'string', '=', 'FFIL', 'font/ttf'],
     550          [0L, 'string', '=', 'LWFN', 'font/type1'],
     551          [65L, 'string', '=', 'LWFN', 'font/type1'],
     552          [0L, 'string', '=', 'PACT', 'Macintosh Compact Pro Archive (data)'],
     553          [65L, 'string', '=', 'PACT', 'Macintosh Compact Pro Archive(rsrc + data)'],
     554          [0L, 'string', '=', 'ttro', 'Macintosh TeachText File (data)'],
     555          [65L, 'string', '=', 'ttro', 'Macintosh TeachText File(rsrc + data)'],
     556          [0L, 'string', '=', 'TEXT', 'Macintosh TeachText File (data)'],
     557          [65L, 'string', '=', 'TEXT', 'Macintosh TeachText File(rsrc + data)'],
     558          [0L, 'string', '=', 'PDF', 'Macintosh PDF File (data)'],
     559          [65L, 'string', '=', 'PDF', 'Macintosh PDF File(rsrc + data)'],
     560          [0L, 'string', '=', '# Magic', 'magic text file for file(1) cmd'],
     561          [0L, 'string', '=', 'Relay-Version:', 'old news text'],
     562          [0L, 'string', '=', '#! rnews', 'batched news text'],
     563          [0L, 'string', '=', 'N#! rnews', 'mailed, batched news text'],
     564          [0L, 'string', '=', 'Forward to', 'mail forwarding text'],
     565          [0L, 'string', '=', 'Pipe to', 'mail piping text'],
     566          [0L, 'string', '=', 'Return-Path:', 'message/rfc822'],
     567          [0L, 'string', '=', 'Path:', 'message/news'],
     568          [0L, 'string', '=', 'Xref:', 'message/news'],
     569          [0L, 'string', '=', 'From:', 'message/rfc822'],
     570          [0L, 'string', '=', 'Article', 'message/news'],
     571          [0L, 'string', '=', 'BABYL', 'message/x-gnu-rmail'],
     572          [0L, 'string', '=', 'Received:', 'message/rfc822'],
     573          [0L, 'string', '=', 'MIME-Version:', 'MIME entity text'],
     574          [0L, 'string', '=', 'Content-Type: ', ''],
     575          [0L, 'string', '=', 'Content-Type:', ''],
     576          [0L, 'long', '=', 31415L, 'Mirage Assembler m.out executable'],
     577          [0L, 'string', '=', '\311\304', 'ID tags data'],
     578          [0L, 'string', '=', '\001\001\001\001', 'MMDF mailbox'],
     579          [4L, 'string', '=', 'Research,', 'Digifax-G3-File'],
     580          [0L, 'short', '=', 256L, 'raw G3 data, byte-padded'],
     581          [0L, 'short', '=', 5120L, 'raw G3 data'],
     582          [0L, 'string', '=', 'RMD1', 'raw modem data'],
     583          [0L, 'string', '=', 'PVF1\012', 'portable voice format'],
     584          [0L, 'string', '=', 'PVF2\012', 'portable voice format'],
     585          [0L, 'beshort', '=', 520L, 'mc68k COFF'],
     586          [0L, 'beshort', '=', 521L, 'mc68k executable (shared)'],
     587          [0L, 'beshort', '=', 522L, 'mc68k executable (shared demand paged)'],
     588          [0L, 'beshort', '=', 554L, '68K BCS executable'],
     589          [0L, 'beshort', '=', 555L, '88K BCS executable'],
     590          [0L, 'string', '=', 'S0', 'Motorola S-Record; binary data in text format'],
     591          [0L, 'string', '=', '@echo off', 'MS-DOS batch file text'],
     592          [128L, 'string', '=', 'PE\000\000', 'MS Windows PE'],
     593          [0L, 'leshort', '=', 332L, 'MS Windows COFF Intel 80386 object file'],
     594          [0L, 'leshort', '=', 358L, 'MS Windows COFF MIPS R4000 object file'],
     595          [0L, 'leshort', '=', 388L, 'MS Windows COFF Alpha object file'],
     596          [0L, 'leshort', '=', 616L, 'MS Windows COFF Motorola 68000 object file'],
     597          [0L, 'leshort', '=', 496L, 'MS Windows COFF PowerPC object file'],
     598          [0L, 'leshort', '=', 656L, 'MS Windows COFF PA-RISC object file'],
     599          [0L, 'string', '=', 'MZ', 'application/x-ms-dos-executable'],
     600          [0L, 'string', '=', 'LZ', 'MS-DOS executable (built-in)'],
     601          [0L, 'string', '=', 'regf', 'Windows NT Registry file'],
     602          [2080L, 'string', '=', 'Microsoft Word 6.0 Document', 'text/vnd.ms-word'],
     603          [2080L, 'string', '=', 'Documento Microsoft Word 6', 'text/vnd.ms-word'],
     604          [2112L, 'string', '=', 'MSWordDoc', 'text/vnd.ms-word'],
     605          [0L, 'belong', '=', 834535424L, 'text/vnd.ms-word'],
     606          [0L, 'string', '=', 'PO^Q`', 'text/vnd.ms-word'],
     607          [2080L, 'string', '=', 'Microsoft Excel 5.0 Worksheet', 'application/vnd.ms-excel'],
     608          [2114L, 'string', '=', 'Biff5', 'application/vnd.ms-excel'],
     609          [0L, 'belong', '=', 6656L, 'Lotus 1-2-3'],
     610          [0L, 'belong', '=', 512L, 'Lotus 1-2-3'],
     611          [1L, 'string', '=', 'WPC', 'text/vnd.wordperfect'],
     612          [0L, 'beshort', '=', 610L, 'Tower/XP rel 2 object'],
     613          [0L, 'beshort', '=', 615L, 'Tower/XP rel 2 object'],
     614          [0L, 'beshort', '=', 620L, 'Tower/XP rel 3 object'],
     615          [0L, 'beshort', '=', 625L, 'Tower/XP rel 3 object'],
     616          [0L, 'beshort', '=', 630L, 'Tower32/600/400 68020 object'],
     617          [0L, 'beshort', '=', 640L, 'Tower32/800 68020'],
     618          [0L, 'beshort', '=', 645L, 'Tower32/800 68010'],
     619          [0L, 'lelong', '=', 407L, 'NetBSD little-endian object file'],
     620          [0L, 'belong', '=', 407L, 'NetBSD big-endian object file'],
     621          [0L, 'belong&0377777777', '=', 41400413L, 'NetBSD/i386 demand paged'],
     622          [0L, 'belong&0377777777', '=', 41400410L, 'NetBSD/i386 pure'],
     623          [0L, 'belong&0377777777', '=', 41400407L, 'NetBSD/i386'],
     624          [0L, 'belong&0377777777', '=', 41400507L, 'NetBSD/i386 core'],
     625          [0L, 'belong&0377777777', '=', 41600413L, 'NetBSD/m68k demand paged'],
     626          [0L, 'belong&0377777777', '=', 41600410L, 'NetBSD/m68k pure'],
     627          [0L, 'belong&0377777777', '=', 41600407L, 'NetBSD/m68k'],
     628          [0L, 'belong&0377777777', '=', 41600507L, 'NetBSD/m68k core'],
     629          [0L, 'belong&0377777777', '=', 42000413L, 'NetBSD/m68k4k demand paged'],
     630          [0L, 'belong&0377777777', '=', 42000410L, 'NetBSD/m68k4k pure'],
     631          [0L, 'belong&0377777777', '=', 42000407L, 'NetBSD/m68k4k'],
     632          [0L, 'belong&0377777777', '=', 42000507L, 'NetBSD/m68k4k core'],
     633          [0L, 'belong&0377777777', '=', 42200413L, 'NetBSD/ns32532 demand paged'],
     634          [0L, 'belong&0377777777', '=', 42200410L, 'NetBSD/ns32532 pure'],
     635          [0L, 'belong&0377777777', '=', 42200407L, 'NetBSD/ns32532'],
     636          [0L, 'belong&0377777777', '=', 42200507L, 'NetBSD/ns32532 core'],
     637          [0L, 'belong&0377777777', '=', 42400413L, 'NetBSD/sparc demand paged'],
     638          [0L, 'belong&0377777777', '=', 42400410L, 'NetBSD/sparc pure'],
     639          [0L, 'belong&0377777777', '=', 42400407L, 'NetBSD/sparc'],
     640          [0L, 'belong&0377777777', '=', 42400507L, 'NetBSD/sparc core'],
     641          [0L, 'belong&0377777777', '=', 42600413L, 'NetBSD/pmax demand paged'],
     642          [0L, 'belong&0377777777', '=', 42600410L, 'NetBSD/pmax pure'],
     643          [0L, 'belong&0377777777', '=', 42600407L, 'NetBSD/pmax'],
     644          [0L, 'belong&0377777777', '=', 42600507L, 'NetBSD/pmax core'],
     645          [0L, 'belong&0377777777', '=', 43000413L, 'NetBSD/vax demand paged'],
     646          [0L, 'belong&0377777777', '=', 43000410L, 'NetBSD/vax pure'],
     647          [0L, 'belong&0377777777', '=', 43000407L, 'NetBSD/vax'],
     648          [0L, 'belong&0377777777', '=', 43000507L, 'NetBSD/vax core'],
     649          [0L, 'lelong', '=', 459141L, 'ECOFF NetBSD/alpha binary'],
     650          [0L, 'belong&0377777777', '=', 43200507L, 'NetBSD/alpha core'],
     651          [0L, 'belong&0377777777', '=', 43400413L, 'NetBSD/mips demand paged'],
     652          [0L, 'belong&0377777777', '=', 43400410L, 'NetBSD/mips pure'],
     653          [0L, 'belong&0377777777', '=', 43400407L, 'NetBSD/mips'],
     654          [0L, 'belong&0377777777', '=', 43400507L, 'NetBSD/mips core'],
     655          [0L, 'belong&0377777777', '=', 43600413L, 'NetBSD/arm32 demand paged'],
     656          [0L, 'belong&0377777777', '=', 43600410L, 'NetBSD/arm32 pure'],
     657          [0L, 'belong&0377777777', '=', 43600407L, 'NetBSD/arm32'],
     658          [0L, 'belong&0377777777', '=', 43600507L, 'NetBSD/arm32 core'],
     659          [0L, 'string', '=', 'StartFontMetrics', 'font/x-sunos-news'],
     660          [0L, 'string', '=', 'StartFont', 'font/x-sunos-news'],
     661          [0L, 'belong', '=', 326773060L, 'font/x-sunos-news'],
     662          [0L, 'belong', '=', 326773063L, 'font/x-sunos-news'],
     663          [0L, 'belong', '=', 326773072L, 'font/x-sunos-news'],
     664          [0L, 'belong', '=', 326773073L, 'font/x-sunos-news'],
     665          [8L, 'belong', '=', 326773573L, 'font/x-sunos-news'],
     666          [8L, 'belong', '=', 326773576L, 'font/x-sunos-news'],
     667          [0L, 'string', '=', 'Octave-1-L', 'Octave binary data (little endian)'],
     668          [0L, 'string', '=', 'Octave-1-B', 'Octave binary data (big endian)'],
     669          [0L, 'string', '=', '\177OLF', 'OLF'],
     670          [0L, 'beshort', '=', 34765L, 'OS9/6809 module:'],
     671          [0L, 'beshort', '=', 19196L, 'OS9/68K module:'],
     672          [0L, 'long', '=', 61374L, 'OSF/Rose object'],
     673          [0L, 'short', '=', 565L, 'i386 COFF object'],
     674          [0L, 'short', '=', 10775L, '"compact bitmap" format (Poskanzer)'],
     675          [0L, 'string', '=', '%PDF-', 'PDF document'],
     676          [0L, 'lelong', '=', 101555L, 'PDP-11 single precision APL workspace'],
     677          [0L, 'lelong', '=', 101554L, 'PDP-11 double precision APL workspace'],
     678          [0L, 'leshort', '=', 407L, 'PDP-11 executable'],
     679          [0L, 'leshort', '=', 401L, 'PDP-11 UNIX/RT ldp'],
     680          [0L, 'leshort', '=', 405L, 'PDP-11 old overlay'],
     681          [0L, 'leshort', '=', 410L, 'PDP-11 pure executable'],
     682          [0L, 'leshort', '=', 411L, 'PDP-11 separate I&D executable'],
     683          [0L, 'leshort', '=', 437L, 'PDP-11 kernel overlay'],
     684          [0L, 'beshort', '=', 39168L, 'PGP key public ring'],
     685          [0L, 'beshort', '=', 38145L, 'PGP key security ring'],
     686          [0L, 'beshort', '=', 38144L, 'PGP key security ring'],
     687          [0L, 'beshort', '=', 42496L, 'PGP encrypted data'],
     688          [0L, 'string', '=', '-----BEGIN PGP', 'PGP armored data'],
     689          [0L, 'string', '=', '# PaCkAgE DaTaStReAm', 'pkg Datastream (SVR4)'],
     690          [0L, 'short', '=', 601L, 'mumps avl global'],
     691          [0L, 'short', '=', 602L, 'mumps blt global'],
     692          [0L, 'string', '=', '%!', 'application/postscript'],
     693          [0L, 'string', '=', '\004%!', 'application/postscript'],
     694          [0L, 'belong', '=', 3318797254L, 'DOS EPS Binary File'],
     695          [0L, 'string', '=', '*PPD-Adobe:', 'PPD file'],
     696          [0L, 'string', '=', '\033%-12345X@PJL', 'HP Printer Job Language data'],
     697          [0L, 'string', '=', '\033%-12345X@PJL', 'HP Printer Job Language data'],
     698          [0L, 'string', '=', '\033E\033', 'image/x-pcl-hp'],
     699          [0L, 'string', '=', '@document(', 'Imagen printer'],
     700          [0L, 'string', '=', 'Rast', 'RST-format raster font data'],
     701          [0L, 'belong&0xff00ffff', '=', 1442840576L, 'ps database'],
     702          [0L, 'long', '=', 1351614727L, 'Pyramid 90x family executable'],
     703          [0L, 'long', '=', 1351614728L, 'Pyramid 90x family pure executable'],
     704          [0L, 'long', '=', 1351614731L, 'Pyramid 90x family demand paged pure executable'],
     705          [0L, 'beshort', '=', 60843L, ''],
     706          [0L, 'string', '=', '{\\\\rtf', 'Rich Text Format data,'],
     707          [38L, 'string', '=', 'Spreadsheet', 'sc spreadsheet file'],
     708          [8L, 'string', '=', '\001s SCCS', 'archive data'],
     709          [0L, 'byte', '=', 46L, 'Sendmail frozen configuration'],
     710          [0L, 'short', '=', 10012L, 'Sendmail frozen configuration'],
     711          [0L, 'lelong', '=', 234L, 'BALANCE NS32000 .o'],
     712          [0L, 'lelong', '=', 4330L, 'BALANCE NS32000 executable (0 @ 0)'],
     713          [0L, 'lelong', '=', 8426L, 'BALANCE NS32000 executable (invalid @ 0)'],
     714          [0L, 'lelong', '=', 12522L, 'BALANCE NS32000 standalone executable'],
     715          [0L, 'leshort', '=', 4843L, 'SYMMETRY i386 .o'],
     716          [0L, 'leshort', '=', 8939L, 'SYMMETRY i386 executable (0 @ 0)'],
     717          [0L, 'leshort', '=', 13035L, 'SYMMETRY i386 executable (invalid @ 0)'],
     718          [0L, 'leshort', '=', 17131L, 'SYMMETRY i386 standalone executable'],
     719          [0L, 'string', '=', 'kbd!map', 'kbd map file'],
     720          [0L, 'belong', '=', 407L, 'old SGI 68020 executable'],
     721          [0L, 'belong', '=', 410L, 'old SGI 68020 pure executable'],
     722          [0L, 'beshort', '=', 34661L, 'disk quotas file'],
     723          [0L, 'beshort', '=', 1286L, 'IRIS Showcase file'],
     724          [0L, 'beshort', '=', 550L, 'IRIS Showcase template'],
     725          [0L, 'belong', '=', 1396917837L, 'IRIS Showcase file'],
     726          [0L, 'belong', '=', 1413695053L, 'IRIS Showcase template'],
     727          [0L, 'belong', '=', 3735927486L, 'IRIX Parallel Arena'],
     728          [0L, 'beshort', '=', 352L, 'MIPSEB COFF executable'],
     729          [0L, 'beshort', '=', 354L, 'MIPSEL COFF executable'],
     730          [0L, 'beshort', '=', 24577L, 'MIPSEB-LE COFF executable'],
     731          [0L, 'beshort', '=', 25089L, 'MIPSEL-LE COFF executable'],
     732          [0L, 'beshort', '=', 355L, 'MIPSEB MIPS-II COFF executable'],
     733          [0L, 'beshort', '=', 358L, 'MIPSEL MIPS-II COFF executable'],
     734          [0L, 'beshort', '=', 25345L, 'MIPSEB-LE MIPS-II COFF executable'],
     735          [0L, 'beshort', '=', 26113L, 'MIPSEL-LE MIPS-II COFF executable'],
     736          [0L, 'beshort', '=', 320L, 'MIPSEB MIPS-III COFF executable'],
     737          [0L, 'beshort', '=', 322L, 'MIPSEL MIPS-III COFF executable'],
     738          [0L, 'beshort', '=', 16385L, 'MIPSEB-LE MIPS-III COFF executable'],
     739          [0L, 'beshort', '=', 16897L, 'MIPSEL-LE MIPS-III COFF executable'],
     740          [0L, 'beshort', '=', 384L, 'MIPSEB Ucode'],
     741          [0L, 'beshort', '=', 386L, 'MIPSEL Ucode'],
     742          [0L, 'belong', '=', 3735924144L, 'IRIX core dump'],
     743          [0L, 'belong', '=', 3735924032L, 'IRIX 64-bit core dump'],
     744          [0L, 'belong', '=', 3133063355L, 'IRIX N32 core dump'],
     745          [0L, 'string', '=', 'CrshDump', 'IRIX vmcore dump of'],
     746          [0L, 'string', '=', 'SGIAUDIT', 'SGI Audit file'],
     747          [0L, 'string', '=', 'WNGZWZSC', 'Wingz compiled script'],
     748          [0L, 'string', '=', 'WNGZWZSS', 'Wingz spreadsheet'],
     749          [0L, 'string', '=', 'WNGZWZHP', 'Wingz help file'],
     750          [0L, 'string', '=', '\\#Inventor', 'V IRIS Inventor 1.0 file'],
     751          [0L, 'string', '=', '\\#Inventor', 'V2 Open Inventor 2.0 file'],
     752          [0L, 'string', '=', 'glfHeadMagic();', 'GLF_TEXT'],
     753          [4L, 'belong', '=', 1090584576L, 'GLF_BINARY_LSB_FIRST'],
     754          [4L, 'belong', '=', 321L, 'GLF_BINARY_MSB_FIRST'],
     755          [0L, 'string', '=', '<!DOCTYPE HTML', 'text/html'],
     756          [0L, 'string', '=', '<!doctype html', 'text/html'],
     757          [0L, 'string', '=', '<HEAD', 'text/html'],
     758          [0L, 'string', '=', '<head', 'text/html'],
     759          [0L, 'string', '=', '<TITLE', 'text/html'],
     760          [0L, 'string', '=', '<title', 'text/html'],
     761          [0L, 'string', '=', '<html', 'text/html'],
     762          [0L, 'string', '=', '<HTML', 'text/html'],
     763          [0L, 'string', '=', '<!DOCTYPE', 'exported SGML document text'],
     764          [0L, 'string', '=', '<!doctype', 'exported SGML document text'],
     765          [0L, 'string', '=', '<!SUBDOC', 'exported SGML subdocument text'],
     766          [0L, 'string', '=', '<!subdoc', 'exported SGML subdocument text'],
     767          [0L, 'string', '=', '<!--', 'exported SGML document text'],
     768          [0L, 'string', '=', 'RTSS', 'NetMon capture file'],
     769          [0L, 'string', '=', 'TRSNIFF data    \032', 'Sniffer capture file'],
     770          [0L, 'string', '=', 'XCP\000', 'NetXRay capture file'],
     771          [0L, 'ubelong', '=', 2712847316L, 'tcpdump capture file (big-endian)'],
     772          [0L, 'ulelong', '=', 2712847316L, 'tcpdump capture file (little-endian)'],
     773          [0L, 'string', '=', '<!SQ DTD>', 'Compiled SGML rules file'],
     774          [0L, 'string', '=', '<!SQ A/E>', 'A/E SGML Document binary'],
     775          [0L, 'string', '=', '<!SQ STS>', 'A/E SGML binary styles file'],
     776          [0L, 'short', '=', 49374L, 'Compiled PSI (v1) data'],
     777          [0L, 'short', '=', 49370L, 'Compiled PSI (v2) data'],
     778          [0L, 'short', '=', 125252L, 'SoftQuad DESC or font file binary'],
     779          [0L, 'string', '=', 'SQ BITMAP1', 'SoftQuad Raster Format text'],
     780          [0L, 'string', '=', 'X SoftQuad', 'troff Context intermediate'],
     781          [0L, 'belong&077777777', '=', 600413L, 'sparc demand paged'],
     782          [0L, 'belong&077777777', '=', 600410L, 'sparc pure'],
     783          [0L, 'belong&077777777', '=', 600407L, 'sparc'],
     784          [0L, 'belong&077777777', '=', 400413L, 'mc68020 demand paged'],
     785          [0L, 'belong&077777777', '=', 400410L, 'mc68020 pure'],
     786          [0L, 'belong&077777777', '=', 400407L, 'mc68020'],
     787          [0L, 'belong&077777777', '=', 200413L, 'mc68010 demand paged'],
     788          [0L, 'belong&077777777', '=', 200410L, 'mc68010 pure'],
     789          [0L, 'belong&077777777', '=', 200407L, 'mc68010'],
     790          [0L, 'belong', '=', 407L, 'old sun-2 executable'],
     791          [0L, 'belong', '=', 410L, 'old sun-2 pure executable'],
     792          [0L, 'belong', '=', 413L, 'old sun-2 demand paged executable'],
     793          [0L, 'belong', '=', 525398L, 'SunOS core file'],
     794          [0L, 'long', '=', 4197695630L, 'SunPC 4.0 Hard Disk'],
     795          [0L, 'string', '=', '#SUNPC_CONFIG', 'SunPC 4.0 Properties Values'],
     796          [0L, 'string', '=', 'snoop', 'Snoop capture file'],
     797          [36L, 'string', '=', 'acsp', 'Kodak Color Management System, ICC Profile'],
     798          [0L, 'string', '=', '#!teapot\012xdr', 'teapot work sheet (XDR format)'],
     799          [0L, 'string', '=', '\032\001', 'Compiled terminfo entry'],
     800          [0L, 'short', '=', 433L, 'Curses screen image'],
     801          [0L, 'short', '=', 434L, 'Curses screen image'],
     802          [0L, 'string', '=', '\367\002', 'TeX DVI file'],
     803          [0L, 'string', '=', '\367\203', 'font/x-tex'],
     804          [0L, 'string', '=', '\367Y', 'font/x-tex'],
     805          [0L, 'string', '=', '\367\312', 'font/x-tex'],
     806          [0L, 'string', '=', 'This is TeX,', 'TeX transcript text'],
     807          [0L, 'string', '=', 'This is METAFONT,', 'METAFONT transcript text'],
     808          [2L, 'string', '=', '\000\021', 'font/x-tex-tfm'],
     809          [2L, 'string', '=', '\000\022', 'font/x-tex-tfm'],
     810          [0L, 'string', '=', '\\\\input\\', 'texinfo Texinfo source text'],
     811          [0L, 'string', '=', 'This is Info file', 'GNU Info text'],
     812          [0L, 'string', '=', '\\\\input', 'TeX document text'],
     813          [0L, 'string', '=', '\\\\section', 'LaTeX document text'],
     814          [0L, 'string', '=', '\\\\setlength', 'LaTeX document text'],
     815          [0L, 'string', '=', '\\\\documentstyle', 'LaTeX document text'],
     816          [0L, 'string', '=', '\\\\chapter', 'LaTeX document text'],
     817          [0L, 'string', '=', '\\\\documentclass', 'LaTeX 2e document text'],
     818          [0L, 'string', '=', '\\\\relax', 'LaTeX auxiliary file'],
     819          [0L, 'string', '=', '\\\\contentsline', 'LaTeX table of contents'],
     820          [0L, 'string', '=', '\\\\indexentry', 'LaTeX raw index file'],
     821          [0L, 'string', '=', '\\\\begin{theindex}', 'LaTeX sorted index'],
     822          [0L, 'string', '=', '\\\\glossaryentry', 'LaTeX raw glossary'],
     823          [0L, 'string', '=', '\\\\begin{theglossary}', 'LaTeX sorted glossary'],
     824          [0L, 'string', '=', 'This is makeindex', 'Makeindex log file'],
     825          [0L, 'string', '=', '**TI82**', 'TI-82 Graphing Calculator'],
     826          [0L, 'string', '=', '**TI83**', 'TI-83 Graphing Calculator'],
     827          [0L, 'string', '=', '**TI85**', 'TI-85 Graphing Calculator'],
     828          [0L, 'string', '=', '**TI92**', 'TI-92 Graphing Calculator'],
     829          [0L, 'string', '=', '**TI80**', 'TI-80 Graphing Calculator File.'],
     830          [0L, 'string', '=', '**TI81**', 'TI-81 Graphing Calculator File.'],
     831          [0L, 'string', '=', 'TZif', 'timezone data'],
     832          [0L, 'string', '=', '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000', 'old timezone data'],
     833          [0L, 'string', '=', '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000', 'old timezone data'],
     834          [0L, 'string', '=', '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\003\000', 'old timezone data'],
     835          [0L, 'string', '=', '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000', 'old timezone data'],
     836          [0L, 'string', '=', '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\005\000', 'old timezone data'],
     837          [0L, 'string', '=', '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\006\000', 'old timezone data'],
     838          [0L, 'string', '=', '.\\\\"', 'troff or preprocessor input text'],
     839          [0L, 'string', '=', '\'\\\\"', 'troff or preprocessor input text'],
     840          [0L, 'string', '=', '\'.\\\\"', 'troff or preprocessor input text'],
     841          [0L, 'string', '=', '\\\\"', 'troff or preprocessor input text'],
     842          [0L, 'string', '=', 'x T', 'ditroff text'],
     843          [0L, 'string', '=', '@\357', 'very old (C/A/T) troff output data'],
     844          [0L, 'string', '=', 'Interpress/Xerox', 'Xerox InterPress data'],
     845          [0L, 'short', '=', 263L, 'unknown machine executable'],
     846          [0L, 'short', '=', 264L, 'unknown pure executable'],
     847          [0L, 'short', '=', 265L, 'PDP-11 separate I&D'],
     848          [0L, 'short', '=', 267L, 'unknown pure executable'],
     849          [0L, 'long', '=', 268L, 'unknown demand paged pure executable'],
     850          [0L, 'long', '=', 269L, 'unknown demand paged pure executable'],
     851          [0L, 'long', '=', 270L, 'unknown readable demand paged pure executable'],
     852          [0L, 'string', '=', 'begin uuencoded', 'or xxencoded text'],
     853          [0L, 'string', '=', 'xbtoa Begin', "btoa'd text"],
     854          [0L, 'string', '=', '$\012ship', "ship'd binary text"],
     855          [0L, 'string', '=', 'Decode the following with bdeco', 'bencoded News text'],
     856          [11L, 'string', '=', 'must be converted with BinHex', 'BinHex binary text'],
     857          [0L, 'short', '=', 610L, 'Perkin-Elmer executable'],
     858          [0L, 'beshort', '=', 572L, 'amd 29k coff noprebar executable'],
     859          [0L, 'beshort', '=', 1572L, 'amd 29k coff prebar executable'],
     860          [0L, 'beshort', '=', 160007L, 'amd 29k coff archive'],
     861          [6L, 'beshort', '=', 407L, 'unicos (cray) executable'],
     862          [596L, 'string', '=', 'X\337\377\377', 'Ultrix core file'],
     863          [0L, 'string', '=', 'Joy!peffpwpc', 'header for PowerPC PEF executable'],
     864          [0L, 'lelong', '=', 101557L, 'VAX single precision APL workspace'],
     865          [0L, 'lelong', '=', 101556L, 'VAX double precision APL workspace'],
     866          [0L, 'lelong', '=', 407L, 'VAX executable'],
     867          [0L, 'lelong', '=', 410L, 'VAX pure executable'],
     868          [0L, 'lelong', '=', 413L, 'VAX demand paged pure executable'],
     869          [0L, 'leshort', '=', 570L, 'VAX COFF executable'],
     870          [0L, 'leshort', '=', 575L, 'VAX COFF pure executable'],
     871          [0L, 'string', '=', 'LBLSIZE=', 'VICAR image data'],
     872          [43L, 'string', '=', 'SFDU_LABEL', 'VICAR label file'],
     873          [0L, 'short', '=', 21845L, 'VISX image file'],
     874          [0L, 'string', '=', '\260\0000\000', 'VMS VAX executable'],
     875          [0L, 'belong', '=', 50331648L, 'VMS Alpha executable'],
     876          [1L, 'string', '=', 'WPC', '(Corel/WP)'],
     877          [0L, 'string', '=', 'core', 'core file (Xenix)'],
     878          [0L, 'byte', '=', 128L, '8086 relocatable (Microsoft)'],
     879          [0L, 'leshort', '=', 65381L, 'x.out'],
     880          [0L, 'leshort', '=', 518L, 'Microsoft a.out'],
     881          [0L, 'leshort', '=', 320L, 'old Microsoft 8086 x.out'],
     882          [0L, 'lelong', '=', 518L, 'b.out'],
     883          [0L, 'leshort', '=', 1408L, 'XENIX 8086 relocatable or 80286 small model'],
     884          [0L, 'long', '=', 59399L, 'object file (z8000 a.out)'],
     885          [0L, 'long', '=', 59400L, 'pure object file (z8000 a.out)'],
     886          [0L, 'long', '=', 59401L, 'separate object file (z8000 a.out)'],
     887          [0L, 'long', '=', 59397L, 'overlay object file (z8000 a.out)'],
     888          [0L, 'string', '=', 'ZyXEL\002', 'ZyXEL voice data'],
     889  ]
     890  #=================================================================
     891  magicNumbers = []
     892
     893 -def strToNum(n):
     894          val = 0
     895          col = long(1)
     896          if n[:1] == 'x': n = '0' + n
     897          if n[:2] == '0x':
     898                  # hex
     899                  n = string.lower(n[2:])
     900                  while len(n) > 0:
     901                          l = n[len(n) - 1]
     902                          val = val + string.hexdigits.index(l) * col
     903                          col = col * 16
     904                          n = n[:len(n)-1]
     905          elif n[0] == '\\':
     906                  # octal
     907                  n = n[1:]
     908                  while len(n) > 0:
     909                          l = n[len(n) - 1]
     910                          if ord(l) < 48 or ord(l) > 57: break
     911                          val = val + int(l) * col
     912                          col = col * 8
     913                          n = n[:len(n)-1]
     914          else:
     915                  val = string.atol(n)
     916          return val
     917
     918 -def unescape(s):
     919          # replace string escape sequences
     920          while 1:
     921                  m = re.search(r'\\', s)
     922                  if not m: break
     923                  x = m.start()+1
     924                  if m.end() == len(s):
     925                          # escaped space at end
     926                          s = s[:len(s)-1] + ' '
     927                  elif s[x:x+2] == '0x':
     928                          # hex ascii value
     929                          c = chr(strToNum(s[x:x+4]))
     930                          s = s[:x-1] + c + s[x+4:]
     931                  elif s[m.start()+1] == 'x':
     932                          # hex ascii value
     933                          c = chr(strToNum(s[x:x+3]))
     934                          s = s[:x-1] + c + s[x+3:]
     935                  elif ord(s[x]) > 47 and ord(s[x]) < 58:
     936                          # octal ascii value
     937                          end = x
     938                          while (ord(s[end]) > 47 and ord(s[end]) < 58):
     939                                  end = end + 1
     940                                  if end > len(s) - 1: break
     941                          c = chr(strToNum(s[x-1:end]))
     942                          s = s[:x-1] + c + s[end:]
     943                  elif s[x] == 'n':
     944                          # newline
     945                          s = s[:x-1] + '\n' + s[x+1:]
     946                  else:
     947                          break
     948          return s
     949
     950 -class magicTest:
     951 -        def __init__(self, offset, t, op, value, msg, mask = None):
     952                  if t.count('&') > 0:
     953                          mask = strToNum(t[t.index('&')+1:])
     954                          t = t[:t.index('&')]
     955                  if type(offset) == type('a'):
     956                          self.offset = strToNum(offset)
     957                  else:
     958                          self.offset = offset
     959                  self.type = t
     960                  self.msg = msg
     961                  self.subTests = []
     962                  self.op = op
     963                  self.mask = mask
     964                  self.value = value
     965
     966
     967 -        def test(self, data):
     968                  if self.mask:
     969                          data = data & self.mask
     970                  if self.op == '=':
     971                          if self.value == data: return self.msg
     972                  elif self.op ==  '<':
     973                          pass
     974                  elif self.op ==  '>':
     975                          pass
     976                  elif self.op ==  '&':
     977                          pass
     978                  elif self.op ==  '^':
     979                          pass
     980                  return None
     981
     982 -        def compare(self, data):
     983                  #print str([self.type, self.value, self.msg])
     984                  try:
     985                          if self.type == 'string':
     986                                  c = ''; s = ''
     987                                  for i in range(0, len(self.value)+1):
     988                                          if (i + self.offset) > (len(data) - 1): break
     989                                          s = s + c
     990                                          [c] = struct.unpack('c', data[self.offset + i])
     991                                  data = s
     992                          elif self.type == 'short':
     993                                  [data] = struct.unpack('h', data[self.offset : self.offset + 2])
     994                          elif self.type == 'leshort':
     995                                  [data] = struct.unpack('<h', data[self.offset : self.offset + 2])
     996                          elif self.type == 'beshort':
     997                                  [data] = struct.unpack('>H', data[self.offset : self.offset + 2])
     998                          elif self.type == 'long':
     999                                  [data] = struct.unpack('l', data[self.offset : self.offset + 4])
    1000                          elif self.type == 'lelong':
    1001                                  [data] = struct.unpack('<l', data[self.offset : self.offset + 4])
    1002                          elif self.type == 'belong':
    1003                                  [data] = struct.unpack('>l', data[self.offset : self.offset + 4])
    1004                          else:
    1005                                  #print 'UNKNOWN TYPE: ' + self.type
    1006                                  pass
    1007                  except:
    1008                          return None
    1009
    1010  #    print str([self.msg, self.value, data])
    1011                  return self.test(data)
    1012
    1013
    1014 -def load(file):
    1015          global magicNumbers
    1016          lines = open(file).readlines()
    1017          last = { 0: None }
    1018          for line in lines:
    1019                  if re.match(r'\s*#', line):
    1020                          # comment
    1021                          continue
    1022                  else:
    1023                          # split up by space delimiters, and remove trailing space
    1024                          line = string.rstrip(line)
    1025                          line = re.split(r'\s*', line)
    1026                          if len(line) < 3:
    1027                                  # bad line
    1028                                  continue
    1029                          offset = line[0]
    1030                          type = line[1]
    1031                          value = line[2]
    1032                          level = 0
    1033                          while offset[0] == '>':
    1034                                  # count the level of the type
    1035                                  level = level + 1
    1036                                  offset = offset[1:]
    1037                          l = magicNumbers
    1038                          if level > 0:
    1039                                  l = last[level - 1].subTests
    1040                          if offset[0] == '(':
    1041                                  # don't handle indirect offsets just yet
    1042                                  print 'SKIPPING ' + string.join(list(line[3:]))
    1043                                  pass
    1044                          elif offset[0] == '&':
    1045                                  # don't handle relative offsets just yet
    1046                                  print 'SKIPPING ' + string.join(list(line[3:]))
    1047                                  pass
    1048                          else:
    1049                                  operands = ['=', '<', '>', '&']
    1050                                  if operands.count(value[0]) > 0:
    1051                                          # a comparison operator is specified
    1052                                          op = value[0]
    1053                                          value = value[1:]
    1054                                  else:
    1055                                          print str([value, operands])
    1056                                          if len(value) >1 and value[0] == '\\' and operands.count(value[1]) >0:
    1057                                                  # literal value that collides with operands is escaped
    1058                                                  value = value[1:]
    1059                                          op = '='
    1060
    1061                                  mask = None
    1062                                  if type == 'string':
    1063                                          while 1:
    1064                                                  value = unescape(value)
    1065                                                  if value[len(value)-1] == ' ' and len(line) > 3:
    1066                                                          # last value was an escaped space, join
    1067                                                          value = value + line[3]
    1068                                                          del line[3]
    1069                                                  else:
    1070                                                          break
    1071                                  else:
    1072                                          if value.count('&') != 0:
    1073                                                  mask = value[(value.index('&') + 1):]
    1074                                                  print 'MASK: ' + mask
    1075                                                  value = value[:(value.index('&')+1)]
    1076                                          try: value = strToNum(value)
    1077                                          except: continue
    1078                                          msg = string.join(list(line[3:]))
    1079                                  new = magicTest(offset, type, op, value, msg, mask)
    1080                                  last[level] = new
    1081                                  l.append(new)
    1082
    1083 -def whatis(data):
    1084          for test in magicNumbers:
    1085                   m = test.compare(data)
    1086                   if m: return m
    1087          # no matching, magic number. is it binary or text?
    1088          for c in data:
    1089                  if ord(c) > 128:
    1090                          return 'data'
    1091          # its ASCII, now do text tests
    1092          if string.find('The', data, 0, 8192) > -1:
    1093                  return 'English text'
    1094          if string.find('def', data, 0, 8192) > -1:
    1095                  return 'Python Source'
    1096          return 'ASCII text'
    1097
    1098
    1099 -def file(file):
    1100          try:
    1101                  return whatis(open(file, 'r').read(8192))
    1102          except Exception, e:
    1103                  if str(e) == '[Errno 21] Is a directory':
    1104                          return 'directory'
    1105                  else:
    1106                          raise e
    1107
    1108
    1109  #### BUILD DATA ####
    1110  #load('mime-magic')
    1111  #f = open('out', 'w')
    1112  #for m in magicNumbers:
    1113  #  f.write(str([m.offset, m.type, m.op, m.value, m.msg]) + ',\n')
    1114  #f.close
    1115
    1116  import sys
    1117  for m in magic:
    1118          magicNumbers.append(magicTest(m[0], m[1], m[2], m[3], m[4]))
    1119
    1120  #=================================================================
    1121  if __name__ == '__main__':
    1122          import sys
    1123          for arg in sys.argv[1:]:
    1124                  msg = file(arg)
    1125                  if msg:
    1126                          print arg + ': ' + msg
    1127                  else:
    1128                          print arg + ': unknown'
    1129  #=================================================================
    1130  # $Log: gmMimeMagic.py,v $
    1131  # Revision 1.2  2009-09-13 18:31:57  ncq
    1132  # - proper mimetype for bitmaps
    1133  #
    1134  # Revision 1.1  2004/02/25 09:30:13  ncq
    1135  # - moved here from python-common
    1136  #
    1137  # Revision 1.3  2003/11/17 10:56:36  sjtan
    1138  #
    1139  # synced and commiting.
    1140  #
    1141  # Revision 1.1  2003/10/23 06:02:39  sjtan
    1142  #
    1143  # manual edit areas modelled after r.terry's specs.
    1144  #
    1145  # Revision 1.2  2003/02/27 09:18:48  ncq
    1146  # - added TODO
    1147  #
    1148  # Revision 1.1  2003/02/14 00:32:21  ncq
    1149  # - Mime magic data
    1150  #
    1151