Skip to content

Commit

Permalink
conflict resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolamilosevic86 committed Oct 4, 2014
2 parents 3dea324 + 28c0292 commit df4f11d
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 16 deletions.
Binary file added Documentation.docx
Binary file not shown.
Binary file modified OWASP - Seraphimdroid.apk
Binary file not shown.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,21 @@ Import these two projects, then add these to project library as folllows.
6. Done.

Start digging.


####API Key
You need to create a debug API key for google maps to work. Follow the steps [here](https://developers.google.com/maps/documentation/android/start) to get the key.

You need to generate the SHA1 for your eclipse, to do that enter this command

#####For windows
keytool -list -alias -keystore "C:\Documents
and Settings\Administrator\.android\debug.keystore" -storepass android -keypass
android

##### for linux
keytool -list -alias -keystore "~\.android\debug.keystore" -storepass android -keypass
android



2 changes: 1 addition & 1 deletion Seraphimdroid/API Key
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Google Map v2 API KEY
Debug Key- AIzaSyDhzEfhoqEHt2OGqZ4P1_LTIgvuSQDddMg
Debug Key- AIzaSyCHkv1BswQePxDBzEoYvILokVInYmLvTaQ
Signed Key - AIzaSyCqMfrE5eaE7PNOGzroLn0JnhL5YVH9t6w
3 changes: 2 additions & 1 deletion Seraphimdroid/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyC6U7bArEr-3K3vesdsLYqRQ8KwqswHVWs" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>

</manifest>
</manifest>
222 changes: 222 additions & 0 deletions Seraphimdroid/new_diagram.uxf
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="12.2">
<zoom_level>10</zoom_level>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>660</x>
<y>250</y>
<w>400</w>
<h>200</h>
</coordinates>
<panel_attributes>
org.owasp.seraphimdroid::PermissionScannerFragment
--
/Data members:/

- lvPermissionList : ExpandableListView
- isDataChanged : boolean
- appList : ArrayList &lt;String&gt;
- childPermissions : HashMap &lt;String, List&lt;PermissionData&gt;&gt;
- pkgManager : PackageManager
--
/Methods and Contructors/
- isSystemPackage(PackageInfo) : boolean
- prepareList( ) : void

</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>80</x>
<y>130</y>
<w>340</w>
<h>190</h>
</coordinates>
<panel_attributes>
org.owasp.seraphimdroid.model::PermissionData
--
/Data Members/
- description : String
- maliciousUseDescription : String
- permission : String
- permissionName : String
- weight : int
--
/Methods and Constructors/
+ PermissionData(String, String, String , String, int)
+ get( )/set( )</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>390</x>
<y>110</y>
<w>290</w>
<h>280</h>
</coordinates>
<panel_attributes>lt=&lt;-
m1=0..n
</panel_attributes>
<additional_attributes>270;260;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>660</x>
<y>540</y>
<w>400</w>
<h>340</h>
</coordinates>
<panel_attributes>
org.owasp.seraphimdroid.adapter::PermissionScannerAdapter
--
/Data Member/
- childItem : HashMap
- context : Context
- groupHeader : List&lt;String&gt;
- packageManager : PackageManager
--
/Methods and Constructors/
+ PermissionScannerAdapter( Context, List, HashMap)
+ getChild(int, int) : Object
+ getChildId(int ,int) : long
+ getChildrenCount(int) : int
+ getChildView(int, int, boolean, View, ViewGroup) : View
- getColor(int) : int
+ getGroup(int) : Object
+ getGroupCount() : int
+ getGroupId(int) : long
+ getGroupView(int, boolean, View, ViewGroup) : View
+ hasStableIds() : boolean
+ isChildSelectable(int, int) : boolean
</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>30</x>
<y>440</y>
<w>340</w>
<h>200</h>
</coordinates>
<panel_attributes>
org.owasp.seraphimdroid::PermissionGetter
--
/Data Members/
- context : Context
- maliciousDesc : String
- weight : int
- packageManager : PackageManager
--
/Methods and Constructors/
+ PermissionGetter (PackageManager, Context)
+ generatePermissionData(String) : PermissionData
- retrieveData(String) : void</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>80</x>
<y>20</y>
<w>340</w>
<h>70</h>
</coordinates>
<panel_attributes>Permission Scanner Related Classes
--
PermissionData, PermissionScannerFragment,
PermissionGetter, PermissionScannerAdapter
</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>220</x>
<y>690</y>
<w>340</w>
<h>170</h>
</coordinates>
<panel_attributes>
org.owasp.seraphimdroid::PermissionDescription
--
/Data Members/
- permissionGetter : PermissionGetter
- tvMaliciousDescription : TextView
- tvPermissionDescription : TextView
- tvPermissionHeader : TextView
--
/Methods and Constructors/
+ onCreate(Bundle) : void
+ onResume ( ) : void</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>260</x>
<y>380</y>
<w>272</w>
<h>330</h>
</coordinates>
<panel_attributes>lt=&lt;
Generates permissionData objects</panel_attributes>
<additional_attributes>200;310;140;50;110;60</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>90</x>
<y>290</y>
<w>272</w>
<h>170</h>
</coordinates>
<panel_attributes>lt=&lt;
Generates permissionData objects</panel_attributes>
<additional_attributes>180;30;100;150</additional_attributes>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>370</x>
<y>290</y>
<w>310</w>
<h>270</h>
</coordinates>
<panel_attributes>lt=&lt;-
Feeds layout for ExpandableListView
</panel_attributes>
<additional_attributes>290;30;150;80;290;250</additional_attributes>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>660</x>
<y>80</y>
<w>390</w>
<h>80</h>
</coordinates>
<panel_attributes>Fragment
--
+ OnCreateView(LayoutInfater, ViewGroup, Bundle) : View
+ onResume( ): void
+ onAttach(Activity) : void</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>810</x>
<y>130</y>
<w>50</w>
<h>140</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>30;30;30;120</additional_attributes>
</element>
</diagram>
2 changes: 1 addition & 1 deletion Seraphimdroid/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<string-array name="item_names">
<item>Permission Scanner</item>
<item>Blocker</item>
<item>Blocker Logs</item>
<item>Applicaton Lock</item>
<item>Geo-fencing</item>
<item>Settings</item>
Expand Down
42 changes: 30 additions & 12 deletions Seraphimdroid/src/org/owasp/seraphimdroid/GeoFencingFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class GeoFencingFragment extends Fragment {
private EditText etRadius;
private ImageButton imgBtnLocation;
public static final int ADMIN_ACTIVATION_REQ = 1001;
public static final int GPS_ALERT = 1002;

private SharedPreferences prefs;
public static final String lockKey = "org.owasp.seraphimdroid.geofencing.lock";
Expand Down Expand Up @@ -109,8 +110,8 @@ public void onActivityCreated(Bundle savedInstanceState) {
.findFragmentById(R.id.maps);
if (mapFragment == null) {
mapFragment = SupportMapFragment.newInstance();
childFragmentManager.beginTransaction().replace(R.id.maps, mapFragment)
.commit();
childFragmentManager.beginTransaction()
.replace(R.id.maps, mapFragment).commit();
}

}
Expand Down Expand Up @@ -357,6 +358,17 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
Toast.makeText(getActivity(), "Unable to start GeoFencing",
Toast.LENGTH_LONG).show();
}
break;
case GPS_ALERT:
LocationManager lm = (LocationManager) getActivity()
.getSystemService(Context.LOCATION_SERVICE);

if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
btnFence.setText(getString(R.string.geo_start_fencing));
} else {
showGPSAlert();
}

