JSP
text/x-jsp
Magic Bytes
Offset: 0
3C 25 40
JavaServer Pages (JSP) is a server-side technology developed by Sun Microsystems, now maintained by Oracle, for creating dynamic, platform-independent web content. It is widely used in enterprise environments to embed Java code within HTML or XML documents for generating interactive web applications. Although the files themselves are plain text and safe to view, they function as executable scripts on a server, requiring secure coding practices to prevent vulnerabilities like cross-site scripting or code injection.
Validation Code
How to validate .jsp files in Python
Python
def is_jsp(file_path: str) -> bool:
"""Check if file is a valid JSP by magic bytes."""
signature = bytes([0x3C, 0x25, 0x40])
with open(file_path, "rb") as f:
return f.read(3) == signature
How to validate .jsp files in Node.js
Node.js
function isJSP(buffer: Buffer): boolean {
const signature = Buffer.from([0x3C, 0x25, 0x40]);
return buffer.subarray(0, 3).equals(signature);
}
Go
func IsJSP(data []byte) bool {
signature := []byte{0x3C, 0x25, 0x40}
if len(data) < 3 {
return false
}
return bytes.Equal(data[:3], signature)
}
API Endpoint
GET
/api/v1/jsp
curl https://filesignature.org/api/v1/jsp