|
@@ -3,6 +3,8 @@ package de.tudarmstadt.informatik.hostage.logging;
|
|
|
import java.io.Serializable;
|
|
|
import java.net.InetAddress;
|
|
|
|
|
|
+import de.tudarmstadt.informatik.hostage.format.LogViewFormatter;
|
|
|
+
|
|
|
/**
|
|
|
* This class defines the attributes of a record.<br>
|
|
|
* A Record is a single message exchanged between the application and an attacker.<br>
|
|
@@ -223,7 +225,7 @@ public class Record implements Serializable {
|
|
|
return String.format("%d %s [%d,%s:%d,%s:%d,%s]", attack_id,
|
|
|
((type == TYPE.SEND) ? "SEND" : "RECEIVE"), timestamp,
|
|
|
localIP.getHostAddress(), localPort, remoteIP.getHostAddress(),
|
|
|
- remotePort, packet);
|
|
|
+ remotePort, LogViewFormatter.format(getProtocol(), getPacket()));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -235,12 +237,12 @@ public class Record implements Serializable {
|
|
|
public String toString(int format){
|
|
|
// Choose String Format
|
|
|
switch (format){
|
|
|
+ // ViewLogTable format: contains all important information about an attack.
|
|
|
+ case 0:
|
|
|
+ return String.format("%d: %s %s\nIn %s\n(%s)\nFrom [%s:%d]\nTo [%s:%d]\n%s\n\n", attack_id, protocol, ((type == TYPE.SEND) ? "SEND" : "RECEIVE"), SSID, BSSID, remoteIP.getHostAddress(), remotePort, localIP.getHostAddress(), localPort, LogViewFormatter.format(getProtocol(), getPacket()));
|
|
|
// TraCINg Upload format, replaces internal ip's with external ip of network
|
|
|
case 1:
|
|
|
return String.format("{ \"sensor\":{\"type\": \"Honeypot\", \"name\": \"HOsTaGe\"}, \"type\": \"%s\", \"src\":{\"ip\": \"%s\", \"port\": %d}, \"dst\":{\"ip\": \"%s\", \"port\": %d} }", protocol + " server access", externalIP, remotePort, externalIP, localPort);
|
|
|
- // ViewLogTable format: contains all important information about an attack.
|
|
|
- case 2:
|
|
|
- return String.format("%d: %s\nIn %s\n(%s)\nFrom [%s:%d]\nTo [%s:%d]\n", attack_id, protocol, SSID, BSSID, remoteIP.getHostAddress(), remotePort, localIP.getHostAddress(), localPort);
|
|
|
default:
|
|
|
return toString();
|
|
|
}
|