1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 17:00:12 +01:00

Scan for suspicious class loading

This commit is contained in:
Ciaran Gultnieks 2012-03-06 19:50:19 +00:00
parent c08f5d7e5f
commit 2df8259408

View File

@ -937,7 +937,7 @@ def scan_source(build_dir, root_dir, thisbuild):
problems = [] problems = []
# Scan for common known non-free blobs: # Common known non-free blobs:
usual_suspects = ['flurryagent', usual_suspects = ['flurryagent',
'paypal_mpl', 'paypal_mpl',
'libgoogleanalytics', 'libgoogleanalytics',
@ -945,11 +945,28 @@ def scan_source(build_dir, root_dir, thisbuild):
'googleadview', 'googleadview',
'googleadmobadssdk', 'googleadmobadssdk',
'heyzap'] 'heyzap']
# Iterate through all files in the source code...
for r,d,f in os.walk(build_dir): for r,d,f in os.walk(build_dir):
for curfile in f: for curfile in f:
# Path (relative) to the file...
fp = os.path.join(r, curfile)
for suspect in usual_suspects: for suspect in usual_suspects:
if curfile.lower().find(suspect) != -1: if curfile.lower().find(suspect) != -1:
msg = 'Found probable non-free blob ' + os.path.join(r, curfile) msg = 'Found probable non-free blob ' + fp
problems.append(msg)
if curfile.endswith('.java'):
for line in file(fp):
if line.find('DexClassLoader') != -1:
msg = 'Found DexClassLoader in ' + fp
problems.append(msg)
if line.lower().find('all rights reserved') != -1:
msg = 'All rights reserved in ' + fp
problems.append(msg) problems.append(msg)
# Presence of a jni directory without buildjni=yes might # Presence of a jni directory without buildjni=yes might