V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
ruiyi1994
V2EX  ›  Linux

看不懂自定义 magic 文件的规则,求指点.

  •  
  •   ruiyi1994 · 2021-07-21 11:16:51 +08:00 · 1146 次点击
    这是一个创建于 981 天前的主题,其中的信息可能已经有所发展或是发生改变。

    对 file 命令识别文件类型感兴趣,查了下资料, 发现是有系统内置了 magic 文件,相当于数据库,定义了一些通过文件头的内容来识别文件类型的规则, 不过苦于里面的一些规则看不懂, 还望指点. 就是图片上的 *0x18, >*0x3c , >+54

    0   short	0x5AD4	DOS executable
    *0x18	Short	0x40
    >*0x3c	Short	0x6584C OS/2 linear executable
    >*0x3C	Short	0x454e
    >+54byte	1	OS/2 format
    >+54byte	2	Windows format
    0   short	0xFDF0	DOS library
    0   string	AH	Halo bitmapped font file
    0   short	0x601A	Atara ST contiguous executable
    

    1 条回复    2021-07-21 16:23:47 +08:00
    bigfei
        1
    bigfei  
       2021-07-21 16:23:47 +08:00
    man 5 magic
    有详细的 manual:
    https://linux.die.net/man/5/magic
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3367 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 13:38 · PVG 21:38 · LAX 06:38 · JFK 09:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.