Browse Source

notify ui about portscan

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

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

@@ -279,14 +279,18 @@ public class Listener implements Runnable {
 	}	
 	
 	/**
-	 * Logs a port scan attack
+	 * Logs a port scan attack and notifies ui about the portscan
 	 * @param client The socket on which a port scan has been detected.
 	 * @param timestamp Timestamp when the portscan has been detected.
 	 */
 	private void logPortscan(Socket client, long timestamp){
 		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");