mirror of https://github.com/M66B/NetGuard.git
Access log since
This commit is contained in:
parent
feb4430aa3
commit
7c85c8a4b2
15
app/app.iml
15
app/app.iml
|
@ -50,13 +50,6 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/renderscript" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/all/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/all/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/assets" type="java-test-resource" />
|
||||
|
@ -65,6 +58,13 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/all/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/all/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/all/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/all/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/all/assets" type="java-resource" />
|
||||
|
@ -143,6 +143,7 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />
|
||||
|
|
|
@ -717,7 +717,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public Cursor getAccessUnset(int uid, int limit) {
|
||||
public Cursor getAccessUnset(int uid, int limit, long since) {
|
||||
lock.readLock().lock();
|
||||
try {
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
|
@ -727,11 +727,12 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
query += " FROM access";
|
||||
query += " WHERE uid = ?";
|
||||
query += " AND block < 0";
|
||||
query += " AND time >= ?";
|
||||
query += " GROUP BY daddr, allowed";
|
||||
query += " ORDER BY time DESC";
|
||||
if (limit > 0)
|
||||
query += " LIMIT " + limit;
|
||||
return db.rawQuery(query, new String[]{Integer.toString(uid)});
|
||||
return db.rawQuery(query, new String[]{Integer.toString(uid), Long.toString(since)});
|
||||
} finally {
|
||||
lock.readLock().unlock();
|
||||
}
|
||||
|
|
|
@ -2643,7 +2643,16 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
notification.addLine(sp);
|
||||
}
|
||||
|
||||
Cursor cursor = DatabaseHelper.getInstance(ServiceSinkhole.this).getAccessUnset(uid, 7);
|
||||
long since = 0;
|
||||
PackageManager pm = getPackageManager();
|
||||
String[] packages = pm.getPackagesForUid(uid);
|
||||
if (packages != null && packages.length > 0)
|
||||
try {
|
||||
since = pm.getPackageInfo(packages[0], 0).firstInstallTime;
|
||||
} catch (PackageManager.NameNotFoundException ignored) {
|
||||
}
|
||||
|
||||
Cursor cursor = DatabaseHelper.getInstance(ServiceSinkhole.this).getAccessUnset(uid, 7, since);
|
||||
int colDAddr = cursor.getColumnIndex("daddr");
|
||||
int colTime = cursor.getColumnIndex("time");
|
||||
int colAllowed = cursor.getColumnIndex("allowed");
|
||||
|
|
Loading…
Reference in New Issue