MS
text/troff
Magic Bytes
Offset: 0
2E 5C 22
The MS file format consists of text documents formatted using the MS macro package for the roff typesetting system, originally developed at Bell Labs. These plain text files serve as input for generating technical reports, internal memoranda, and structured manuscripts on Unix-like operating systems. While considered a legacy format largely superseded by modern word processors, it remains relevant within the GNU Groff ecosystem and poses minimal security risks as a plain text format.
Validation Code
How to validate .ms files in Python
Python
def is_ms(file_path: str) -> bool:
"""Check if file is a valid MS by magic bytes."""
signature = bytes([0x2E, 0x5C, 0x22])
with open(file_path, "rb") as f:
return f.read(3) == signature
How to validate .ms files in Node.js
Node.js
function isMS(buffer: Buffer): boolean {
const signature = Buffer.from([0x2E, 0x5C, 0x22]);
return buffer.subarray(0, 3).equals(signature);
}
Go
func IsMS(data []byte) bool {
signature := []byte{0x2E, 0x5C, 0x22}
if len(data) < 3 {
return false
}
return bytes.Equal(data[:3], signature)
}
API Endpoint
GET
/api/v1/ms
curl https://filesignature.org/api/v1/ms