Skip to content

Commit 63e4318

Browse files
committed
test: Check clamscan --scan-image and --scan-image-fuzzy-hash
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).
1 parent 48393b6 commit 63e4318

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

unit_tests/clamscan/fuzzy_img_hash_test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,26 @@ def test_sigs_good_allmatch(self):
6060
]
6161
self.verify_output(output.out, expected=expected_stdout)
6262

63+
# Try again with image fuzzy hashing disabled to verify the flag will disable this feature (at least for PNG files)
64+
command = '{valgrind} {valgrind_args} {clamscan} -d {path_db} {testfiles} --allmatch --scan-image-fuzzy-hash=no'.format(
65+
valgrind=TC.valgrind, valgrind_args=TC.valgrind_args, clamscan=TC.clamscan,
66+
path_db=TC.path_tmp / 'good.ldb',
67+
testfiles=TC.testfiles,
68+
)
69+
output = self.execute_command(command)
70+
71+
assert output.ec == 0 # virus
72+
73+
# Try again with image scanning disabled to verify that the flag disables this feature (at least for PNG files)
74+
command = '{valgrind} {valgrind_args} {clamscan} -d {path_db} {testfiles} --allmatch --scan-image=no'.format(
75+
valgrind=TC.valgrind, valgrind_args=TC.valgrind_args, clamscan=TC.clamscan,
76+
path_db=TC.path_tmp / 'good.ldb',
77+
testfiles=TC.testfiles,
78+
)
79+
output = self.execute_command(command)
80+
81+
assert output.ec == 0 # virus
82+
6383
#
6484
# Next check with the bad signatures
6585
#

0 commit comments

Comments
 (0)