Explorar o código

fixed sql syntax in getAllRecords
natural join only works, when there are no duplicate column names except
for keys
replaced by inner join using ()

Mihai Plasoianu %!s(int64=11) %!d(string=hai) anos
pai
achega
b6ff2bf10c

+ 1 - 1
res/values/protocols.xml

@@ -4,7 +4,7 @@
     <string-array name="protocols">
 		<item>ECHO</item>
         <item>FTP</item>
-        <item>GhostProtocol</item>
+        <item>GHOST</item>
         <item>HTTP</item>
         <item>HTTPS</item>
         <item>MySQL</item>

+ 3 - 4
src/de/tudarmstadt/informatik/hostage/logging/UglyDbHelper.java

@@ -282,8 +282,8 @@ public class UglyDbHelper extends SQLiteOpenHelper {
 		ArrayList<Record> recordList = new ArrayList<Record>();
 		// Select All Query
 		String selectQuery = "SELECT  * FROM " + TABLE_RECORDS
-				+ " NATURAL JOIN " + TABLE_ATTACK_INFO + " NATURAL JOIN "
-				+ TABLE_BSSIDS;
+				+ " NATURAL JOIN " + TABLE_ATTACK_INFO + " JOIN "
+				+ TABLE_BSSIDS + " USING (_bssid)";
 
 		SQLiteDatabase db = this.getWritableDatabase();
 		Cursor cursor = db.rawQuery(selectQuery, null);
@@ -640,8 +640,7 @@ public class UglyDbHelper extends SQLiteOpenHelper {
 		Record record = new Record();
 		record.setId(Integer.parseInt(cursor.getString(0)));
 		record.setAttack_id(cursor.getLong(1));
-		record.setType(cursor.getString(2).equals("SEND") ? TYPE.SEND
-				: TYPE.RECEIVE);
+		record.setType(TYPE.valueOf(cursor.getString(2)));
 		record.setTimestamp(cursor.getLong(3));
 		record.setPacket(cursor.getString(4));
 		record.setProtocol(cursor.getString(5));