|
@@ -62,6 +62,7 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
|
attackSQLBuilder.append(AttackEntry.COLUMN_NAME_LOCAL_PORT).append(" INTEGER,");
|
|
|
attackSQLBuilder.append(AttackEntry.COLUMN_NAME_REMOTE_IP).append(" BLOB,");
|
|
|
attackSQLBuilder.append(AttackEntry.COLUMN_NAME_REMOTE_PORT).append(" INTEGER,");
|
|
|
+ attackSQLBuilder.append(AttackEntry.COLUMN_NAME_INTERNAL_ATTACK).append(" INTEGER,");
|
|
|
attackSQLBuilder.append(AttackEntry.COLUMN_NAME_BSSID).append(" TEXT,");
|
|
|
attackSQLBuilder.append(String.format("FOREIGN KEY(%s) REFERENCES %s(%s)", AttackEntry.COLUMN_NAME_BSSID, NetworkEntry.TABLE_NAME,
|
|
|
NetworkEntry.COLUMN_NAME_BSSID));
|
|
@@ -110,20 +111,20 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
|
profilSQLBuilder.append(ProfileEntry.COLUMN_NAME_PROFILE_EDITABLE).append(" INTEGER,");
|
|
|
profilSQLBuilder.append(ProfileEntry.COLUMN_NAME_PROFILE_ACTIVE).append(" INTEGER");
|
|
|
profilSQLBuilder.append(")");
|
|
|
- SQL_CREATE_PROFIL_ENTRIES = profilSQLBuilder.toString();
|
|
|
+ SQL_CREATE_PROFILE_ENTRIES = profilSQLBuilder.toString();
|
|
|
}
|
|
|
|
|
|
private static final String SQL_CREATE_NETWORK_ENTRIES;
|
|
|
private static final String SQL_CREATE_ATTACK_ENTRIES;
|
|
|
private static final String SQL_CREATE_PACKET_ENTRIES;
|
|
|
- private static final String SQL_CREATE_PROFIL_ENTRIES;
|
|
|
+ private static final String SQL_CREATE_PROFILE_ENTRIES;
|
|
|
private static final String SQL_CREATE_SYNC_DEVICES_ENTRIES;
|
|
|
private static final String SQL_CREATE_SYNC_INFO_ENTRIES;
|
|
|
|
|
|
private static final String SQL_DELETE_PACKET_ENTRIES = "DROP TABLE IF EXISTS " + PacketEntry.TABLE_NAME;
|
|
|
private static final String SQL_DELETE_ATTACK_ENTRIES = "DROP TABLE IF EXISTS " + AttackEntry.TABLE_NAME;
|
|
|
private static final String SQL_DELETE_NETWORK_ENTRIES = "DROP TABLE IF EXISTS " + NetworkEntry.TABLE_NAME;
|
|
|
- private static final String SQL_DELETE_PROFIL_ENTRIES = "DROP TABLE IF EXISTS " + ProfileEntry.TABLE_NAME;
|
|
|
+ private static final String SQL_DELETE_PROFILE_ENTRIES = "DROP TABLE IF EXISTS " + ProfileEntry.TABLE_NAME;
|
|
|
private static final String SQL_DELETE_SYNC_DEVICES_ENTRIES = "DROP TABLE IF EXISTS " + SyncDeviceEntry.TABLE_NAME;
|
|
|
private static final String SQL_DELETE_SYNC_INFO_ENTRIES = "DROP TABLE IF EXISTS " + SyncInfoEntry.TABLE_NAME;
|
|
|
|
|
@@ -137,7 +138,7 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
|
db.execSQL(SQL_CREATE_NETWORK_ENTRIES);
|
|
|
db.execSQL(SQL_CREATE_ATTACK_ENTRIES);
|
|
|
db.execSQL(SQL_CREATE_PACKET_ENTRIES);
|
|
|
- db.execSQL(SQL_CREATE_PROFIL_ENTRIES);
|
|
|
+ db.execSQL(SQL_CREATE_PROFILE_ENTRIES);
|
|
|
db.execSQL(SQL_CREATE_SYNC_DEVICES_ENTRIES);
|
|
|
db.execSQL(SQL_CREATE_SYNC_INFO_ENTRIES);
|
|
|
}
|
|
@@ -147,7 +148,7 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
|
db.execSQL(SQL_DELETE_SYNC_INFO_ENTRIES);
|
|
|
db.execSQL(SQL_DELETE_PACKET_ENTRIES);
|
|
|
db.execSQL(SQL_DELETE_ATTACK_ENTRIES);
|
|
|
- db.execSQL(SQL_DELETE_PROFIL_ENTRIES);
|
|
|
+ db.execSQL(SQL_DELETE_PROFILE_ENTRIES);
|
|
|
db.execSQL(SQL_DELETE_NETWORK_ENTRIES);
|
|
|
db.execSQL(SQL_DELETE_SYNC_DEVICES_ENTRIES);
|
|
|
onCreate(db);
|
|
@@ -193,6 +194,7 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
|
attackValues.put(AttackEntry.COLUMN_NAME_REMOTE_IP, record.getRemoteIP()); // Log Remote IP
|
|
|
attackValues.put(AttackEntry.COLUMN_NAME_REMOTE_PORT, record.getRemotePort()); // Log Remote Port
|
|
|
attackValues.put(AttackEntry.COLUMN_NAME_BSSID, record.getBssid());
|
|
|
+ attackValues.put(AttackEntry.COLUMN_NAME_INTERNAL_ATTACK, record.getWasInternalAttack());
|
|
|
|
|
|
|
|
|
// Inserting Rows
|
|
@@ -907,7 +909,8 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
|
record.setLocalPort(Integer.parseInt(cursor.getString(4)));
|
|
|
record.setRemoteIP(cursor.getString(5));
|
|
|
record.setRemotePort(Integer.parseInt(cursor.getString(6)));
|
|
|
- record.setBssid(cursor.getString(7));
|
|
|
+ record.setWasInternalAttack(cursor.getInt(7) == 1);
|
|
|
+ record.setBssid(cursor.getString(8));
|
|
|
|
|
|
return record;
|
|
|
}
|
|
@@ -935,12 +938,14 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
|
record.setRemoteIP(cursor.getString(9));
|
|
|
record.setRemotePort(Integer.parseInt(cursor.getString(10)));
|
|
|
|
|
|
- record.setBssid(cursor.getString(11));
|
|
|
- record.setSsid(cursor.getString(12));
|
|
|
- record.setLatitude(Double.parseDouble(cursor.getString(13)));
|
|
|
- record.setLongitude(Double.parseDouble(cursor.getString(14)));
|
|
|
- record.setAccuracy(Float.parseFloat(cursor.getString(15)));
|
|
|
- record.setTimestampLocation(cursor.getLong(16));
|
|
|
+ record.setWasInternalAttack(Integer.parseInt(cursor.getString(11)) == 1);
|
|
|
+
|
|
|
+ record.setBssid(cursor.getString(12));
|
|
|
+ record.setSsid(cursor.getString(13));
|
|
|
+ record.setLatitude(Double.parseDouble(cursor.getString(14)));
|
|
|
+ record.setLongitude(Double.parseDouble(cursor.getString(15)));
|
|
|
+ record.setAccuracy(Float.parseFloat(cursor.getString(16)));
|
|
|
+ record.setTimestampLocation(cursor.getLong(17));
|
|
|
|
|
|
return record;
|
|
|
}
|