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