Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions phpscanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -591,15 +594,17 @@ 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()
if fnmatch.fnmatch(filename, '*.php') or \
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)

Expand Down