diff --git a/phpscanner.py b/phpscanner.py index e8927f6..b3a352c 100755 --- a/phpscanner.py +++ b/phpscanner.py @@ -568,11 +568,14 @@ def is_hacked(filename): parser.add_argument('--maxresults', dest='maxresults', type=int, default=500, help='Maximum number or results (default: 500)') + parser.add_argument('--detailed-hacks-only', dest='detailedonly', action='store_false', + help='Only show items that have details present (default: false)') args = parser.parse_args() basedir = args.directory_file RESULT_POST = args.post MIN_SCORE = args.minscore MAX_RESULTS = args.maxresults + DETAILED_ONLY = args.detailedonly # print(args) # import socket # RESULT_POST = 'https://xxx.com/%s/%s' % (socket.gethostname(),token) @@ -591,7 +594,8 @@ def is_hacked(filename): fnmatch.fnmatch(filename, '*.js'): hacked = is_hacked(os.path.join(root, filename)) if hacked is not False and hacked['score'] >= MIN_SCORE: - results.append(hacked) + if DETAILED_ONLY or hacked['details'] : + results.append(hacked) else: filename = basedir root = os.getcwd() @@ -599,7 +603,8 @@ def is_hacked(filename): fnmatch.fnmatch(filename, '*.js'): hacked = is_hacked(os.path.join(root, filename)) if hacked is not False and hacked['score'] >= MIN_SCORE: - results.append(hacked) + if DETAILED_ONLY or hacked['details'] : + results.append(hacked) results.sort(key=lambda x: x['score'], reverse=True)