123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- 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<AttackRecord> CREATOR = new Parcelable.Creator<AttackRecord>() {
- @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());
- }
- }
|