diff --git a/JSAnalysis.py b/JSAnalysis.py index 79fce91..ddaf7e6 100644 --- a/JSAnalysis.py +++ b/JSAnalysis.py @@ -176,14 +176,13 @@ def isJavascript(content): @param content: A string @return: A boolean, True if it seems to contain Javascript code or False in the other case ''' - jsStrings = ['var ', ';', ')', '(', 'function ', '=', '{', '}', 'if ', 'else', 'return', 'while ', 'for ', + jsStrings = ['var ', ';', ')', '(', 'function ', '=', '{', '}', 'if(', 'if (', 'else{', 'else {','else if', 'return', 'while(', 'while (', 'for(', 'for (', ',', 'eval'] keyStrings = [';', '(', ')'] - reVarInit = 'var [\w0-9]+\s*?=' - reFunctionCall = '[\w0-9]+\s*?\(.*?\)\s*?;' stringsFound = [] limit = 15 - minDistinctStringsFound = 4 + #JS should at least contain ';', ')', '(', 'var', '=' + minDistinctStringsFound = 5 minRatio = 10 results = 0 length = len(content) @@ -279,4 +278,4 @@ def unescape(escapedBytes, unicode = True): unescapedBytes = escapedBytes except: return (-1, 'Error while unescaping the bytes') - return (0, unescapedBytes) \ No newline at end of file + return (0, unescapedBytes)