Commit 80fcccc7 by Peter Weidenbach

plugins and tests added

parent 6c36ec68
{
"re_infected": "Infec[\\D]+([\\d])",
"re_malware_name": "\\x1b[^ ]+ ([^\\n\\x1b:]+)\\n",
"name": "AVG",
"command": "avgscan $filepath"
}
{
"re_infected": "infected files:[\\W]+(\\d)",
"re_malware_name": "infected by:([^\\n]+)\\]",
"name": "Avast",
"command": "avast $filepath"
}
{
"re_infected": "Infected files:[ ](\\d)",
"re_malware_name": "infected:[ ]([^\\n]+)",
"name": "Bitdefender",
"command": "bdscan $filepath"
}
{
"re_infected": "Infec[\\D]+([\\d])",
"re_malware_name": ": ([^\\n]+) FOUND",
"name": "ClamAV",
"command": "clamscan $filepath"
}
{
"re_infected": "Found Viruses:[ ](\\d)",
"re_malware_name": "Malware Name is ([^\\n]+)\\n",
"name": "Comodo Antivirus",
"command": "/opt/COMODO/cmdscan -vs $filepath"
}
{
"re_infected": "Infec[^\\n]+es - ([\\d])",
"re_malware_name": "threat=\"([^\"]+)\"",
"name": "ESET Command-line scanner",
"command": "esets_scan --clean-mode=none $filepath"
}
{
"re_infected": "Infected objects: ([\\w])",
"re_malware_name": "] <([^>]+)>",
"name": "F-PROT Antivirus",
"command": "fpscan $filepath"
}
{
"re_infected": "file infected",
"re_malware_name": "fected: ([^\\n]+) \\[",
"name": "F-Secure Anti-Virus CLI",
"command": "fsav --action1=report $filepath"
}
{
"re_infected": "Possibly Infected[^\\d]+([\\d])",
"re_malware_name": "Found the ([^\n]+) !!!",
"name": "McAfee VirusScan Command Line",
"command": "uvscan --summary $filepath"
}
{
"re_infected": "infiziert",
"re_malware_name": "'([^\\n]+)' gefunden in",
"name": "Sophos",
"command": "savscan $filepath"
}
{
"re_infected": "infected",
"re_malware_name": "'([^\\n]+)' found in",
"name": "Sophos",
"command": "savscan $filepath"
}
this is a benign file!
\ No newline at end of file
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
......@@ -4,18 +4,41 @@ Created on Mar 24, 2016
@author: weidenba
'''
import unittest
from os import path
from common_analysis_oms.oms import CommonAnalysisOMS
BASE_DIR = path.dirname(path.abspath(__file__))
BENIGN_FILE_PATH = path.join(BASE_DIR, "data/benign")
MALICIOUS_FILE_PATH = path.join(BASE_DIR, "data/eicar")
class Test(unittest.TestCase):
def setUp(self):
pass
self.oms = CommonAnalysisOMS()
def tearDown(self):
pass
def testName(self):
pass
def test_plugin_init(self):
self.assertGreater(len(self.oms.av_list), 0, "no scanners installed, please install at least clamav")
def test_get_av_scan_result(self):
self.assertEqual(self.oms.get_av_scan_result({"command": "echo $filepath"}, "test"), "test\n")
def test_find_malware_name(self):
self.assertEqual(self.oms.find_malware_name("test string", {"re_malware_name": "str([\w]+)"}), "ing")
def test_scan_benign(self):
result = self.oms.scan_file(BENIGN_FILE_PATH)
self.assertEqual(result["positives"], 0)
self.assertTrue(True not in [result["scans"][av]["detected"] for av in result["scans"]])
def test_scan_malicious(self):
result = self.oms.scan_file(MALICIOUS_FILE_PATH)
self.assertEqual(result["positives"], result['number_of_scanners'])
self.assertTrue(False not in [result["scans"][av]["detected"] for av in result["scans"]])
if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment