|
@@ -37,6 +37,8 @@ public class SyncRecord implements Parcelable, Serializable {
|
|
|
private String externalIP;
|
|
|
private int wasInternalAttack; // 1 if attacker ip and local ip were in same subnet, else 0
|
|
|
|
|
|
+ private AttackRecord attackRecord;
|
|
|
+
|
|
|
// attack
|
|
|
//private int id;
|
|
|
//private long timestamp;
|
|
@@ -62,6 +64,7 @@ public class SyncRecord implements Parcelable, Serializable {
|
|
|
}
|
|
|
|
|
|
public SyncRecord(AttackRecord attackRecord){
|
|
|
+ this.attackRecord = attackRecord;
|
|
|
this.setAttack_id(attackRecord.getAttack_id());
|
|
|
this.setProtocol(attackRecord.getProtocol());
|
|
|
this.setExternalIP(attackRecord.getExternalIP());
|
|
@@ -90,6 +93,14 @@ public class SyncRecord implements Parcelable, Serializable {
|
|
|
|
|
|
this.messageRecords = source.readArrayList(MessageRecord.class.getClassLoader());
|
|
|
|
|
|
+ if (messageRecords != null){
|
|
|
+ AttackRecord attack= this.getAttackRecord();
|
|
|
+ for (MessageRecord messageRecord : this.messageRecords){
|
|
|
+ messageRecord.setAttack_id(attack.getAttack_id());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//this.id = source.readInt();
|
|
|
//this.timestamp = source.readLong();
|
|
|
//this.type = MessageRecord.TYPE.valueOf(source.readString());
|
|
@@ -124,25 +135,28 @@ public class SyncRecord implements Parcelable, Serializable {
|
|
|
|
|
|
|
|
|
public AttackRecord getAttackRecord(){
|
|
|
- boolean autoincrement = !this.device.equals(SyncDevice.currentDevice().getDeviceID());
|
|
|
- AttackRecord record = new AttackRecord(autoincrement);
|
|
|
-
|
|
|
- if (!autoincrement)
|
|
|
- record.setAttack_id(this.attack_id);
|
|
|
-
|
|
|
- this.attack_id = record.getAttack_id();
|
|
|
- record.setProtocol(this.protocol);
|
|
|
- record.setSync_id(this.sync_id);
|
|
|
- record.setLocalIP(this.localIP);
|
|
|
- record.setLocalPort(this.localPort);
|
|
|
- record.setBssid(this.bssid);
|
|
|
- record.setDevice(this.device);
|
|
|
- record.setExternalIP(this.externalIP);
|
|
|
- record.setWasInternalAttack(this.getWasInternalAttack());
|
|
|
- record.setRemoteIP(this.remoteIP);
|
|
|
- record.setRemotePort(this.remotePort);
|
|
|
-
|
|
|
- return record;
|
|
|
+ if (this.attackRecord == null){
|
|
|
+ boolean autoincrement = !this.device.equals(SyncDevice.currentDevice().getDeviceID());
|
|
|
+ AttackRecord record = new AttackRecord(autoincrement);
|
|
|
+
|
|
|
+ if (!autoincrement)
|
|
|
+ record.setAttack_id(this.attack_id);
|
|
|
+
|
|
|
+ this.attack_id = record.getAttack_id();
|
|
|
+ record.setProtocol(this.protocol);
|
|
|
+ record.setSync_id(this.sync_id);
|
|
|
+ record.setLocalIP(this.localIP);
|
|
|
+ record.setLocalPort(this.localPort);
|
|
|
+ record.setBssid(this.bssid);
|
|
|
+ record.setDevice(this.device);
|
|
|
+ record.setExternalIP(this.externalIP);
|
|
|
+ record.setWasInternalAttack(this.getWasInternalAttack());
|
|
|
+ record.setRemoteIP(this.remoteIP);
|
|
|
+ record.setRemotePort(this.remotePort);
|
|
|
+ this.attackRecord = record;
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.attackRecord;
|
|
|
}
|
|
|
|
|
|
public ArrayList<MessageRecord> getMessageRecords(){
|