def test_normal_scan(self):
        files = scan.find_targets(self.target_path)
        malware, whitelisted = scan.scan_files(files, self.rules,
                                               self.whitelist)

        self.assertEqual(len(malware), 2)
        self.assertEqual(len(whitelisted), 1)
Exemplo n.º 2
0
    def test_filter_extensions(self):

        ext = ['php']

        files = scan.find_targets(self.target_path, req_ext=ext)
        malware, whitelisted = scan.scan_files(files, self.rules, self.whitelist)

        self.assertEqual(len(malware), 1)
        self.assertEqual(len(whitelisted), 0)
    def test_filter_extensions(self):

        ext = ['php']

        files = scan.find_targets(self.target_path, required_extensions=ext)
        malware, whitelisted = scan.scan_files(files, self.rules, self.whitelist)

        self.assertEqual(len(malware), 1)
        self.assertEqual(len(whitelisted), 0)
Exemplo n.º 4
0
    def test_external_rule_file(self):
        files = scan.find_targets(self.target_path)

        rules_path = os.path.join(self.fixture_path, 'rules-vanilla.yar')
        self.rules, self.whitelist = self._load_file_rules(rules_path)

        malware, whitelisted = scan.scan_files(files, self.rules, self.whitelist)

        self.assertEqual(len(malware), 2)
        self.assertEqual(len(whitelisted), 0)
    def test_external_rule_file(self):
        files = scan.find_targets(self.target_path)

        rules_path = os.path.join(self.fixture_path, 'rules-vanilla.yar')
        self.rules, self.whitelist = self._load_file_rules(rules_path)

        malware, whitelisted = scan.scan_files(files, self.rules, self.whitelist)

        self.assertEqual(len(malware), 2)
        self.assertEqual(len(whitelisted), 0)
    def test_scan_callback(self):

        targets = scan.find_targets(self.target_path)
        testcb = mock.MagicMock()
        scan.scan_files(targets, self.rules, self.whitelist, testcb)
        self.assertEqual(testcb.call_count, 2)
    def test_scan_callback(self):

        targets = scan.find_targets(self.target_path)
        testcb = mock.MagicMock()
        scan.scan_files(targets, self.rules, self.whitelist, testcb)
        self.assertEqual(testcb.call_count, 2)
    def test_normal_scan(self):
        files = scan.find_targets(self.target_path)
        malware, whitelisted = scan.scan_files(files, self.rules, self.whitelist)

        self.assertEqual(len(malware), 2)
        self.assertEqual(len(whitelisted), 1)