PERL
text/x-perl
Magic Bytes
Offset: 0
65 76 61 6C 20 22 65 78 65 63 20 2F 75 73 72 2F 6C 6F 63 61 6C 2F 62 69 6E 2F 70 65 72 6C
The Perl script format (PERL) is a high-level programming language originally created by Larry Wall and currently maintained by the Perl Foundation. It is primarily utilized for system administration, network programming, web development, and large-scale text manipulation through an integrated regular expression engine. Although these plain text scripts are passive data files, executing them carries inherent security risks because the code can perform arbitrary commands or modify sensitive system resources upon interpretation.
Validation Code
How to validate .perl files in Python
Python
def is_perl(file_path: str) -> bool:
"""Check if file is a valid PERL by magic bytes."""
signature = bytes([0x65, 0x76, 0x61, 0x6C, 0x20, 0x22, 0x65, 0x78, 0x65, 0x63, 0x20, 0x2F, 0x75, 0x73, 0x72, 0x2F, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x70, 0x65, 0x72, 0x6C])
with open(file_path, "rb") as f:
return f.read(30) == signature
How to validate .perl files in Node.js
Node.js
function isPERL(buffer: Buffer): boolean {
const signature = Buffer.from([0x65, 0x76, 0x61, 0x6C, 0x20, 0x22, 0x65, 0x78, 0x65, 0x63, 0x20, 0x2F, 0x75, 0x73, 0x72, 0x2F, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x70, 0x65, 0x72, 0x6C]);
return buffer.subarray(0, 30).equals(signature);
}
Go
func IsPERL(data []byte) bool {
signature := []byte{0x65, 0x76, 0x61, 0x6C, 0x20, 0x22, 0x65, 0x78, 0x65, 0x63, 0x20, 0x2F, 0x75, 0x73, 0x72, 0x2F, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x70, 0x65, 0x72, 0x6C}
if len(data) < 30 {
return false
}
return bytes.Equal(data[:30], signature)
}
API Endpoint
GET
/api/v1/perl
curl https://filesignature.org/api/v1/perl