Skip to content

Commit

Permalink
test: Check clamscan --scan-image and --scan-image-fuzzy-hash
Browse files Browse the repository at this point in the history
Use the existing clamscan image fuzzy hash tests to verify that both
--scan-image=no and also --scan-image-fuzzy-hash=no will disable image
fuzzy hash based detection (at least for PNG files).
  • Loading branch information
micahsnyder committed Mar 14, 2024
1 parent 48393b6 commit 63e4318
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions unit_tests/clamscan/fuzzy_img_hash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ def test_sigs_good_allmatch(self):
]
self.verify_output(output.out, expected=expected_stdout)

# Try again with image fuzzy hashing disabled to verify the flag will disable this feature (at least for PNG files)
command = '{valgrind} {valgrind_args} {clamscan} -d {path_db} {testfiles} --allmatch --scan-image-fuzzy-hash=no'.format(
valgrind=TC.valgrind, valgrind_args=TC.valgrind_args, clamscan=TC.clamscan,
path_db=TC.path_tmp / 'good.ldb',
testfiles=TC.testfiles,
)
output = self.execute_command(command)

assert output.ec == 0 # virus

# Try again with image scanning disabled to verify that the flag disables this feature (at least for PNG files)
command = '{valgrind} {valgrind_args} {clamscan} -d {path_db} {testfiles} --allmatch --scan-image=no'.format(
valgrind=TC.valgrind, valgrind_args=TC.valgrind_args, clamscan=TC.clamscan,
path_db=TC.path_tmp / 'good.ldb',
testfiles=TC.testfiles,
)
output = self.execute_command(command)

assert output.ec == 0 # virus

#
# Next check with the bad signatures
#
Expand Down

0 comments on commit 63e4318

Please sign in to comment.