-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathMainActivity.java
More file actions
41 lines (37 loc) · 1.41 KB
/
MainActivity.java
File metadata and controls
41 lines (37 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package aut.atlas;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
/**
* @testcase_name ImplicitFlow_ExceptionProneInstruction
* @version 0.1
* @author_mail z.bohluli@aut.ac.ir
* @description IMEI value and its digits are written to Log through division by zero exception
* @dataflow source -> Exception-prone instruction -> sink
* @number_of_leaks 2
* @challenges the analysis must be able to handle implicit flows induced by exception-prone instructions
*/
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imei = telephonyManager.getDeviceId();
String lowIMEI = new String();
for (char c : imei.toCharArray()){
int high = ((int)c) - 48 ;
for (int low=0; low<=9; low++){
try {
int tmp = 1 / (high - low);
} catch (Exception e){
lowIMEI += (char) (low + 48);
Log.i("info", "An IMEI digit found " + low);
}
}
}
Log.i("info", "IMEI found = " + lowIMEI);
}
}