diff --git a/unit_tests/clamscan/alz_test.py b/unit_tests/clamscan/alz_test.py new file mode 100644 index 0000000000..e01c1798d2 --- /dev/null +++ b/unit_tests/clamscan/alz_test.py @@ -0,0 +1,45 @@ +# Copyright (C) 2020-2024 Cisco Systems, Inc. and/or its affiliates. All rights reserved. + +""" +Run clamscan tests. +""" + +import sys + +sys.path.append('../unit_tests') +import testcase + + +class TC(testcase.TestCase): + @classmethod + def setUpClass(cls): + super(TC, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + super(TC, cls).tearDownClass() + + def setUp(self): + super(TC, self).setUp() + + def tearDown(self): + super(TC, self).tearDown() + self.verify_valgrind_log() + + def test_pdf_hook(self): + self.step_name('Test alz files compressed with deflate (gzip)') + + testfile = TC.path_source / 'unit_tests' / 'input' / 'other_scanfiles' / 'deflate.alz' + command = '{valgrind} {valgrind_args} {clamscan} -d {path_db} {testfile}'.format( + valgrind=TC.valgrind, valgrind_args=TC.valgrind_args, clamscan=TC.clamscan, + path_db=TC.path_source / 'unit_tests' / 'input' / 'other_sigs' / 'alz.hdb', + testfile=testfile, + ) + output = self.execute_command(command) + + assert output.ec == 1 # virus + + expected_results = [ + 'test.txt.UNOFFICIAL FOUND', + ] + self.verify_output(output.out, expected=expected_results) diff --git a/unit_tests/input/other_scanfiles/deflate.alz b/unit_tests/input/other_scanfiles/deflate.alz new file mode 100644 index 0000000000..1114dab3d7 Binary files /dev/null and b/unit_tests/input/other_scanfiles/deflate.alz differ diff --git a/unit_tests/input/other_sigs/alz.hdb b/unit_tests/input/other_sigs/alz.hdb new file mode 100644 index 0000000000..659c80665d --- /dev/null +++ b/unit_tests/input/other_sigs/alz.hdb @@ -0,0 +1,5 @@ +9645df16bc733a92129563ad2e5f1f6a9ed483c9:16:test.txt +12f41f69d25d0ba9b73da429e0d69b27c95522db:16:test.txt +03d4c70e6aa3832fa51959137b6a3fc55d8b9f55:16:test.txt +26c0e077ad49260d416dbf449569efbc7ce02448:16:test.txt +67b33eebc1e4537d839bc6b04affd6b06074c746:13:test.txt