123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- 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);
- }
- }
|