|
@@ -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 client The socket on which a port scan has been detected.
|
|
* @param timestamp Timestamp when the portscan has been detected.
|
|
* @param timestamp Timestamp when the portscan has been detected.
|
|
*/
|
|
*/
|
|
private void logPortscan(Socket client, long timestamp){
|
|
private void logPortscan(Socket client, long timestamp){
|
|
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(service);
|
|
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(service);
|
|
SharedPreferences connInfo = service.getSharedPreferences(service.getString(R.string.connection_info), Context.MODE_PRIVATE);
|
|
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 attackRecord = new AttackRecord(true);
|
|
|
|
|
|
attackRecord.setProtocol("PORTSCAN");
|
|
attackRecord.setProtocol("PORTSCAN");
|