Record.java 3.5 KB

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