mirror of
https://github.com/horsicq/Detect-It-Easy.git
synced 2026-06-24 01:54:08 +00:00
Changed 'detect' from a constant assignment to a function declaration and replaced string initializations with String() for clarity. These changes improve code readability and maintain consistency in variable initialization.
46 lines
No EOL
1.5 KiB
JavaScript
46 lines
No EOL
1.5 KiB
JavaScript
// Detect It Easy: detection rule file
|
|
|
|
// Author: DosX
|
|
// E-Mail: collab@kay-software.ru
|
|
// GitHub: https://github.com/DosX-dev
|
|
// Telegram: @DosX_dev
|
|
|
|
function detect() { main(); }
|
|
|
|
function main() {
|
|
if (Binary.isHeuristicScan()) {
|
|
switch (Binary.getFileSuffix().toLowerCase()) {
|
|
case "js":
|
|
case "jse":
|
|
case "jsc":
|
|
var options = String();
|
|
|
|
if (!Binary.isPlainText()) {
|
|
options = "bytecode";
|
|
} else {
|
|
if (Binary.getSize() > 3000) {
|
|
var scriptContent = Binary.getString(0x00, Binary.getSize());
|
|
|
|
var unquotedContent = String(),
|
|
inQuotes = false;
|
|
|
|
for (var i = 0; i < scriptContent.length; i++) {
|
|
if (scriptContent[i] === '"' || scriptContent[i] === "'" || scriptContent[i] === '`') {
|
|
inQuotes = !inQuotes;
|
|
} else if (!inQuotes) {
|
|
unquotedContent += scriptContent[i];
|
|
}
|
|
}
|
|
|
|
if (/\s{2}/.test(unquotedContent)) {
|
|
options = "minified/compiled";
|
|
}
|
|
}
|
|
}
|
|
|
|
_setResult("~language", "JavaScript", String(), Binary.isVerbose() ? options : String());
|
|
|
|
break;
|
|
}
|
|
}
|
|
} |