package de.tudarmstadt.informatik.hostage.logging; import java.net.InetAddress; public class SQLRecord { // private variables private int id; private int attack_id; private String protocol; private String type; private String timestamp; private String localIP; private int localPort; private String remoteIP; private int remotePort; private String packet; // Empty constructor public SQLRecord() { } // constructor public SQLRecord(int id, int attack_id, String protocol, String type, String timestamp, String localIP, int localPort, String remoteIP, int remotePort, String packet) { this.id = id; this.attack_id = attack_id; this.setProtocol(protocol); this.type = type; this.timestamp = timestamp; this.localIP = localIP; this.localPort = localPort; this.remoteIP = remoteIP; this.remotePort = remotePort; this.packet = packet; } // constructor public SQLRecord(int attack_id, String protocol, String type, String timestamp, String localIP, int localPort, String remoteIP, int remotePort, String packet) { this.attack_id = attack_id; this.setProtocol(protocol); this.type = type; this.timestamp = timestamp; this.localIP = localIP; this.localPort = localPort; this.remoteIP = remoteIP; this.remotePort = remotePort; this.packet = packet; } /** * @return the id */ public int getID() { return id; } /** * @param id * the id to set */ public void setID(int id) { this.id = id; } /** * @return the attack_id */ public int getAttack_id() { return attack_id; } /** * @param attack_id * the attack_id to set */ public void setAttack_id(int attack_id) { this.attack_id = attack_id; } /** * @return the protocol */ public String getProtocol() { return protocol; } /** * @param protocol the protocol to set */ public void setProtocol(String protocol) { this.protocol = protocol; } /** * @return the type */ public String getType() { return type; } /** * @param type * the type to set */ public void setType(String type) { this.type = type; } /** * @return the timestamp */ public String getTimestamp() { return timestamp; } /** * @param timestamp * the timestamp to set */ public void setTimestamp(String timestamp) { this.timestamp = timestamp; } /** * @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 packet */ public String getPacket() { return packet; } /** * @param packet * the packet to set */ public void setPacket(String packet) { this.packet = packet; } @Override public String toString() { return String.format("%d %s [%s,%s:%d,%s:%d,%s]", attack_id, type, timestamp, localIP, localPort, remoteIP, remotePort, packet); } public String toJson() { return String .format("{ \"src\":{\"IP\": %s, \"Port\": %d} \"dst\": {\"IP\": %s, \"Port\": %d} \"type\": 0 \"name\": \"HOsTaGe\" }", localIP, localPort, remoteIP, remotePort); } }