|
@@ -37,6 +37,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
|
|
private static final String KEY_PROTOCOL = "protocol";
|
|
|
private static final String KEY_TYPE = "type";
|
|
|
private static final String KEY_TIME = "timestamp";
|
|
|
+ private static final String KEY_EXTERNAL_IP ="externalIP";
|
|
|
private static final String KEY_LOCAL_IP = "localIP";
|
|
|
private static final String KEY_LOCAL_HOSTNAME = "localHostName";
|
|
|
private static final String KEY_LOCAL_PORT = "localPort";
|
|
@@ -50,7 +51,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
|
|
// Database sql create statements
|
|
|
private static final String CREATE_RECORD_TABLE = "CREATE TABLE " + TABLE_RECORDS + "(" + KEY_ID
|
|
|
+ " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_ATTACK_ID + " INTEGER," + KEY_PROTOCOL + " TEXT,"
|
|
|
- + KEY_TYPE + " TEXT," + KEY_TIME + " INTEGER," + KEY_LOCAL_IP
|
|
|
+ + KEY_TYPE + " TEXT," + KEY_TIME + " INTEGER," + KEY_EXTERNAL_IP + " TEXT," + KEY_LOCAL_IP
|
|
|
+ " BLOB," + KEY_LOCAL_HOSTNAME + " TEXT," + KEY_LOCAL_PORT + " INTEGER," + KEY_REMOTE_IP
|
|
|
+ " BLOB," + KEY_REMOTE_HOSTNAME + " TEXT," + KEY_REMOTE_PORT + " INTEGER,"
|
|
|
+ KEY_BSSID + " TEXT," + KEY_PACKET + " TEXT,"
|
|
@@ -97,6 +98,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
|
|
recordValues.put(KEY_PROTOCOL, record.getProtocol().toString());
|
|
|
recordValues.put(KEY_TYPE, record.getType().name()); // Log Type
|
|
|
recordValues.put(KEY_TIME, record.getTimestamp()); // Log Timestamp
|
|
|
+ recordValues.put(KEY_EXTERNAL_IP, record.getExternalIP());
|
|
|
recordValues.put(KEY_LOCAL_IP, record.getLocalIP().getAddress()); // Log Local IP
|
|
|
recordValues.put(KEY_LOCAL_HOSTNAME, record.getLocalIP().getHostName());
|
|
|
recordValues.put(KEY_LOCAL_PORT, record.getLocalPort()); // Log Local Port
|
|
@@ -125,13 +127,14 @@ public class DatabaseHandler extends SQLiteOpenHelper {
|
|
|
record.setProtocol(cursor.getString(2));
|
|
|
record.setType(cursor.getString(3).equals("SEND") ? TYPE.SEND : TYPE.RECEIVE);
|
|
|
record.setTimestamp(cursor.getLong(4));
|
|
|
- record.setLocalIP(InetAddress.getByAddress(cursor.getString(6), cursor.getBlob(5)));
|
|
|
- record.setLocalPort(Integer.parseInt(cursor.getString(7)));
|
|
|
- record.setRemoteIP(InetAddress.getByAddress(cursor.getString(9), cursor.getBlob(8)));
|
|
|
- record.setRemotePort(Integer.parseInt(cursor.getString(10)));
|
|
|
- record.setBSSID(cursor.getString(11));
|
|
|
- record.setPacket(cursor.getString(12));
|
|
|
- record.setSSID(cursor.getString(13));
|
|
|
+ record.setExternalIP(cursor.getString(5));
|
|
|
+ record.setLocalIP(InetAddress.getByAddress(cursor.getString(7), cursor.getBlob(6)));
|
|
|
+ record.setLocalPort(Integer.parseInt(cursor.getString(8)));
|
|
|
+ record.setRemoteIP(InetAddress.getByAddress(cursor.getString(10), cursor.getBlob(9)));
|
|
|
+ record.setRemotePort(Integer.parseInt(cursor.getString(11)));
|
|
|
+ record.setBSSID(cursor.getString(12));
|
|
|
+ record.setPacket(cursor.getString(13));
|
|
|
+ record.setSSID(cursor.getString(14));
|
|
|
} catch (UnknownHostException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|