6
6
import android .content .pm .ApplicationInfo ;
7
7
import android .os .AsyncTask ;
8
8
import android .os .Bundle ;
9
+ import android .util .Log ;
9
10
10
11
import org .json .JSONObject ;
11
12
23
24
* Created by fuzion24 on 11/25/15.
24
25
*/
25
26
public class ScanRunnerBroadcastReceiver extends BroadcastReceiver {
26
-
27
+ private static final String TAG = "ScanRunnerReceiver" ;
27
28
@ Override
28
29
public void onReceive (final Context context , Intent intent ) {
29
30
31
+ Log .d (TAG , "Received broadcast for scanrunner" );
30
32
//Only allow this code to be ran on debug builds, since it accepts and writes to arbitrary file
31
33
//paths, which would allow another app to arbitrarily write anywhere in this app's context.
32
34
// http://android-developers.blogspot.com/2010/09/securing-android-lvl-applications.html
33
35
boolean isDebuggable = ( 0 != ( context .getApplicationInfo ().flags & ApplicationInfo .FLAG_DEBUGGABLE ) );
34
36
if (!isDebuggable ){
37
+ Log .d (TAG , "Not running the tests because the app is not debuggable" );
35
38
return ;
36
39
}
37
40
38
41
Bundle intentExtras = intent .getExtras ();
42
+ if (intentExtras == null ){
43
+ Log .d (TAG , "There were no extras with the broadcast. Include RESULT_PATH" );
44
+ return ;
45
+ }
46
+
39
47
final String writeResultPath = intentExtras .getString ("RESULT_PATH" );
48
+ if (writeResultPath == null || writeResultPath .equals ("" )){
49
+ Log .d (TAG , "Result write path is null or empty" );
50
+ }
51
+
52
+ Log .d (TAG , "Results will be written to: " + writeResultPath );
40
53
41
54
new AsyncTask <Void ,Void ,Void >(){
42
55
@ Override
43
56
protected Void doInBackground (Void ... params ) {
44
57
List <VulnerabilityTest > tests = VulnerabilityOrganizer .getTests (context );
45
58
List <VulnerabilityTestResult > results = new ArrayList <VulnerabilityTestResult >();
46
59
for (VulnerabilityTest vt : tests ){
60
+ Log .d (TAG , "Running: " + vt .getCVEorID ());
47
61
boolean vulnerable = false ;
48
62
Exception x = null ;
49
63
try {
@@ -52,7 +66,6 @@ protected Void doInBackground(Void... params) {
52
66
x = e ;
53
67
}
54
68
results .add (new VulnerabilityTestResult (vt , vulnerable , x ));
55
-
56
69
}
57
70
58
71
try {
0 commit comments