Browse Source

first create portscan logs then inform the ui about the attack

Fabio Arnold 9 years ago
parent
commit
6201c14c09
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/de/tudarmstadt/informatik/hostage/Listener.java

+ 6 - 4
src/de/tudarmstadt/informatik/hostage/Listener.java

@@ -287,10 +287,6 @@ public class Listener implements Runnable {
 		SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(service);
 		SharedPreferences connInfo = service.getSharedPreferences(service.getString(R.string.connection_info), Context.MODE_PRIVATE);
 
-		// only handler informs about attacks so its name is used here
-		service.notifyUI(Handler.class.getName(), new String[] {service.getString(R.string.broadcast_started), "PORTSCAN", Integer.toString(
-				client.getPort())});
-
 		AttackRecord attackRecord = new AttackRecord(true);
 
 		attackRecord.setProtocol("PORTSCAN");
@@ -316,5 +312,11 @@ public class Listener implements Runnable {
 			networkRecord.setTimestampLocation(0);
 		}
 		Logger.logPortscan(Hostage.getContext(), attackRecord, networkRecord, timestamp);
+
+		// now that the record exists we can inform the ui
+		// only handler informs about attacks so its name is used here
+		service.notifyUI(Handler.class.getName(),
+				new String[]{service.getString(R.string.broadcast_started), "PORTSCAN",
+						Integer.toString(client.getPort())});
 	}
 }