mirror of
https://github.com/MaintainTeam/Hypatia.git
synced 2025-02-28 21:38:21 +03:00
Declare QUERY_ALL_PACKAGES
Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
c15aba2a97
commit
55305f88f1
4 changed files with 11 additions and 3 deletions
|
@ -7,6 +7,7 @@
|
|||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<queries>
|
||||
<package android:name="org.torproject.android" />
|
||||
|
|
|
@ -32,14 +32,16 @@ public class EventReceiver extends BroadcastReceiver {
|
|||
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
|
||||
Utils.considerStartService(context);
|
||||
}
|
||||
//Broken on Android 8.0+
|
||||
if (intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED)) {
|
||||
if (intent.getDataString().contains(context.getPackageName())) {
|
||||
Utils.considerStartService(context); //We've been updated, restart service
|
||||
} else {
|
||||
//Log.d("Hypatia", "An app has been updated");
|
||||
//scanApp(context, intent.getDataString());//An app was updated, scan it
|
||||
}
|
||||
}
|
||||
if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) {
|
||||
} else if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) {
|
||||
//Log.d("Hypatia", "An app has been installed");
|
||||
//scanApp(context, intent.getDataString());//An app was installed, scan it
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +50,9 @@ public class EventReceiver extends BroadcastReceiver {
|
|||
if (Utils.isServiceRunning(MalwareScannerService.class, context)) {
|
||||
HashSet<File> filesToScan = new HashSet<>();
|
||||
try {
|
||||
filesToScan.add(new File(context.getPackageManager().getApplicationInfo(appID, PackageManager.GET_META_DATA).sourceDir));
|
||||
File appToScan = new File(context.getPackageManager().getApplicationInfo(appID, PackageManager.GET_META_DATA).sourceDir);
|
||||
//Log.d("Hypatia", "Scanning app " + appToScan);
|
||||
filesToScan.add(appToScan);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -251,6 +251,7 @@ public class MainActivity extends Activity {
|
|||
if (scanApps) {
|
||||
for (ApplicationInfo packageInfo : getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA)) {
|
||||
filesToScan.add(new File(packageInfo.sourceDir));
|
||||
//Log.d("Hypatia", "Planning to scan " + packageInfo.sourceDir);
|
||||
}
|
||||
}
|
||||
if (scanInternal) {
|
||||
|
|
|
@ -207,6 +207,8 @@ class MalwareScanner extends AsyncTask<HashSet<File>, Object, String> {
|
|||
for (Map.Entry<File, String> file : signaturesToCheck.entrySet()) {
|
||||
if (signatureDatabase.mightContain(file.getValue())) {
|
||||
publishProgress("Potential match in " + file.getKey().toString().replaceAll(Environment.getExternalStorageDirectory().toString(), "~"), false);
|
||||
} else {
|
||||
//Log.d("Hypatia", "No match for " + file.getValue());
|
||||
}
|
||||
}
|
||||
publishProgress("\t" + context.getString(R.string.main_hash_scan_done, hashType) + "\n", true);
|
||||
|
|
Loading…
Add table
Reference in a new issue