Browse Source

fixed merge conflicts

Alexander Brakowski 10 years ago
parent
commit
118ebb418a

BIN
res/drawable-hdpi/ic_filter_pressed.png


+ 9 - 0
res/values-de/strings.xml

@@ -144,4 +144,13 @@
 	<string name="record_details_nocontent">Kein Inhalt</string>
 	<string name="record_details_remote_ip">REMOTE IP</string>
 	<string name="record_details_conversation">Unterhaltung</string>
+    <string name="profile_vista_desc">Dieses Profil immitiert Windows Vista</string>
+    <string name="profile_xp_desc">Dieses Profil aktiviert Dienste die Typisch für Windows XP sind</string>
+    <string name="profile_webserv_http_desc">Dieses Profil immitiert einen simplen Webserver, welcher nur den Port für das HTTP Protokoll überwacht</string>
+    <string name="profile_webserv_desc">Dieses Profil immitiert einen simplen Webserver, welcher neben dem HTTP Protokoll auch das HTTPS Protokoll unterstützt</string>
+    <string name="profile_unix_desc">Dieses Profil aktiviert Unix-typische Dienste</string>
+    <string name="profile_linux_desc">Dieses Profil immitiert ein Linux System mit entsprechenden Diensten</string>
+    <string name="profile_voip_desc">Dieses Profil immitiert einen VOIP Server, welcher das SIP Protokoll überwacht</string>
+    <string name="profile_random_desc">In diesem Profil werden zufällige Protokolle aktiviert</string>
+    <string name="profile_paranoid_desc">Dieses Profil aktiviert alle Protokolle</string>
 </resources>

+ 11 - 2
res/values/strings.xml

@@ -128,8 +128,8 @@
     <string name="stats_select_protocol">Select Protocol</string>
     <string name="stats_attacks_essid">Attacks per ESSID</string>
     <string name="stats_attacks_bssid">Attacks per BSSID</string>
-    <string name="stats_attacks_time">Attacks per time</string>
-    <string name="stats_attacks_date">Attacks per date</string>
+    <string name="stats_attacks_time">Attacks over time</string>
+    <string name="stats_attacks_date">Attacks over date</string>
     <string name="stats_uses_protocol">Uses per protocol</string>
     <string name="stats_attacks_protocol">Attacks per protocol</string>
     <string name="stats_select_attack_data">Select attack data to compare</string>
@@ -145,4 +145,13 @@
 	<string name="record_details_nocontent">No content</string>
 	<string name="record_details_remote_ip">REMOTE IP</string>
 	<string name="record_details_conversation">Conversation</string>
+    <string name="profile_vista_desc">This profile will imitate a Windows Vista machine</string>
+    <string name="profile_xp_desc">This profile will activate Windows XP typical services</string>
+    <string name="profile_webserv_http_desc">This profile will imitate a simple webserver, which just supports the HTTP protocol</string>
+    <string name="profile_webserv_desc">This profile will imitate a simple webserver, which supports both the HTTP and HTTPS protocol</string>
+    <string name="profile_unix_desc">This profile monitors unix typical services</string>
+    <string name="profile_linux_desc">This profile will imitate a linux machine by monitoring linux typical services</string>
+    <string name="profile_voip_desc">This profile imitates a VOIP Server by monitoring the SIP service</string>
+    <string name="profile_random_desc">This profile monitors services randomly</string>
+    <string name="profile_paranoid_desc">This profile monitors all available services</string>
 </resources>

+ 3 - 1
src/de/tudarmstadt/informatik/hostage/model/Profile.java