break;
}
super.onActivityResult(requestCode, resultCode, data);
Expand Down Expand Up @@ -557,14 +569,16 @@ private void showGPSAlert() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("GPS is needed to access this service. Please turn ON the GPS to use this feature.");
builder.setTitle("Enable GPS");
builder.setCancelable(false);
builder.setPositiveButton("GPS settings",
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int arg1) {
Intent intent = new Intent(
Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
// startActivity(intent);
startActivityForResult(intent, GPS_ALERT);
}
}).setNegativeButton(getString(android.R.string.cancel),
new DialogInterface.OnClickListener() {
Expand Down Expand Up @@ -605,20 +619,19 @@ public void onPause() {
super.onPause();
// mapView.onPause();
}



@Override
public void onDetach() {
super.onDetach();
try{
Field childFM = Fragment.class.getDeclaredField("childFragmentManager");
try {
Field childFM = Fragment.class
.getDeclaredField("childFragmentManager");
childFM.setAccessible(true);
childFM.set(this, null);
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
}

}

@Override
Expand Down Expand Up @@ -675,13 +688,18 @@ protected void onPreExecute() {
@Override
protected Void doInBackground(Void... arg0) {
gettingLocation = true;
while (center == null) {
while (gettingLocation) {
if (timer > 3 && timer < 5)
pd.setCancelable(true);
if (timer > 10)
if (timer > 10) {
gettingLocation = false;
return null;
}
timer++;
center = gpsTracker.getLocation();
if (center == null) {
center = gpsTracker.getLocation();
gettingLocation = false;
}
try {
Thread.sleep(1000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class GeoFencingService extends Service {

public static Location center;
public static long TIME = 1000, // Seconds
public static long TIME = 1000 * 10, // Seconds
DISTANCE; // meters
private static int counter = 0;
private DevicePolicyManager deviceMan;
Expand Down

0 comments on commit df4f11d

Please sign in to comment.