From 9e65818a295bdb2b7a8f4c677ffdfaf7216b2279 Mon Sep 17 00:00:00 2001 From: Jordan Mendler Date: Wed, 30 Nov 2016 07:10:47 +0000 Subject: [PATCH] added argument to show only detailed hacked (e.g. hide hacks that have score of 0 but no details --- phpscanner.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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)