Detect-It-Easy/db/Binary/image_EPS.1.sg
2026-06-20 22:32:01 +02:00

27 lines
No EOL
963 B
JavaScript

// Detect It Easy: detection rule file
// Author: LinXP
// https://en.wikipedia.org/wiki/Encapsulated_PostScript
meta("image", "Encapsulated PostScript (.EPS)");
function detect() {
if (Binary.getSize() >= 0x40) {
if (Binary.compare("'%!PS-Adobe-'", 0x00) && Binary.compare("' EPSF-'", 0x0E)) {
sVersion = sVersion.append(Binary.getString(0x0B, 0x03), Binary.getString(0x14, 0x03));
var sText = Binary.getString(0x00, 0x0400)
bDetected = true;
if (Binary.isVerbose()) {
var aCreator = sText.match(/%%Creator: (.*?)[\r\n]/);
if (aCreator) {
sOptions = sOptions.append("Creator:" + aCreator[1]);
}
var aPages = sText.match(/%%Pages: (.*?)[\r\n]/);
if (aPages) {
sOptions = sOptions.append("Pages:" + aPages[1]);
}
}
}
}
return result();
}