mirror of
https://github.com/horsicq/Detect-It-Easy.git
synced 2026-06-24 01:54:08 +00:00
_debug module
This commit is contained in:
parent
9edd0b4b90
commit
faeeafed28
3 changed files with 39 additions and 14 deletions
|
|
@ -114,8 +114,8 @@ function main() {
|
|||
|
||||
|
||||
function stubForLegacyEngines() {
|
||||
if (typeof PE.isNetGlobalCctorPresent === 'undefined') {
|
||||
stdout(">>> Update DIE Engine to 3.10 and higher for using Heuristic-analyser by DosX <<<");
|
||||
if (typeof _error === 'undefined') {
|
||||
stdout(">>> Update DIE Engine to 3.11 and higher for using Heuristic-analyser by DosX <<<");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +141,11 @@ function stdout(stringToOut) {
|
|||
} else if (typeof File === 'object') {
|
||||
_setResult("~Warning", stringToOut, String(), String());
|
||||
} else {
|
||||
throw stringToOut;
|
||||
if (typeof _error === 'function') {
|
||||
_error(stringToOut);
|
||||
} else {
|
||||
throw stringToOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1240,7 +1244,7 @@ function NetOpCodes() {
|
|||
|
||||
// Check if the opcode mask has a body and the length of the body matches the length of the value
|
||||
if (isOpCodeMaskHasBody && opCodeMask.substr(opCodeInHex.length).length != value.length) {
|
||||
throw "The size of the input values does not match.";
|
||||
_error("The size of the input values does not match.");
|
||||
}
|
||||
|
||||
// Combine the opcode in hexadecimal with the value
|
||||
|
|
@ -1251,11 +1255,12 @@ function NetOpCodes() {
|
|||
this.setNullValue = function(opCodeMask) {
|
||||
|
||||
if (opCodeMask.indexOf("??") === -1) {
|
||||
throw "Instruction does not have a body to overwrite the value.";
|
||||
_error("Instruction does not have a body to overwrite the value.");
|
||||
}
|
||||
|
||||
return replaceAllInString(opCodeMask, "??", "00");
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function removeSpaces(inputString) {
|
||||
|
|
@ -2778,7 +2783,7 @@ function log(messageTypeId, messageText) {
|
|||
// if (PE.isProfiling()) return null;
|
||||
|
||||
if (messageText.indexOf("\n") != -1) {
|
||||
throw "Illegal char at log( ... )";
|
||||
_error("Illegal char at log( ... )");
|
||||
}
|
||||
|
||||
var prefix = String();
|
||||
|
|
@ -2849,7 +2854,7 @@ function heurAvSetResult(label, scores) {
|
|||
if (scores <= 10 && scores >= 0) {
|
||||
_setResult("macilious", ("Win" + (PE.is64() ? "64" : "32") + ".") + label, "Heuristic AV", scores + "/10");
|
||||
} else {
|
||||
throw "Incorrect scores value for '" + label + "'";
|
||||
_error("Incorrect scores value for '" + label + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
23
db/_debug
Normal file
23
db/_debug
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Debugging functions to help with development
|
||||
|
||||
// Author: DosX
|
||||
// E-Mail: collab@kay-software.ru
|
||||
// GitHub: https://github.com/DosX-dev
|
||||
// Telegram: @DosX_dev
|
||||
|
||||
// Just a debug function
|
||||
function _debug(messageText) {
|
||||
_setResult("dev-output", messageText, "", "");
|
||||
}
|
||||
|
||||
// Handle exceptions and log them
|
||||
function _error(exceptionText) {
|
||||
var exceptionText = "Error: " + exceptionText;
|
||||
|
||||
if (sName) {
|
||||
exceptionText += ", last init() is '" + sName + "' with type '" + sType + "'";
|
||||
}
|
||||
|
||||
_log("Exception: " + exceptionText);
|
||||
throw exceptionText;
|
||||
}
|
||||
9
db/_init
9
db/_init
|
|
@ -1,3 +1,5 @@
|
|||
includeScript("_debug");
|
||||
|
||||
var bDetected,
|
||||
sType,
|
||||
sName,
|
||||
|
|
@ -13,7 +15,7 @@ var bDetected,
|
|||
* @param {string} [sOptions] - Additional options for detection. Optional.
|
||||
*/
|
||||
function init(sTypeInput, sNameInput) {
|
||||
if (!sTypeInput) throw "No input type.";
|
||||
if (!sTypeInput) _error("No input type.");
|
||||
|
||||
sType = sTypeInput;
|
||||
sName = sNameInput;
|
||||
|
|
@ -150,9 +152,4 @@ Number.prototype.padStart = function() {
|
|||
return pp + s
|
||||
}
|
||||
|
||||
// Just a debug function
|
||||
function debug(messageText) {
|
||||
_setResult("dev-output", messageText, "", "");
|
||||
}
|
||||
|
||||
includeScript("language");
|
||||
Loading…
Add table
Add a link
Reference in a new issue