Record.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. package de.tudarmstadt.informatik.hostage.logging;
  2. import java.io.Serializable;
  3. import de.tudarmstadt.informatik.hostage.logging.MessageRecord.TYPE;
  4. import de.tudarmstadt.informatik.hostage.logging.formatter.Formatter;
  5. /**
  6. * Record that holds all information of a message including full attack and network information.
  7. * This class should be avoided but is necessary due to inter group complications.
  8. */
  9. public class Record implements Serializable {
  10. private static final long serialVersionUID = 1L;
  11. //
  12. private MessageRecord message;
  13. // attack
  14. private AttackRecord attack;
  15. // network
  16. private NetworkRecord network;
  17. public Record(){
  18. message = new MessageRecord();
  19. attack = new AttackRecord();
  20. network = new NetworkRecord();
  21. }
  22. public float getAccuracy() {
  23. return network.getAccuracy();
  24. }
  25. public long getAttack_id() {
  26. return attack.getAttack_id();
  27. }
  28. public String getBssid() {
  29. return network.getBssid();
  30. }
  31. public String getExternalIP() {
  32. return attack.getExternalIP();
  33. }
  34. public int getId() {
  35. return message.getId();
  36. }
  37. public double getLatitude() {
  38. return network.getLatitude();
  39. }
  40. public String getLocalIP() {
  41. return attack.getLocalIP();
  42. }
  43. public int getLocalPort() {
  44. return attack.getLocalPort();
  45. }
  46. public double getLongitude() {
  47. return network.getLongitude();
  48. }
  49. public String getPacket() {
  50. return message.getPacket();
  51. }
  52. public String getProtocol() {
  53. return attack.getProtocol();
  54. }
  55. public String getRemoteIP() {
  56. return attack.getRemoteIP();
  57. }
  58. public int getRemotePort() {
  59. return attack.getRemotePort();
  60. }
  61. public boolean getWasInternalAttack() {
  62. return attack.getWasInternalAttack();
  63. }
  64. public String getSsid() {
  65. return network.getSsid();
  66. }
  67. public long getTimestamp() {
  68. return message.getTimestamp();
  69. }
  70. public long getTimestampLocation() {
  71. return network.getTimestampLocation();
  72. }
  73. public TYPE getType() {
  74. return message.getType();
  75. }
  76. public void setAccuracy(float accuracy) {
  77. network.setAccuracy(accuracy);
  78. }
  79. public void setAttack_id(long attack_id) {
  80. message.setAttack_id(attack_id);
  81. attack.setAttack_id(attack_id);
  82. }
  83. public void setBssid(String bssid) {
  84. attack.setBssid(bssid);
  85. network.setBssid(bssid);
  86. }
  87. public void setDevice(String deviceId){
  88. this.attack.setDevice(deviceId);
  89. }
  90. public String getDevice(){
  91. return this.attack.getDevice();
  92. }
  93. public void setSync_ID(long s){
  94. this.attack.setSync_id(s);
  95. }
  96. public long getSync_id(){
  97. return this.attack.getSync_id();
  98. }
  99. public void setExternalIP(String externalIP) {
  100. attack.setExternalIP(externalIP);
  101. }
  102. public void setId(int id) {
  103. message.setId(id);
  104. }
  105. public void setLatitude(double latitude) {
  106. network.setLatitude(latitude);
  107. }
  108. public void setLocalIP(String localIP) {
  109. attack.setLocalIP(localIP);
  110. }
  111. public void setLocalPort(int localPort) {
  112. attack.setLocalPort(localPort);
  113. }
  114. public void setLongitude(double longitude) {
  115. network.setLongitude(longitude);
  116. }
  117. public void setPacket(String packet) {
  118. message.setPacket(packet);
  119. }
  120. public void setProtocol(String protocol) {
  121. attack.setProtocol(protocol);
  122. }
  123. public void setRemoteIP(String remoteIP) {
  124. attack.setRemoteIP(remoteIP);
  125. }
  126. public void setRemotePort(int remotePort) {
  127. attack.setRemotePort(remotePort);
  128. }
  129. public void setWasInternalAttack(boolean internalAttack) {
  130. attack.setWasInternalAttack(internalAttack);
  131. }
  132. public void setSsid(String ssid) {
  133. network.setSsid(ssid);
  134. }
  135. public void setTimestamp(long timestamp) {
  136. message.setTimestamp(timestamp);
  137. }
  138. public void setTimestampLocation(long timestampLocation) {
  139. network.setTimestampLocation(timestampLocation);
  140. }
  141. public void setType(TYPE type) {
  142. message.setType(type);
  143. }
  144. @Override
  145. public String toString() {
  146. return toString(null);
  147. }
  148. public String toString(Formatter formatter) {
  149. if (null == formatter) {
  150. return Formatter.getDefault().format(this);
  151. }
  152. return formatter.format(this);
  153. }
  154. }