package de.tudarmstadt.informatik.hostage.logging; import java.io.Serializable; import android.os.Parcel; import android.os.Parcelable; /** * Holds all necessary information about a single attack. */ public class AttackRecord implements Parcelable, Serializable { private static final long serialVersionUID = 6111024905373724227L; private long attack_id; private String bssid; private String protocol; private String localIP; private int localPort; private String remoteIP; private int remotePort; private String externalIP; public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override public AttackRecord createFromParcel(Parcel source) { return new AttackRecord(source); } @Override public AttackRecord[] newArray(int size) { return new AttackRecord[size]; } }; public AttackRecord() { } public AttackRecord(Parcel source) { this.attack_id = source.readLong(); this.protocol = source.readString(); this.localIP = source.readString(); this.localPort = source.readInt(); this.remoteIP = source.readString(); this.remotePort = source.readInt(); this.externalIP = source.readString(); this.bssid = source.readString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeLong(attack_id); dest.writeString(protocol); dest.writeString(localIP); dest.writeInt(localPort); dest.writeString(remoteIP); dest.writeInt(remotePort); dest.writeString(externalIP); dest.writeString(bssid); } /** * @return the attack_id */ public long getAttack_id() { return attack_id; } /** * @param attack_id * the attack_id to set */ public void setAttack_id(long attack_id) { this.attack_id = attack_id; } /** * @return the bssid */ public String getBssid() { return bssid; } /** * @param bssid * the bssid to set */ public void setBssid(String bssid) { this.bssid = bssid; } /** * @return the protocol */ public String getProtocol() { return protocol; } /** * @param protocol * the protocol to set */ public void setProtocol(String protocol) { this.protocol = protocol; } /** * @return the localIP */ public String getLocalIP() { return localIP; } /** * @param localIP * the localIP to set */ public void setLocalIP(String localIP) { this.localIP = localIP; } /** * @return the localPort */ public int getLocalPort() { return localPort; } /** * @param localPort * the localPort to set */ public void setLocalPort(int localPort) { this.localPort = localPort; } /** * @return the remoteIP */ public String getRemoteIP() { return remoteIP; } /** * @param remoteIP * the remoteIP to set */ public void setRemoteIP(String remoteIP) { this.remoteIP = remoteIP; } /** * @return the remotePort */ public int getRemotePort() { return remotePort; } /** * @param remotePort * the remotePort to set */ public void setRemotePort(int remotePort) { this.remotePort = remotePort; } /** * @return the externalIP */ public String getExternalIP() { return externalIP; } /** * @param externalIP * the externalIP to set */ public void setExternalIP(String externalIP) { this.externalIP = externalIP; } // TEMP ZU TEST @Override public String toString() { return String .format("{ \"sensor\":{\"type\": \"Honeypot\", \"name\": \"HosTaGe\"}, \"type\": \"%s server access\", \"src\":{\"ip\": \"%s\", \"port\": %d}, \"dst\":{\"ip\": \"%s\", \"port\": %d} }", getProtocol(), getRemoteIP(), getRemotePort(), getExternalIP(), getLocalPort()); } }