obfuscation-detector
Advanced tools
Comparing version 1.1.3 to 1.1.4
{ | ||
"name": "obfuscation-detector", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Javascript obfuscation detector", | ||
@@ -35,4 +35,4 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"flast": "^1.4.0" | ||
"flast": "^1.5.0" | ||
} | ||
} |
@@ -5,10 +5,10 @@ const obfuscationName = 'caesar_plus'; | ||
* @param {ASTNode} targetNode | ||
* @param {ASTScope} targetScope | ||
* @param {ASTNode} targetScopeBlock | ||
* @return {boolean} true if the target node is found in the targetScope; false otherwise. | ||
*/ | ||
function isNodeInScope(targetNode, targetScope) { | ||
if (!targetScope) return true; | ||
function isNodeInScope(targetNode, targetScopeBlock) { | ||
if (!targetScopeBlock) return true; | ||
let currentScope = targetNode.scope; | ||
while (currentScope.scopeId) { | ||
if (targetScope === currentScope) return true; | ||
while (currentScope) { | ||
if (targetScopeBlock === currentScope.block) return true; | ||
currentScope = currentScope.upper; | ||
@@ -39,3 +39,3 @@ } | ||
for (const c of candidates) { | ||
const funcTree = flatTree.filter(n => isNodeInScope(n, c.scope)); | ||
const funcTree = flatTree.filter(n => isNodeInScope(n, c.isScopeBlock ? c : c.scope.block)); | ||
// Verify all variables are 3 letters long | ||
@@ -42,0 +42,0 @@ if (!funcTree.some(n => n.type === 'VariableDeclarator' && |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
920519
Updatedflast@^1.5.0