- Add signature count back to notification too
- Ignore hashes of empty content

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2023-12-25 14:24:43 -05:00
parent 0e5606adcc
commit ee3b4fed72
No known key found for this signature in database
GPG key ID: B286E9F57A07424B
4 changed files with 17 additions and 9 deletions

View file

@ -6,8 +6,8 @@ android {
applicationId "us.spotco.malwarescanner"
minSdkVersion 19
targetSdkVersion 32
versionCode 118
versionName "2.38"
versionCode 119
versionName "2.39"
resConfigs 'en', 'af', 'de', 'el', 'es', 'fi', 'fr', 'it', 'pl', 'pt', 'ru', 'tr', 'zh-rCN'
}
buildTypes {

View file

@ -184,7 +184,7 @@ class MalwareScanner extends AsyncTask<HashSet<File>, Object, String> {
}
}
if (Database.isDatabaseLoaded()) {
publishProgress("\t" + context.getString(R.string.main_database_loaded, String.valueOf(Database.signaturesCount)) + "\n", true);
publishProgress("\t" + context.getString(R.string.main_database_loaded, NumberFormat.getInstance().format(Database.signaturesCount)) + "\n", true);
//Perform a self-test
if (Database.selfTest()) {
@ -274,11 +274,15 @@ class MalwareScanner extends AsyncTask<HashSet<File>, Object, String> {
private void checkSignature(String hashType, HashMap<File, String> signaturesToCheck, BloomFilter<String> signatureDatabase) {
if (Database.isDatabaseLoaded() && signatureDatabase != null) {
for (Map.Entry<File, String> file : signaturesToCheck.entrySet()) {
if (signatureDatabase.mightContain(file.getValue())) {
amtMatchedFiles++;
publishProgress("Potential match in " + file.getKey().toString().replaceAll(Environment.getExternalStorageDirectory().toString(), "~"), false, fileHashesSHA256.get(file.getKey()));
} else {
//Log.d("Hypatia", "No match for " + file.getValue());
if (!file.getValue().equals("d41d8cd98f00b204e9800998ecf8427e")
&& !file.getValue().equals("da39a3ee5e6b4b0d3255bfef95601890afd80709")
&& !file.getValue().equals("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")) {
if (signatureDatabase.mightContain(file.getValue())) {
amtMatchedFiles++;
publishProgress("Potential match in " + file.getKey().toString().replaceAll(Environment.getExternalStorageDirectory().toString(), "~"), false, fileHashesSHA256.get(file.getKey()));
} else {
//Log.d("Hypatia", "No match for " + file.getValue());
}
}
}
publishProgress("\t" + context.getString(R.string.main_hash_scan_done, hashType) + "\n", true);

View file

@ -120,7 +120,7 @@ public class MalwareScannerService extends Service {
private void updateForegroundNotification() {
foregroundNotification
.setSubText(getString(R.string.main_files_scanned_count, NumberFormat.getInstance().format(Utils.FILES_SCANNED)));
.setSubText(NumberFormat.getInstance().format(Database.signaturesCount) + " sigs" + "" + getString(R.string.main_files_scanned_count, NumberFormat.getInstance().format(Utils.FILES_SCANNED)));
notificationManager.notify(-1, foregroundNotification.build());
}

View file

@ -0,0 +1,4 @@
* Show the approximate signature count
* Unbreak hash processing: md5 & sha1 were getting mixed up for years
* Add many checks to database processing
* Ignore hashes of empty content