@@ -154,7 +154,9 @@ public class Profile implements JSONSerializable<Profile> {
 		Integer[] ports = new Integer[splits.length];
 
 		for(int i=0; i<splits.length; i++){
-			ports[i] = Integer.valueOf(splits[i]);
+            if(!splits[i].equals("")) {
+                ports[i] = Integer.valueOf(splits[i]);
+            }
 		}
 
 		return ports;

+ 9 - 9
src/de/tudarmstadt/informatik/hostage/persistence/ProfileManager.java

@@ -484,7 +484,7 @@ public class ProfileManager {
 		Profile windowsVista = new Profile(
 				0,
 				"Windows Vista",
-				"This profile will imitate a Windows Vista machine",
+				MainActivity.getInstance().getString(R.string.profile_vista_desc),
 				R.drawable.ic_profile_vista,
 				false
 		);
@@ -497,7 +497,7 @@ public class ProfileManager {
 		Profile windowsXP = new Profile(
 				1,
 				"Windows XP",
-				"This profile will activate Windows XP typical services",
+                MainActivity.getInstance().getString(R.string.profile_xp_desc),
 				R.drawable.ic_profile_xp,
 				false
 		);
@@ -511,7 +511,7 @@ public class ProfileManager {
 		Profile serverHTTP = new Profile(
 				2,
 				"Webserver HTTP",
-				"This profile will imitate a simple webserver, which just supports the HTTP protocol",
+                MainActivity.getInstance().getString(R.string.profile_webserv_http_desc),
 				R.drawable.ic_profile_apache,
 				false
 		);
@@ -523,7 +523,7 @@ public class ProfileManager {
 		Profile serverWeb = new Profile(
 				3,
 				"Webserver",
-				"This profile will imitate a simple webserver, which supports both the HTTP and HTTPS protocol",
+                MainActivity.getInstance().getString(R.string.profile_webserv_desc),
 				R.drawable.ic_profile_apache,
 				false
 		);
@@ -536,7 +536,7 @@ public class ProfileManager {
 		Profile unixMachine = new Profile(
 				4,
 				"Unix",
-				"This profile monitors unix typical services",
+                MainActivity.getInstance().getString(R.string.profile_unix_desc),
 				R.drawable.ic_profile_unix,
 				false
 		);
@@ -549,7 +549,7 @@ public class ProfileManager {
 		Profile linuxMachine = new Profile(
 				5,
 				"Linux",
-				"This profile will imitate a linux machine by monitoring linux typical services",
+                MainActivity.getInstance().getString(R.string.profile_linux_desc),
 				R.drawable.ic_profile_linux,
 				false
 		);
@@ -564,7 +564,7 @@ public class ProfileManager {
 		Profile voipServer = new Profile(
 				6,
 				"VOIP Server",
-				"This profile imitates a VOIP Server by monitoring the SIP service",
+                MainActivity.getInstance().getString(R.string.profile_voip_desc),
 				R.drawable.ic_profile_asterisks,
 				false
 		);
@@ -576,7 +576,7 @@ public class ProfileManager {
 		Profile randomProfile = new Profile(
 				7,
 				"Random",
-				"This profile monitors services randomly",
+                MainActivity.getInstance().getString(R.string.profile_random_desc),
 				R.drawable.ic_launcher,
 				false
 		);
@@ -588,7 +588,7 @@ public class ProfileManager {
 		Profile paranoidProfile = new Profile(
 				8,
 				"Paranoid",
-				"This profile monitors all available services",
+                MainActivity.getInstance().getString(R.string.profile_paranoid_desc),
 				R.drawable.ic_profile_paranoid,
 				false
 		);

+ 11 - 6
src/de/tudarmstadt/informatik/hostage/ui2/adapter/ServicesListAdapter.java

@@ -158,8 +158,10 @@ public class ServicesListAdapter extends ArrayAdapter<ServicesListItem> {
                                    if(item.protocol.equals("GHOST")) {
                                        mGhostPorts = mProfile.getGhostPorts();
                                        for(Integer port: mGhostPorts){
-                                           if(MainActivity.getInstance().getHostageService().isRunning("GHOST",port)){
-                                               MainActivity.getInstance().getHostageService().stopListener("GHOST", port);
+                                           if(port != null) {
+                                               if(MainActivity.getInstance().getHostageService().isRunning("GHOST",port)){
+                                                   MainActivity.getInstance().getHostageService().stopListener("GHOST", port);
+                                               }
                                            }
                                        }
                                        buttonView.setChecked(false);
@@ -188,10 +190,13 @@ public class ServicesListAdapter extends ArrayAdapter<ServicesListItem> {
             mGhostPorts = mProfile.getGhostPorts();
 
             boolean ghostActive = false;
-
-            for(Integer port: mGhostPorts){
-                if(MainActivity.getInstance().getHostageService().isRunning("GHOST",port)){
-                    ghostActive = true;
+            if(mGhostPorts.length != 0) {
+                for (Integer port : mGhostPorts) {
+                    if(port != null){
+                        if (MainActivity.getInstance().getHostageService().isRunning("GHOST", port)) {
+                            ghostActive = true;
+                        }
+                    }
                 }
             }
             if(ghostActive){

+ 32 - 2
src/de/tudarmstadt/informatik/hostage/ui2/fragment/RecordOverviewFragment.java

@@ -77,6 +77,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 
     private LogFilter filter;
     private boolean showFilterButton;
+    private View rootView;
 
     private int mListPosition = -1;
     private int mItemPosition = -1;
@@ -142,6 +143,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 	    this.setShowFilterButton(!this.filter.isNotEditable());
 
 		View rootView = inflater.inflate(this.getLayoutId(), container, false);
+        this.rootView = rootView;
 		ExpandableListView mylist = (ExpandableListView) rootView.findViewById(R.id.loglistview);
 
         this.spinner =(ProgressBar) rootView.findViewById(R.id.progressBar1);
@@ -523,6 +525,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
         loader = null;
 
         this.spinner.setVisibility(View.VISIBLE);
+        this.actualiseFilterButton();
 
         loader = new Thread(new Runnable() {
             @Override
@@ -760,6 +763,12 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 	 *
 	 * ***************************/
 
+    /**Returns the FilterButton.
+     * @return ImageButton filterButton*/
+    private ImageButton getFilterButton(){
+        return (ImageButton) this.rootView.findViewById(R.id.FilterButton);
+    }
+
     /**Opens the filter menu on a anchor view. The filter menu will always be on top of the anchor.
     * @param View anchorView*/
 	private void openFilterPopupMenuOnView(View v){
@@ -1001,7 +1010,8 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 			this.filter.setAboveTimestamp(dialog.getDate());
 		}
         this.actualiseListViewInBackground();
-	}
+        this.actualiseFilterButton();
+    }
     /**
      * Will be called if the users cancels a timestamp selection.
      * @param DateTimeDialogFragment dialog
@@ -1012,7 +1022,8 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 		} else {
 			this.filter.setAboveTimestamp(Long.MIN_VALUE);
 		}
-	}
+        this.actualiseFilterButton();
+    }
 
     /**
      * Will be called if the users clicks the positiv button on a ChechlistDialog.
@@ -1057,8 +1068,27 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
             this.groupingKey =  titles.get(0);
         }
         this.actualiseListViewInBackground();
+
+        this.actualiseFilterButton();
 	}
 
+    /**Paints the filter button if the current filter object is set.*/
+    private void actualiseFilterButton(){
+        if (this.filter.isSet() ){
+            ImageButton filterButton = this.getFilterButton();
+            if (filterButton != null){
+                filterButton.setImageResource(R.drawable.ic_filter_pressed);
+                filterButton.invalidate();
+            }
+        } else {
+            ImageButton filterButton = this.getFilterButton();
+            if (filterButton != null){
+                filterButton.setImageResource(R.drawable.ic_filter);
+                filterButton.invalidate();
+            }
+        }
+    }
+
     /**
      * Will be called if the users clicks the negativ button on a ChechlistDialog.
      * @param ChecklistDialog dialog

+ 26 - 0
src/de/tudarmstadt/informatik/hostage/ui2/fragment/StatisticsFragment.java

@@ -8,6 +8,8 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.res.Configuration;
 import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -532,16 +534,19 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
             this.actualiseCurrentPlot();
             String fragTitle = "" + this.getCurrentSelectedProtocol() + ": " + this.selectedCompareData;
             this.setTitle(fragTitle);
+
             return;
         }
         if (title.equals(FILTER_MENU_TITLE_ESSID)){
             this.filter.setESSIDs(titles);
             this.actualiseCurrentPlot();
+
             return;
         }
         if (title.equals(FILTER_MENU_TITLE_BSSID)){
             this.filter.setBSSIDs(titles);
             this.actualiseCurrentPlot();
+
             return;
         }
 
@@ -549,6 +554,8 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
             String data = titles.get(0);
             this.setTitle(data);
 
+            this.actualiseFilterButton();
+
             if (data.equals(COMPARE_TITLE_AttacksPerTime) || data.equals(COMPARE_TITLE_AttacksPerDate)){
                 ChartType chartType = ChartType.LINE_CHART;
                 this.selectedCompareData = data;
@@ -626,6 +633,23 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
     *
     * */
 
+    /**Paints the filter button if the current filter object is set.*/
+    private void actualiseFilterButton(){
+        if (this.filter.isSet() ){
+            ImageButton filterButton = this.getFilterButton();
+            if (filterButton != null){
+                filterButton.setImageResource(R.drawable.ic_filter_pressed);
+                filterButton.invalidate();
+            }
+        } else {
+            ImageButton filterButton = this.getFilterButton();
+            if (filterButton != null){
+                filterButton.setImageResource(R.drawable.ic_filter);
+                filterButton.invalidate();
+            }
+        }
+    }
+
     /**
      * Opens the filter menu above an given anchor view.
      * @param View anchor view
@@ -1100,6 +1124,8 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
      public void actualiseCurrentPlot(){
          this.spinner.setVisibility(View.VISIBLE);
 
+         this.actualiseFilterButton();
+
          LinearLayout plotLayout = (LinearLayout) this.rootView.findViewById(R.id.plot_layout);
 
          if (this.barGraph != null)

+ 130 - 69
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ThreatMapFragment.java

@@ -15,7 +15,6 @@ import android.content.DialogInterface;
 import android.graphics.Color;
 import android.location.Location;
 import android.os.Bundle;
-import android.util.Log;
 import android.view.InflateException;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -53,12 +52,17 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 		GooglePlayServicesClient.ConnectionCallbacks,
 		GooglePlayServicesClient.OnConnectionFailedListener,
 		LocationListener {
+
 	private static GoogleMap sMap = null;
+
 	private static View sView = null;
 
+	private static Thread mLoader = null;
+
 	private static HashMap<String, String> sMarkerIDToSSID = new HashMap<String, String>();
 
 	private LocationClient mLocationClient;
+
 	private static final LocationRequest REQUEST = LocationRequest.create()
 			.setExpirationDuration(5000) // 5 seconds
 			.setInterval(5000)           // 5 seconds
@@ -103,7 +107,7 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 		recordOverviewFragment.setGroupKey("ESSID");
 
 		MainActivity.getInstance().injectFragment(recordOverviewFragment, false);
-			//recordOverviewFragment.showDetailsForSSID(getActivity(), ssid);
+		//recordOverviewFragment.showDetailsForSSID(getActivity(), ssid);
 		//}
 	}
 
@@ -136,7 +140,9 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 	 * easier to use than LatLng
 	 */
 	private class Point {
+
 		public double x, y;
+
 		public Point(double sx, double sy) {
 			x = sx;
 			y = sy;
@@ -149,10 +155,13 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 	 * see MAX_DISTANCE
 	 */
 	private class SSIDArea {
+
 		private Point mMinimum, mMaximum;
+
 		public int numPoints;
 
 		public static final int MAX_NUM_ATTACKS = 20;
+
 		public static final float MAX_DISTANCE = 1000.0f; // 1km
 
 		public SSIDArea(LatLng initialLocation) {
@@ -166,16 +175,25 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 		public boolean doesLocationBelongToArea(LatLng location) {
 			LatLng center = calculateCenterLocation();
 			float[] result = new float[1];
-			Location.distanceBetween(center.latitude, center.longitude, location.latitude, location.longitude, result);
+			Location.distanceBetween(center.latitude, center.longitude, location.latitude,
+					location.longitude, result);
 			return result[0] < MAX_DISTANCE;
 		}
 
 		public void addLocation(LatLng location) {
 			Point point = new Point(location.latitude, location.longitude);
-			if (point.x < mMinimum.x) mMinimum.x = point.x;
-			if (point.x > mMaximum.x) mMaximum.x = point.x;
-			if (point.y < mMinimum.y) mMinimum.y = point.y;
-			if (point.y > mMaximum.y) mMaximum.y = point.y;
+			if (point.x < mMinimum.x) {
+				mMinimum.x = point.x;
+			}
+			if (point.x > mMaximum.x) {
+				mMaximum.x = point.x;
+			}
+			if (point.y < mMinimum.y) {
+				mMinimum.y = point.y;
+			}
+			if (point.y > mMaximum.y) {
+				mMaximum.y = point.y;
+			}
 			numPoints++;
 		}
 
@@ -191,74 +209,108 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 
 		public int calculateColor() {
 			int threatLevel = numPoints;
-			if (threatLevel > MAX_NUM_ATTACKS) threatLevel = MAX_NUM_ATTACKS;
-			float alpha = 1.0f - (float)(threatLevel-1) / (float)(MAX_NUM_ATTACKS-1);
+			if (threatLevel > MAX_NUM_ATTACKS) {
+				threatLevel = MAX_NUM_ATTACKS;
+			}
+			float alpha = 1.0f - (float) (threatLevel - 1) / (float) (MAX_NUM_ATTACKS - 1);
 			return Color.argb(127, (int) (240.0 + 15.0 * alpha), (int) (80.0 + 175.0 * alpha), 60);
 		}
 	}
 
 	/**
 	 * fills the map with markers and circle representing SSIDs
+	 * does it asynchronously in background thread
 	 */
 	private void populateMap() {
-		sMap.clear();
-
-		UglyDbHelper dbh = new UglyDbHelper(getActivity());
-		ArrayList<Record> records = dbh.getRecordsForFilter(new LogFilter());
-
-		HashMap<String, ArrayList<SSIDArea>> threadAreas = new HashMap<String, ArrayList<SSIDArea>>();
-
-		for (Record record : records) {
-			LatLng location = new LatLng(record.getLatitude(), record.getLongitude());
-			Log.i("location", "lat: " + location.latitude + " long: " + location.longitude);
-			ArrayList<SSIDArea> areas;
-			if (threadAreas.containsKey(record.getSsid())) {
-				areas = threadAreas.get(record.getSsid());
-				boolean foundArea = false;
-				for (SSIDArea area : areas) {
-					if (area.doesLocationBelongToArea(location)) {
-						area.addLocation(location);
-						foundArea = true;
-						break;
-					}
+		if (mLoader != null) {
+			mLoader.interrupt();
+		}
+		mLoader = new Thread(new Runnable() {
+			private void updateUI(final HashMap<String, ArrayList<SSIDArea>> threatAreas) {
+				if (mLoader.isInterrupted()) {
+					return;
 				}
-				if (!foundArea) {
-					areas.add(new SSIDArea(location));
+
+				Activity activity = getActivity();
+				if (activity != null) {
+					activity.runOnUiThread(new Runnable() {
+						@Override
+						public void run() {
+							sMap.clear();
+
+							CircleOptions circleOptions = new CircleOptions().radius(200.0)
+									.fillColor(Color.argb(127, 240, 80, 60)).strokeWidth(0.0f);
+							BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory
+									.fromResource(R.drawable.wifi_marker);
+							for (Map.Entry<String, ArrayList<SSIDArea>> entry : threatAreas.entrySet()) {
+								String ssid = entry.getKey();
+								ArrayList<SSIDArea> areas = entry.getValue();
+
+								for (SSIDArea area : areas) {
+									int color = area.calculateColor();
+									LatLng center = area.calculateCenterLocation();
+									float radius = area.calculateRadius();
+
+									sMap.addCircle(circleOptions.center(center).radius(100.0 + radius)
+											.fillColor(color));
+									Marker marker = sMap.addMarker(new MarkerOptions()
+											.title(ssid + ": " + area.numPoints + (area.numPoints == 1
+													? getResources()
+													.getString(R.string.attack)
+													: getResources().getString(R.string.attacks))).position(
+													center));
+									marker.setIcon(bitmapDescriptor);
+
+									sMarkerIDToSSID.put(marker.getId(), ssid);
+								}
+							}
+
+						}
+					});
 				}
-			} else {
-				areas = new ArrayList<SSIDArea>();
-				areas.add(new SSIDArea(location));
-				threadAreas.put(record.getSsid(), areas);
 			}
-		}
 
-		CircleOptions circleOptions = new CircleOptions().radius(200.0).fillColor(Color.argb(127, 240, 80, 60)).strokeWidth(0.0f);
-		BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.wifi_marker);
-		for (Map.Entry<String, ArrayList<SSIDArea>> entry : threadAreas.entrySet()) {
-			String ssid = entry.getKey();
-			ArrayList<SSIDArea> areas = entry.getValue();
-
-			for (SSIDArea area : areas) {
-				int color = area.calculateColor();
-				LatLng center = area.calculateCenterLocation();
-				float radius = area.calculateRadius();
-
-				sMap.addCircle(circleOptions.center(center).radius(100.0 + radius).fillColor(color));
-				Marker marker = sMap.addMarker(new MarkerOptions()
-						.title(ssid + ": " + area.numPoints + (area.numPoints == 1 ? getResources()
-								.getString(R.string.attack)
-								: getResources().getString(R.string.attacks))).position(
-								center));
-				marker.setIcon(bitmapDescriptor);
-
-				sMarkerIDToSSID.put(marker.getId(), ssid);
+			private HashMap<String, ArrayList<SSIDArea>> doInBackground() {
+				UglyDbHelper dbh = new UglyDbHelper(getActivity());
+				ArrayList<Record> records = dbh.getRecordsForFilter(new LogFilter());
+
+				HashMap<String, ArrayList<SSIDArea>> threatAreas
+						= new HashMap<String, ArrayList<SSIDArea>>();
+
+				for (Record record : records) {
+					LatLng location = new LatLng(record.getLatitude(), record.getLongitude());
+					//Log.i("location", "lat: " + location.latitude + " long: " + location.longitude);
+					ArrayList<SSIDArea> areas;
+					if (threatAreas.containsKey(record.getSsid())) {
+						areas = threatAreas.get(record.getSsid());
+						boolean foundArea = false;
+						for (SSIDArea area : areas) {
+							if (area.doesLocationBelongToArea(location)) {
+								area.addLocation(location);
+								foundArea = true;
+								break;
+							}
+						}
+						if (!foundArea) {
+							areas.add(new SSIDArea(location));
+						}
+					} else {
+						areas = new ArrayList<SSIDArea>();
+						areas.add(new SSIDArea(location));
+						threatAreas.put(record.getSsid(), areas);
+					}
+				}
+
+				return threatAreas;
 			}
-		}
 
-		sMap.setMyLocationEnabled(true);
+			@Override
+			public void run() {
+				updateUI(doInBackground());
+			}
+		});
 
-		LatLng tudarmstadt = new LatLng(49.86923, 8.6632768); // default location
-		sMap.moveCamera(CameraUpdateFactory.newLatLngZoom(tudarmstadt, 13));
+		mLoader.start(); // run!
 	}
 
 	/**
@@ -267,14 +319,14 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 	 * view must be removed if this object has been created once before
 	 * that is why view is static
 	 *
-	 * @param inflater the inflater
-	 * @param container the container
+	 * @param inflater           the inflater
+	 * @param container          the container
 	 * @param savedInstanceState the savedInstanceState
 	 * @return the view
 	 */
 	@Override
 	public View onCreateView(final LayoutInflater inflater, ViewGroup container,
-	                         Bundle savedInstanceState) {
+			Bundle savedInstanceState) {
 		super.onCreateView(inflater, container, savedInstanceState);
 
 		final Activity activity = getActivity();
@@ -284,10 +336,11 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 
 		if (sView != null) {
 			ViewGroup parent = (ViewGroup) sView.getParent();
-			if (parent != null)
+			if (parent != null) {
 				parent.removeView(sView);
+			}
 		}
-		
+
 		try {
 			sView = inflater.inflate(R.layout.fragment_threatmap, container, false);
 			if (isGooglePlay()) {
@@ -301,7 +354,7 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 				}
 			}
 		} catch (InflateException e) {
-        	// map already exists
+			// map already exists
 			//e.printStackTrace();
 		}
 
@@ -318,7 +371,8 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 				public View getInfoContents(Marker marker) {
 					View view = inflater.inflate(R.layout.fragment_threatmap_infowindow, null);
 					if (view != null) {
-						TextView titleTextView = (TextView)view.findViewById(R.id.threatmap_infowindow_title);
+						TextView titleTextView = (TextView) view
+								.findViewById(R.id.threatmap_infowindow_title);
 						if (titleTextView != null) {
 							titleTextView.setText(marker.getTitle());
 						}
@@ -327,6 +381,11 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 				}
 			});
 
+			sMap.setMyLocationEnabled(true);
+
+			LatLng tudarmstadt = new LatLng(49.86923, 8.6632768); // default location
+			sMap.moveCamera(CameraUpdateFactory.newLatLngZoom(tudarmstadt, 13));
+
 			populateMap();
 		}
 
@@ -340,7 +399,8 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 								public void onClick(DialogInterface dialog,
 										int which) {
 								}
-							})
+							}
+					)
 					.setIcon(android.R.drawable.ic_dialog_info).show();
 		}
 
@@ -351,7 +411,8 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 	public void onResume() {
 		super.onResume();
 		if (mLocationClient == null) {
-			mLocationClient = new LocationClient(MainActivity.getInstance().getApplicationContext(), this, this);
+			mLocationClient = new LocationClient(MainActivity.getInstance().getApplicationContext(),
+					this, this);
 		}
 		mLocationClient.connect();
 	}