magic 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #------------------------------------------------------------------------------
  2. # $File: magic,v 1.12 2024/06/10 23:09:52 christos Exp $
  3. # magic: file(1) magic for magic files
  4. #
  5. # Update: Joerg Jenderek
  6. # skip Magicsee_R1.cfg found on retropie starting with # Magicsee R1 one-handed controller
  7. 0 string/t #\ Magic\ magic text file for file(1) cmd
  8. #!:mime text/plain
  9. !:mime text/x-file
  10. # no suffix in ../Header
  11. !:ext /
  12. #
  13. # some (34/339) samples start with a comment line
  14. 0 ubyte =0x23
  15. # some (28/339) samples start with separator line (about 78 minus characters) like:
  16. # archive arm assembler beetle c-lang clojure compress der filesystems firmware gentoo lammps
  17. # m4 mail.news make marc21 music parrot pascal pc88 pc98 perl ringdove tcl varied.script webassembly x68000 zfs
  18. >4 string --------
  19. # skip scripts fse.sed stage1.sed constants.pxi gotmail.awk from fetchmail package by
  20. # searching for reference to man page file(1) {lammps v 1.1} or file (1) {muscic v 1.1}
  21. >>12 search/180 (1)
  22. >>>0 use magic-fragment
  23. # few (6/339) samples with 1st comment line and without separator comment line
  24. # like: blcr bsi selinux sisu ssh svf
  25. >4 default x
  26. # few sample with 1st comment line and without seperator comment line and regular expression like: sisu
  27. >>1 search/112 regex\x09
  28. >>>0 use magic-fragment
  29. >>1 default x
  30. # few samples with 1st comment line and without seperator comment line and string value like:
  31. # blcr bsi selinux ssh (file 3.34) digital gnu wordperfect
  32. >>>1 search/471 string\x09
  33. >>>>0 use magic-fragment
  34. >>>1 default x
  35. # few samples with 1st comment line and without seperator comment line and short value like:
  36. # (file 3.34) os9 osf1
  37. >>>>1 search/1716 short\x09
  38. >>>>>0 use magic-fragment
  39. # but many samples start with an empty first line
  40. 0 ubyte =0x0A
  41. # many samples start with separator comment line
  42. >4 string --------
  43. # skip some MS-DOS C source text {EMSINIT.INC MEM.C RESTPARS.C RTDO.C RTDO1.C RTFILE.C RTFILE1.C RTNEW.C RTNEW1.C RTOLD.C RTOLD1.C RTT1.C RTT3.C}
  44. # and match many fragments by looking for Revision Control System keyword near the beginning
  45. >>1 search/128 $File
  46. >>>0 use magic-fragment
  47. # few samples {ctf (2022-03-26) msx (2021-06-30) nasa (2021-02-23) symbos (2021-02-23) weak (2021-02-23)}
  48. # with 1st empty line, separator comment line and without Revision Control System keyword but with reference to man page file(1)
  49. >>1 default x
  50. >>>1 search/180 file(1)
  51. >>>>0 use magic-fragment
  52. >>>1 default x
  53. # sample aria (2021-12-24) with 1st empty line, separator comment line and without Revision Control System keyword and without reference to man page file(1)
  54. >>>>1 search/1024 \041:mime
  55. >>>>>0 use magic-fragment
  56. # few samples with 1st empty line and without separator comment line like: biosig (2021-02-23) espressif (v 1.3)
  57. >4 default x
  58. >>1 search/581 \041:mime
  59. >>>0 use magic-fragment
  60. # display information (lines) about magic text fragment
  61. 0 name magic-fragment
  62. >0 string x magic text fragment for file(1) cmd
  63. !:mime text/x-file
  64. # most without suffix but mail.news varied.out varied.script
  65. !:ext /news/out/script
  66. # next lines are mainly for control reasons
  67. # some (34/339) samples start with comment line
  68. >0 ubyte !0x0A
  69. >>0 string x \b, 1st line "%s"
  70. >>>&1 string x \b, 2nd line "%s"
  71. # show more information to see difference between fragments and misidentfied scripts
  72. >>>>&1 string x \b, 3rd line "%s"
  73. >>>>>&1 string x \b, 4th line "%s"
  74. >>>>>>&1 string x \b, 5th line "%s"
  75. # but most (305/339) samples start with an empty first line
  76. >0 ubyte =0x0A
  77. >>1 string x \b, 2nd line "%s"
  78. >>>&1 string x \b, 3rd line "%s"
  79. # show more information to see difference between fragments and misidentfied scripts
  80. >>>>&1 string x \b, 4th line "%s"
  81. >>>>>&1 string x \b, 5th line "%s"
  82. #
  83. # URL: http://en.wikipedia.org/wiki/File_(command)
  84. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/m/mgc.trid.xml
  85. # Note: called "magic compiled data (LE)" by TrID
  86. 0 lelong 0xF11E041C magic binary file for file(1) cmd
  87. #!:mime application/octet-stream
  88. !:mime application/x-file
  89. !:ext mgc
  90. >4 lelong x (version %d) (little endian)
  91. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/m/mgc-be.trid.xml
  92. # Note: called "magic compiled data (BE)" by TrID
  93. 0 belong 0xF11E041C magic binary file for file(1) cmd
  94. #!:mime application/octet-stream
  95. !:mime application/x-file
  96. !:ext mgc
  97. >4 belong x (version %d) (big endian)