Record.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 setExternalIP(String externalIP) {
  88. attack.setExternalIP(externalIP);
  89. }
  90. public void setId(int id) {
  91. message.setId(id);
  92. }
  93. public void setLatitude(double latitude) {
  94. network.setLatitude(latitude);
  95. }
  96. public void setLocalIP(String localIP) {
  97. attack.setLocalIP(localIP);
  98. }
  99. public void setLocalPort(int localPort) {
  100. attack.setLocalPort(localPort);
  101. }
  102. public void setLongitude(double longitude) {
  103. network.setLongitude(longitude);
  104. }
  105. public void setPacket(String packet) {
  106. message.setPacket(packet);
  107. }
  108. public void setProtocol(String protocol) {
  109. attack.setProtocol(protocol);
  110. }
  111. public void setRemoteIP(String remoteIP) {
  112. attack.setRemoteIP(remoteIP);
  113. }
  114. public void setRemotePort(int remotePort) {
  115. attack.setRemotePort(remotePort);
  116. }
  117. public void setWasInternalAttack(boolean internalAttack) {
  118. attack.setWasInternalAttack(internalAttack);
  119. }
  120. public void setSsid(String ssid) {
  121. network.setSsid(ssid);
  122. }
  123. public void setTimestamp(long timestamp) {
  124. message.setTimestamp(timestamp);
  125. }
  126. public void setTimestampLocation(long timestampLocation) {
  127. network.setTimestampLocation(timestampLocation);
  128. }
  129. public void setType(TYPE type) {
  130. message.setType(type);
  131. }
  132. @Override
  133. public String toString() {
  134. return toString(null);
  135. }
  136. public String toString(Formatter formatter) {
  137. if (null == formatter) {
  138. return Formatter.getDefault().format(this);
  139. }
  140. return formatter.format(this);
  141. }
  142. }