BASH
application/x-sh
Magic Bytes
Offset: 0
23 21 2F
The Bourne Again Shell (Bash) is a Unix shell and command language developed by Brian Fox as part of the GNU Project. It serves as the default command interpreter for most Linux distributions, enabling users to automate administrative tasks, manage file systems, and execute scripting logic. Although these files are plain text, they can execute arbitrary code or modify system configurations if granted execution privileges, requiring thorough auditing before deployment.
Validation Code
How to validate .bash files in Python
Python
def is_bash(file_path: str) -> bool:
"""Check if file is a valid BASH by magic bytes."""
signature = bytes([0x23, 0x21, 0x2F])
with open(file_path, "rb") as f:
return f.read(3) == signature
How to validate .bash files in Node.js
Node.js
function isBASH(buffer: Buffer): boolean {
const signature = Buffer.from([0x23, 0x21, 0x2F]);
return buffer.subarray(0, 3).equals(signature);
}
Go
func IsBASH(data []byte) bool {
signature := []byte{0x23, 0x21, 0x2F}
if len(data) < 3 {
return false
}
return bytes.Equal(data[:3], signature)
}
API Endpoint
GET
/api/v1/bash
curl https://filesignature.org/api/v1/bash