ELF Header Only
ELF Header Only is a Executable and Linkable Format sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
header-only.elfExecutable
Linuxなどで使われる実行ファイル・オブジェクトファイル形式。7F 45 4C 46から始まります。
7F 45 4C 46 .ELFSIGNATURE = bytes.fromhex("7f454c46")
OFFSET = 0
def is_elf(path: str) -> bool:
with open(path, "rb") as f:
f.seek(OFFSET)
head = f.read(len(SIGNATURE))
return head == SIGNATUREconst SIGNATURE = [0x7f, 0x45, 0x4c, 0x46];
const OFFSET = 0;
// bytes: a Uint8Array / Buffer holding the start of the file
export function isElf(bytes) {
return SIGNATURE.every((byte, i) => bytes[OFFSET + i] === byte);
}package fileid
import "bytes"
var iselfSignature = []byte{0x7f, 0x45, 0x4c, 0x46}
const iselfOffset = 0
func IsElf(b []byte) bool {
end := iselfOffset + len(iselfSignature)
if len(b) < end {
return false
}
return bytes.Equal(b[iselfOffset:end], iselfSignature)
}const SIGNATURE: &[u8] = &[0x7f, 0x45, 0x4c, 0x46];
const OFFSET: usize = 0;
fn is_elf(bytes: &[u8]) -> bool {
bytes.get(OFFSET..OFFSET + SIGNATURE.len()) == Some(SIGNATURE)
}<?php
$signature = "\x7f\x45\x4c\x46";
$offset = 0;
function is_elf(string $bytes): bool {
global $signature, $offset;
return substr($bytes, $offset, strlen($signature)) === $signature;
}Executable and Linkable Format は実行ファイル、バイナリモジュール、配布物、アップロード制限の識別に使われます。実行せずにヘッダや構造を検査してください。
実行形式は実行せず、検査目的のみでダウンロードしてください。解析は隔離環境で行い、拡張子チェック・MIMEチェック・実行権限を分離してください。
11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。
ELF Header Only is a Executable and Linkable Format sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
header-only.elfBlue Sky ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
01-blue-sky.elf33d1bd8b7b68e5860a9808088017318e9d779d853b1c13f3a024656b78ae9984Flower Garden ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
02-flower-garden.elf61de85ea51f6a030cc93a76c23024271eaee7d64b7e94b5e8d99d8777bb4c330Navy Blue Sky ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
03-navy-blue-sky.elfce37bb7a1cf27ef7edec7b09300f34aa58f621d135f6d5c40fabee28ef9d3cbcNature of the Sky ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
04-nature-sky.elf8cae3fc75763219223f29e59061f917da0759ec98ae7c8c58740104ff96b97b4Sky Landscape ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
05-sky-landscape.elf5f7267b7c5d4dcf4bb4a0409822491122c352604626aea3fbfcf4cf38f42d4ddStarry Sky ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
06-starry-sky.elf2f29360810b11615c5c4463edf4557f6061a65c07f8c4b9945e36eb69e88ecc1Blue Night Sky ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
07-blue-night-sky.elf02d4e352fa8c3a23968d73cea83c821d6c90ae9dd91a4b0ecff467c887177ea9Hibiscus Flower ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
08-hibiscus-flower.elf562b2bd2bdd21ddef9f73bd62d12f9b4beb3fc4819ed2d00a238e81b2a8703c3Arctic Sky ELF is a Executable and Linkable Format sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
09-arctic-sky.elf774efa9bc2275d012d0f52794ec3e33033db2e1131d6850b79e013c610fa470cNASA Blue Marble ELF is a Executable and Linkable Format sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.
nasa-blue-marble-2012-east.elffbf2a14ae155f8399a9dd2e031a346f0949d42adbb5e474dfbb5ae2c58d64f9bExecutable and Linkable Format ファイルはバイトシグネチャ 7F 45 4C 46 (".ELF") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。
Executable and Linkable Format のMIMEタイプは application/x-elf です。
Executable and Linkable Format ファイルは .elf, .so, .o 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。