예제 #1
0
class NessusParserTest(unittest.TestCase):
    cd = os.path.dirname(os.path.realpath(__file__))

    def setUp(self):
        self.plugin = NessusPlugin()
        factory.register(Host)
        factory.register(Interface)
        factory.register(Service)
        factory.register(Vuln)
        factory.register(VulnWeb)
        factory.register(Note)
        factory.register(Credential)

    def test_Plugin_Calls_createAndAddHost(self):
        self.plugin.processReport(self.cd + '/nessus_xml')
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.ADDHOST)
        self.assertEqual(action[1].name, "12.233.108.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.ADDINTERFACE)
        self.assertEqual(action[2].name, "12.233.108.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.ADDVULNHOST)
        self.assertEqual(action[2].name, "Nessus Scan Information")
        test_common.skip(self, 4)
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.ADDSERVICEINT)
        self.assertEqual(action[3].ports, [443])
        self.assertEqual(action[3].name, 'https?')
        self.assertEqual(action[3].protocol, 'tcp')
예제 #2
0
class NessusParserTest(unittest.TestCase):
    cd = os.path.dirname(os.path.realpath(__file__))

    def setUp(self):
        self.plugin = NessusPlugin()
        factory.register(Host)
        factory.register(Interface)
        factory.register(Service)
        factory.register(ModelObjectVuln)
        factory.register(ModelObjectVulnWeb)
        factory.register(ModelObjectNote)
        factory.register(ModelObjectCred)

    def test_Plugin_Calls_createAndAddHost(self):
        self.plugin.processReport(self.cd + '/nessus_xml')
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDHOST)
        self.assertEqual(action[1], "12.233.108.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDINTERFACE)
        self.assertEqual(action[2], "12.233.108.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDVULNHOST)
        self.assertEqual(action[2], "Nessus Scan Information")
        test_common.skip(self, 4)
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDSERVICEINT)
        self.assertEqual(action[5], ['443'])
        self.assertEqual(action[3], 'https?')
        self.assertEqual(action[4], 'tcp')
예제 #3
0
    def test_Plugin_Calls_createAndAddHost(self, monkeypatch):
        self.plugin = NessusPlugin()
        factory.register(Host)
        factory.register(Service)
        factory.register(Vuln)
        factory.register(VulnWeb)
        factory.register(Note)
        factory.register(Credential)

        pending_actions = Queue()
        self.plugin.set_actions_queue(pending_actions)
        monkeypatch.setattr(ModelBase, 'getID', lambda _: 1)
        self.plugin.processReport(self.cd + '/nessus_xml')
        actions = defaultdict(list)
        while not pending_actions.empty():
            action = self.plugin._pending_actions.get(block=True)
            actions[action[0]].append(action[1])

        assert actions[2000][0].name == "12.233.108.201"
        assert actions.keys() == [2000, 2017, 2038, 20008]
        assert len(actions[20008]) == 1
        assert len(actions[2038]) == 1

        assert actions[2038][0].name == "Nessus SYN scanner"

        assert actions[20008][0].ports == [443]
        assert actions[20008][0].name == 'https?'
        assert actions[20008][0].protocol == 'tcp'
예제 #4
0
class TestNessusParser:
    cd = os.path.dirname(os.path.realpath(__file__))

    def test_Plugin_Calls_createAndAddHost(self, monkeypatch):
        self.plugin = NessusPlugin()
        factory.register(Host)
        factory.register(Service)
        factory.register(Vuln)
        factory.register(VulnWeb)
        factory.register(Note)
        factory.register(Credential)

        pending_actions = Queue()
        self.plugin.set_actions_queue(pending_actions)
        monkeypatch.setattr(ModelBase, 'getID', lambda _: 1)
        self.plugin.processReport(self.cd + '/nessus_xml')
        actions = defaultdict(list)
        while not pending_actions.empty():
            action = self.plugin._pending_actions.get(block=True)
            actions[action[0]].append(action[1])

        assert actions[2000][0].name == "12.233.108.201"
        assert actions.keys() == [2000, 2017, 2038, 20008]
        assert len(actions[20008]) == 1
        assert len(actions[2038]) == 1

        assert actions[2038][0].name == "Nessus SYN scanner"

        assert actions[20008][0].ports == [443]
        assert actions[20008][0].name == 'https?'
        assert actions[20008][0].protocol == 'tcp'
예제 #5
0
 def setUp(self):
     self.plugin = NessusPlugin()
     factory.register(Host)
     factory.register(Interface)
     factory.register(Service)
     factory.register(ModelObjectVuln)
     factory.register(ModelObjectVulnWeb)
     factory.register(ModelObjectNote)
     factory.register(ModelObjectCred)
예제 #6
0
파일: nessus.py 프로젝트: hanshaze/cbf
 def setUp(self):
     self.plugin = NessusPlugin()
     factory.register(Host)
     factory.register(Interface)
     factory.register(Service)
     factory.register(Vuln)
     factory.register(VulnWeb)
     factory.register(Note)
     factory.register(Credential)
예제 #7
0
 def setUp(self):
     self.plugin = NessusPlugin()
     factory.register(Host)
     factory.register(Interface)
     factory.register(Service)
     factory.register(Vuln)
     factory.register(VulnWeb)
     factory.register(Note)
     factory.register(Credential)