示例#1
0
class TestBurp:

    cd = os.path.dirname(os.path.realpath(__file__))


    def test_Plugin_creates_adecuate_objects(self, monkeypatch):
        self.plugin = BurpPlugin()
        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 + '/burp_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 == "200.20.20.201"
        assert actions.keys() == [2000, 20008, 2038]
        assert len(actions[20008]) == 14
        assert len(actions[2038]) == 14

        assert all('http' == name for name in map(lambda service: service.name, actions[20008]))
        assert all([80] == ports for ports in map(lambda service: service.getPorts(), actions[20008]))
        assert all('tcp' == protocol for protocol in map(lambda service: service.protocol, actions[20008]))
        assert all('open' for status in map(lambda service: service.status, actions[20008]))
示例#2
0
class BurpTest(unittest.TestCase):

    cd = os.path.dirname(os.path.realpath(__file__))

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

    def test_Plugin_creates_adecuate_objects(self):
        self.plugin.processReport(self.cd + '/burp_xml')
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.ADDHOST)
        self.assertEqual(action[1].name, "200.20.20.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.ADDINTERFACE)
        self.assertEqual(action[2].name, "200.20.20.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.ADDSERVICEINT)
        self.assertEqual(action[3].name, 'http')
        self.assertEqual(action[3].protocol, 'tcp')
        self.assertEqual(action[3].ports, [80])
        self.assertEqual(action[3].status, 'open')
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.ADDNOTESRV)
示例#3
0
    def test_Plugin_creates_adecuate_objects(self, monkeypatch):
        self.plugin = BurpPlugin()
        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 + '/burp_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 == "200.20.20.201"
        assert actions.keys() == [2000, 20008, 2038]
        assert len(actions[20008]) == 14
        assert len(actions[2038]) == 14

        assert all(
            'http' == name
            for name in map(lambda service: service.name, actions[20008]))
        assert all([80] == ports for ports in map(
            lambda service: service.getPorts(), actions[20008]))
        assert all('tcp' == protocol for protocol in map(
            lambda service: service.protocol, actions[20008]))
        assert all(
            'open'
            for status in map(lambda service: service.status, actions[20008]))
示例#4
0
文件: burp.py 项目: Sliim/faraday
class BurpTest(unittest.TestCase):

    cd = os.path.dirname(os.path.realpath(__file__))

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

    def test_Plugin_creates_adecuate_objects(self):
        self.plugin.processReport(self.cd + "/burp_xml")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDHOST)
        self.assertEqual(action[1], "200.20.20.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDINTERFACE)
        self.assertEqual(action[2], "200.20.20.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDSERVICEINT)
        self.assertEqual(action[3], "http")
        self.assertEqual(action[4], "tcp")
        self.assertEqual(action[5], ["80"])
        self.assertEqual(action[6], "open")
        test_common.skip(self, 2)
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDVULNWEBSRV)
        self.assertEqual(action[3], "Cleartext submission of password")
示例#5
0
class BurpTest(unittest.TestCase):

    cd = os.path.dirname(os.path.realpath(__file__))

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

    def test_Plugin_creates_adecuate_objects(self):
        self.plugin.processReport(self.cd + '/burp_xml')
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDHOST)
        self.assertEqual(action[1], "200.20.20.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDINTERFACE)
        self.assertEqual(action[2], "200.20.20.201")
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDSERVICEINT)
        self.assertEqual(action[3], 'http')
        self.assertEqual(action[4], 'tcp')
        self.assertEqual(action[5], ['80'])
        self.assertEqual(action[6], 'open')
        test_common.skip(self, 2)
        action = self.plugin._pending_actions.get(block=True)
        self.assertEqual(action[0], modelactions.CADDVULNWEBSRV)
        self.assertEqual(action[3], 'Cleartext submission of password')
示例#6
0
 def setUp(self):
     self.plugin = BurpPlugin()
     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 = BurpPlugin()
     factory.register(Host)
     factory.register(Interface)
     factory.register(Service)
     factory.register(ModelObjectVuln)
     factory.register(ModelObjectVulnWeb)
     factory.register(ModelObjectNote)
     factory.register(ModelObjectCred)
示例#8
0
文件: burp.py 项目: Sliim/faraday
 def setUp(self):
     self.plugin = BurpPlugin()
     factory.register(Host)
     factory.register(Interface)
     factory.register(Service)
     factory.register(ModelObjectVuln)
     factory.register(ModelObjectVulnWeb)
     factory.register(ModelObjectNote)
     factory.register(ModelObjectCred)