disabled yaml
This commit is contained in:
parent
dda76ee51a
commit
dde8b70240
9
scan.py
9
scan.py
@ -12,7 +12,6 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import textwrap
|
|
||||||
|
|
||||||
whitelist = [
|
whitelist = [
|
||||||
'/lp-msh-scanner/',
|
'/lp-msh-scanner/',
|
||||||
@ -301,7 +300,7 @@ def is_hacked(filename):
|
|||||||
if filename[0] != '/':
|
if filename[0] != '/':
|
||||||
filename = os.getcwd() + '/' + filename
|
filename = os.getcwd() + '/' + filename
|
||||||
|
|
||||||
return {'filename': filename,
|
return {'filename': filename[0:200],
|
||||||
'score': total_score,
|
'score': total_score,
|
||||||
'mtime': os.stat(filename).st_mtime,
|
'mtime': os.stat(filename).st_mtime,
|
||||||
'ctime': os.stat(filename).st_ctime,
|
'ctime': os.stat(filename).st_ctime,
|
||||||
@ -611,7 +610,8 @@ def is_hacked(filename):
|
|||||||
cleanup_available = True
|
cleanup_available = True
|
||||||
if cleanup_available and line_num == 1:
|
if cleanup_available and line_num == 1:
|
||||||
cleanup_available = False
|
cleanup_available = False
|
||||||
return {'filename': join(textwrap.wrap(filename, 200),
|
|
||||||
|
return {'filename': filename[0:200],
|
||||||
'score': total_score,
|
'score': total_score,
|
||||||
'mtime': os.stat(filename).st_mtime,
|
'mtime': os.stat(filename).st_mtime,
|
||||||
'ctime': os.stat(filename).st_ctime,
|
'ctime': os.stat(filename).st_ctime,
|
||||||
@ -671,6 +671,7 @@ if __name__ == '__main__':
|
|||||||
for root, dirnames, filenames in os.walk(basedir):
|
for root, dirnames, filenames in os.walk(basedir):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
if fnmatch.fnmatch(filename, '*.php') or \
|
if fnmatch.fnmatch(filename, '*.php') or \
|
||||||
|
fnmatch.fnmatch(filename, '*.txt') or \
|
||||||
fnmatch.fnmatch(filename, '*.js'):
|
fnmatch.fnmatch(filename, '*.js'):
|
||||||
hacked = is_hacked(os.path.join(root, filename))
|
hacked = is_hacked(os.path.join(root, filename))
|
||||||
if hacked is not False and hacked['score'] >= MIN_SCORE:
|
if hacked is not False and hacked['score'] >= MIN_SCORE:
|
||||||
@ -679,11 +680,13 @@ if __name__ == '__main__':
|
|||||||
filename = basedir
|
filename = basedir
|
||||||
root = os.getcwd()
|
root = os.getcwd()
|
||||||
if fnmatch.fnmatch(filename, '*.php') or \
|
if fnmatch.fnmatch(filename, '*.php') or \
|
||||||
|
fnmatch.fnmatch(filename, '*.txt') or \
|
||||||
fnmatch.fnmatch(filename, '*.js'):
|
fnmatch.fnmatch(filename, '*.js'):
|
||||||
hacked = is_hacked(os.path.join(root, filename))
|
hacked = is_hacked(os.path.join(root, filename))
|
||||||
if hacked is not False and hacked['score'] >= MIN_SCORE:
|
if hacked is not False and hacked['score'] >= MIN_SCORE:
|
||||||
results.append(hacked)
|
results.append(hacked)
|
||||||
|
|
||||||
|
|
||||||
results.sort(key=lambda x: x['score'], reverse=True)
|
results.sort(key=lambda x: x['score'], reverse=True)
|
||||||
|
|
||||||
if SERIALIZER == 'yaml':
|
if SERIALIZER == 'yaml':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user