SevenZip
application/x-7z-compressed
Magic Bytes
Offset: 0
37 7A BC AF 27 1C
SevenZip is a compressed archive file format developed by Igor Pavlov and maintained as an open-source standard. It is primarily utilized for high-ratio data compression, efficient software distribution, and encrypted file storage across multiple operating systems. While the container format itself is inherently secure, it can be used to transport malicious payloads, requiring security software to scan all extracted contents for potential threats when handling archives from untrusted sources.
Validation Code
How to validate .sevenzip files in Python
Python
def is_sevenzip(file_path: str) -> bool:
"""Check if file is a valid SEVENZIP by magic bytes."""
signature = bytes([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])
with open(file_path, "rb") as f:
return f.read(6) == signature
How to validate .sevenzip files in Node.js
Node.js
function isSEVENZIP(buffer: Buffer): boolean {
const signature = Buffer.from([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C]);
return buffer.subarray(0, 6).equals(signature);
}
Go
func IsSEVENZIP(data []byte) bool {
signature := []byte{0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C}
if len(data) < 6 {
return false
}
return bytes.Equal(data[:6], signature)
}
API Endpoint
GET
/api/v1/sevenzip
curl https://filesignature.org/api/v1/sevenzip