VDI
application/octet-stream
Magic Bytes
Offset: 0
3C 3C 3C 20 4F 72 61 63 6C 65 20 56 4D 20 56 69 72 74 75 61 6C 42 6F 78 20 44 69 73 6B 20 49 6D 61 67 65 20 3E 3E 3E
The VirtualBox Disk Image (VDI) is a native virtual disk format developed by Oracle Corporation for the VirtualBox virtualization platform. It is primarily used to encapsulate virtualized hard drives, enabling guest operating systems to store data and system files within a single, portable container on the host machine. Although inherently safe, VDI files can contain sensitive user data or malicious software from guest environments, requiring standard security precautions when transferred or shared.
Validation Code
How to validate .vdi files in Python
Python
def is_vdi(file_path: str) -> bool:
"""Check if file is a valid VDI by magic bytes."""
signature = bytes([0x3C, 0x3C, 0x3C, 0x20, 0x4F, 0x72, 0x61, 0x63, 0x6C, 0x65, 0x20, 0x56, 0x4D, 0x20, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6C, 0x42, 0x6F, 0x78, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x20, 0x49, 0x6D, 0x61, 0x67, 0x65, 0x20, 0x3E, 0x3E, 0x3E])
with open(file_path, "rb") as f:
return f.read(39) == signature
How to validate .vdi files in Node.js
Node.js
function isVDI(buffer: Buffer): boolean {
const signature = Buffer.from([0x3C, 0x3C, 0x3C, 0x20, 0x4F, 0x72, 0x61, 0x63, 0x6C, 0x65, 0x20, 0x56, 0x4D, 0x20, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6C, 0x42, 0x6F, 0x78, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x20, 0x49, 0x6D, 0x61, 0x67, 0x65, 0x20, 0x3E, 0x3E, 0x3E]);
return buffer.subarray(0, 39).equals(signature);
}
Go
func IsVDI(data []byte) bool {
signature := []byte{0x3C, 0x3C, 0x3C, 0x20, 0x4F, 0x72, 0x61, 0x63, 0x6C, 0x65, 0x20, 0x56, 0x4D, 0x20, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6C, 0x42, 0x6F, 0x78, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x20, 0x49, 0x6D, 0x61, 0x67, 0x65, 0x20, 0x3E, 0x3E, 0x3E}
if len(data) < 39 {
return false
}
return bytes.Equal(data[:39], signature)
}
API Endpoint
GET
/api/v1/vdi
curl https://filesignature.org/api/v1/vdi