WL
application/vnd.wolfram.wl
Magic Bytes
Offset: 0
23 21 2F 75 73 72 2F 62 69 6E 2F 65 6E 76 20 77 6F 6C 66 72 61 6D 73 63 72 69 70 74
The Wolfram Language (WL) format is a high-level symbolic programming language file developed and maintained by Wolfram Research. These files typically store package definitions, script routines, and computational logic intended for execution via the WolframScript interpreter or within Mathematica. As a text-based format containing executable code, scripts should be reviewed for malicious commands before execution, though the files themselves do not pose an inherent risk to system integrity when handled in a sandboxed environment.
Validation Code
How to validate .wl files in Python
Python
def is_wl(file_path: str) -> bool:
"""Check if file is a valid WL by magic bytes."""
signature = bytes([0x23, 0x21, 0x2F, 0x75, 0x73, 0x72, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x65, 0x6E, 0x76, 0x20, 0x77, 0x6F, 0x6C, 0x66, 0x72, 0x61, 0x6D, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74])
with open(file_path, "rb") as f:
return f.read(28) == signature
How to validate .wl files in Node.js
Node.js
function isWL(buffer: Buffer): boolean {
const signature = Buffer.from([0x23, 0x21, 0x2F, 0x75, 0x73, 0x72, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x65, 0x6E, 0x76, 0x20, 0x77, 0x6F, 0x6C, 0x66, 0x72, 0x61, 0x6D, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74]);
return buffer.subarray(0, 28).equals(signature);
}
Go
func IsWL(data []byte) bool {
signature := []byte{0x23, 0x21, 0x2F, 0x75, 0x73, 0x72, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x65, 0x6E, 0x76, 0x20, 0x77, 0x6F, 0x6C, 0x66, 0x72, 0x61, 0x6D, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74}
if len(data) < 28 {
return false
}
return bytes.Equal(data[:28], signature)
}
API Endpoint
GET
/api/v1/wl
curl https://filesignature.org/api/v1/wl