{"success":true,"data":{"ext":"dmg","name":"Mac OS X Disk Copy Disk Image file","description":"Mac OS X Disk Copy Disk Image (DMG) is a disk image format created and maintained by Apple for macOS. It is used to distribute applications, install software, package files, and mount virtual volumes in Finder or Disk Utility. Originally associated with Apple Disk Copy utilities, it remains common on macOS, but disk images can carry malware or encrypted content and should be opened only from trusted sources.","mime":["application/x-apple-diskimage"],"risk_level":"High","signatures":[{"hex":"6B 6F 6C 79","offset":0,"sources":[{"name":"Wikipedia","url":"https://en.wikipedia.org/wiki/List_of_file_signatures"}],"trailer":true},{"hex":"42 5A 68","offset":0,"sources":[{"name":"Gary Kessler","url":"https://www.garykessler.net/library/file_sigs_GCK_latest.html"}]},{"hex":"63 64 73 61 65 6E 63 72","offset":0,"sources":[{"name":"Gary Kessler","url":"https://www.garykessler.net/library/file_sigs_GCK_latest.html"}]},{"hex":"65 6E 63 72 63 64 73 61","offset":0,"sources":[{"name":"Gary Kessler","url":"https://www.garykessler.net/library/file_sigs_GCK_latest.html"}]},{"hex":"78 01 73 0D 62 62 60","offset":0,"sources":[{"name":"Gary Kessler","url":"https://www.garykessler.net/library/file_sigs_GCK_latest.html"}]}],"related":["adf","vhd","vmdk","bin","iso","toast"],"usage":{"python":"def is_dmg(file_path: str) -> bool:\n    \"\"\"Check if file is a valid DMG by trailer magic bytes.\"\"\"\n    signature = bytes([0x6B, 0x6F, 0x6C, 0x79])\n    with open(file_path, \"rb\") as f:\n        f.seek(-512, 2)\n        return signature in f.read(512)","node":"function isDMG(buffer: Buffer): boolean {\n  const signature = Buffer.from([0x6B, 0x6F, 0x6C, 0x79]);\n  const start = Math.max(0, buffer.length - 512);\n  return buffer.subarray(start).includes(signature);\n}","go":"func IsDMG(data []byte) bool {\n    signature := []byte{0x6B, 0x6F, 0x6C, 0x79}\n    start := 0\n    if len(data) > 512 {\n        start = len(data) - 512\n    }\n    return bytes.Contains(data[start:], signature)\n}"},"category":"Disk Images"}}