SH
application/x-sh
⚠️
High Risk Format
This file type can contain executable code. Always validate source and scan with antivirus before opening.
Magic Bytes
Offset: 0
23 21 2F
The Bourne shell script format is a command-line interpreter file originally developed by Stephen Bourne at Bell Labs for the Unix operating system. These files contain sequences of commands executed by a shell environment to automate system administration tasks, software installations, and complex data processing pipelines. Because shell scripts execute commands directly on the host operating system with the user's permissions, they pose a significant security risk if sourced from untrusted origins.
Validation Code
How to validate .sh files in Python
Python
def is_sh(file_path: str) -> bool:
"""Check if file is a valid SH by magic bytes."""
signature = bytes([0x23, 0x21, 0x2F])
with open(file_path, "rb") as f:
return f.read(3) == signature
How to validate .sh files in Node.js
Node.js
function isSH(buffer: Buffer): boolean {
const signature = Buffer.from([0x23, 0x21, 0x2F]);
return buffer.subarray(0, 3).equals(signature);
}
Go
func IsSH(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/sh
curl https://filesignature.org/api/v1/sh