Detect-It-Easy/db/shell-script
DosX 33711a0407 Add standard DiE-JS framework header to db files
Added a standard header comment to all db framework and detection rule files, indicating they are part of the Detect It Easy (DiE-JS) framework and warning against unauthorized changes. This improves consistency and clarifies file purpose for maintainers.
2025-08-27 23:21:24 +03:00

27 lines
No EOL
855 B
Text
Executable file

// Detect It Easy: DiE-JS framework file
// Don't change anything unless you're sure about what you're doing
// Retrieve the interpreter from a #! script.
var sInterpreter;
if (typeof sInterpreter === "undefined") {
sInterpreter = "";
var sLine = Binary.getString(0);
// Make the expression a little easier to deal with by translating
// something like "/usr/bin/env perl" to just "/usr/bin/perl".
sLine = sLine.replace(/\/env\s+/, "/");
var aMatch = sLine.match(/#!.*\/(.+?)(?:\.exe)?\s/);
if (aMatch) {
sInterpreter = aMatch[1];
}
}
// Check for a particular interpreter.
function isInterpreter(sString) {
if (sInterpreter == sString) {
// Found it, so blank it out to stop "script.2" picking it up again.
sInterpreter = "";
return 1;
}
return 0;
}