AttackRecord.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. package de.tudarmstadt.informatik.hostage.logging;
  2. import java.io.Serializable;
  3. import android.os.Parcel;
  4. import android.os.Parcelable;
  5. /**
  6. * Holds all necessary information about a single attack.
  7. */
  8. public class AttackRecord implements Parcelable, Serializable {
  9. private static final long serialVersionUID = 6111024905373724227L;
  10. private long attack_id;
  11. private long sync_id;
  12. private String bssid;
  13. private String device;
  14. private String protocol;
  15. private String localIP;
  16. private int localPort;
  17. private String remoteIP;
  18. private int remotePort;
  19. private String externalIP;
  20. private int wasInternalAttack; // 1 if attacker ip and local ip were in same subnet, else 0
  21. public static final Parcelable.Creator<AttackRecord> CREATOR = new Parcelable.Creator<AttackRecord>() {
  22. @Override
  23. public AttackRecord createFromParcel(Parcel source) {
  24. return new AttackRecord(source);
  25. }
  26. @Override
  27. public AttackRecord[] newArray(int size) {
  28. return new AttackRecord[size];
  29. }
  30. };
  31. public AttackRecord() {
  32. }
  33. public AttackRecord(Parcel source) {
  34. this.attack_id = source.readLong();
  35. this.protocol = source.readString();
  36. this.localIP = source.readString();
  37. this.localPort = source.readInt();
  38. this.remoteIP = source.readString();
  39. this.remotePort = source.readInt();
  40. this.externalIP = source.readString();
  41. this.wasInternalAttack = source.readInt();
  42. this.bssid = source.readString();
  43. this.device = source.readString();
  44. this.sync_id = source.readLong();
  45. }
  46. @Override
  47. public int describeContents() {
  48. return 0;
  49. }
  50. @Override
  51. public void writeToParcel(Parcel dest, int flags) {
  52. dest.writeLong(attack_id);
  53. dest.writeString(protocol);
  54. dest.writeString(localIP);
  55. dest.writeInt(localPort);
  56. dest.writeString(remoteIP);
  57. dest.writeInt(remotePort);
  58. dest.writeString(externalIP);
  59. dest.writeInt(wasInternalAttack);
  60. dest.writeString(bssid);
  61. dest.writeString(device);
  62. dest.writeLong(sync_id);
  63. }
  64. /**
  65. * @return the attack_id
  66. */
  67. public long getAttack_id() {
  68. return attack_id;
  69. }
  70. /**
  71. * @param attack_id
  72. * the attack_id to set
  73. */
  74. public void setAttack_id(long attack_id) {
  75. this.attack_id = attack_id;
  76. }
  77. /**
  78. * @return the bssid
  79. */
  80. public String getBssid() {
  81. return bssid;
  82. }
  83. /**
  84. * @param bssid
  85. * the bssid to set
  86. */
  87. public void setBssid(String bssid) {
  88. this.bssid = bssid;
  89. }
  90. /**
  91. * @return the protocol
  92. */
  93. public String getProtocol() {
  94. return protocol;
  95. }
  96. /**
  97. * @param protocol
  98. * the protocol to set
  99. */
  100. public void setProtocol(String protocol) {
  101. this.protocol = protocol;
  102. }
  103. /**
  104. * @return the localIP
  105. */
  106. public String getLocalIP() {
  107. return localIP;
  108. }
  109. /**
  110. * @param localIP
  111. * the localIP to set
  112. */
  113. public void setLocalIP(String localIP) {
  114. this.localIP = localIP;
  115. }
  116. /**
  117. * @return the localPort
  118. */
  119. public int getLocalPort() {
  120. return localPort;
  121. }
  122. /**
  123. * @param localPort
  124. * the localPort to set
  125. */
  126. public void setLocalPort(int localPort) {
  127. this.localPort = localPort;
  128. }
  129. /**
  130. * @return the remoteIP
  131. */
  132. public String getRemoteIP() {
  133. return remoteIP;
  134. }
  135. /**
  136. * @param remoteIP
  137. * the remoteIP to set
  138. */
  139. public void setRemoteIP(String remoteIP) {
  140. this.remoteIP = remoteIP;
  141. }
  142. /**
  143. * @return the remotePort
  144. */
  145. public int getRemotePort() {
  146. return remotePort;
  147. }
  148. public long getSync_id(){return sync_id;}
  149. public String getDevice(){return device;}
  150. public void setDevice(String d){this.device = d;}
  151. public void setSync_id(long i){this.sync_id = i;}
  152. /**
  153. * @param remotePort
  154. * the remotePort to set
  155. */
  156. public void setRemotePort(int remotePort) {
  157. this.remotePort = remotePort;
  158. }
  159. /**
  160. * @return the externalIP
  161. */
  162. public String getExternalIP() {
  163. return externalIP;
  164. }
  165. /**
  166. * @param externalIP
  167. * the externalIP to set
  168. */
  169. public void setExternalIP(String externalIP) {
  170. this.externalIP = externalIP;
  171. }
  172. public boolean getWasInternalAttack() {return wasInternalAttack == 1;}
  173. public void setWasInternalAttack(boolean b) {wasInternalAttack = b ? 1 : 0;}
  174. }