From b72b05aa16f717e087b272659f51f79ce532076b Mon Sep 17 00:00:00 2001 From: Scott Behrens Date: Mon, 19 Dec 2011 16:48:44 -0600 Subject: [PATCH] Update neopi.py --- neopi.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/neopi.py b/neopi.py index 9671bf8..c8acf98 100644 --- a/neopi.py +++ b/neopi.py @@ -20,7 +20,7 @@ import zlib import time from collections import defaultdict from optparse import OptionParser - + class LanguageIC: """Class that calculates a file's Index of Coincidence as as well as a a subset of files average Index of Coincidence. @@ -197,30 +197,30 @@ class UsesEval: """Generator that searches a given file for nasty eval with variable""" def __init__(self): - """Instantiate the eval_results array.""" - self.results = [] + """Instantiate the eval_results array.""" + self.results = [] def calculate(self, data, filename): - if not data: - return "", 0 + if not data: + return "", 0 # Lots taken from the wonderful post at http://stackoverflow.com/questions/3115559/exploitable-php-functions - valid_regex = re.compile('(eval\(\$(\w|\d))', re.I) - matches = re.findall(valid_regex, data) - self.results.append({"filename":filename, "value":len(matches)}) - return len(matches) + valid_regex = re.compile('(eval\(\$(\w|\d))', re.I) + matches = re.findall(valid_regex, data) + self.results.append({"filename":filename, "value":len(matches)}) + return len(matches) def sort(self): - self.results.sort(key=lambda item: item["value"]) - self.results.reverse() - self.results = resultsAddRank(self.results) + self.results.sort(key=lambda item: item["value"]) + self.results.reverse() + self.results = resultsAddRank(self.results) def printer(self, count): - """Print the files that use eval""" - print "\n[[ Top %i eval match counts ]]" % (count) - if (count > len(self.results)): count = len(self.results) - for x in range(count): - print ' {0:>7} {1}'.format(self.results[x]["value"], self.results[x]["filename"]) - return + """Print the files that use eval""" + print "\n[[ Top %i eval match counts ]]" % (count) + if (count > len(self.results)): count = len(self.results) + for x in range(count): + print ' {0:>7} {1}'.format(self.results[x]["value"], self.results[x]["filename"]) + return class Compression: -- 2.11.4.GIT