Procházet zdrojové kódy

first create portscan logs then inform the ui about the attack

Fabio Arnold před 10 roky
rodič
revize
6201c14c09

+ 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())});
 	}
 }