Пример #1
0
    def test_taxii_connectivity_https(self):
        """
        Objective: Test if we can send a message to mitre's test TAXII server using https.
        """
        self.config.set('taxii', 'use_https', 'True')
        test_event = AttackEvent()
        test_event.source_addr = ('1.2.3.4', 43811)
        http_request_content = """GET /test HTTP/1.0\r\nUser-Agent: test\r\n\r\n"""
        test_event.http_request = HTTPHandler(http_request_content, None, server_version="", sys_version="")

        taxiiLogger = TaxiiLogger(self.tmpdir, self.config)
        taxii_result = taxiiLogger.insert(test_event)
        # TaxiiLogger returns false if the message could not be delivered
        self.assertTrue(taxii_result)
Пример #2
0
    def test_taxii_connectivity_https(self):
        """
        Objective: Test if we can send a message to mitre's test TAXII server using https.
        """
        self.config.set('taxii', 'use_https', 'True')
        test_event = AttackEvent()
        test_event.source_addr = ('1.2.3.4', 43811)
        http_request_content = """GET /test HTTP/1.0\r\nUser-Agent: test\r\n\r\n"""
        test_event.http_request = HTTPHandler(http_request_content,
                                              None,
                                              server_version="",
                                              sys_version="")

        taxiiLogger = TaxiiLogger(self.tmpdir, self.config)
        taxii_result = taxiiLogger.insert(test_event)
        # TaxiiLogger returns false if the message could not be delivered
        self.assertTrue(taxii_result)
Пример #3
0
    def test_taxii_connectivity_https(self):
        """
        Objective: Test if we can send a message to mitre's test TAXII server using https.
        """
        self.config.set('taxii', 'use_https', 'True')
        config_file = tempfile.mkstemp()[1]
        with open(config_file, 'w') as f:
            self.config.write(f)
        test_event = AttackEvent()
        test_event.source_addr = ('1.2.3.4', 43811)
        http_request_content = """GET /test HTTP/1.0\r\nUser-Agent: test\r\n\r\n"""
        test_event.http_request = HTTPHandler(http_request_content, None, server_version="", sys_version="")

        taxiiLogger = TaxiiLogger(self.tmpdir, os.getcwd(), config_file)
        taxii_result = taxiiLogger.insert(test_event)
        # TaxiiLogger returns false if the message could not be delivered
        self.assertTrue(taxii_result)
        f.close() #clean the tempfile
Пример #4
0
    def test_taxii_connectivity_https(self):
        """
        Objective: Test if we can send a message to mitre's test TAXII server using https.
        """
        self.config.set('taxii', 'use_https', 'True')
        config_file = tempfile.mkstemp()[1]
        with open(config_file, 'w') as f:
            self.config.write(f)
        test_event = AttackEvent()
        test_event.source_addr = ('1.2.3.4', 43811)
        http_request_content = """GET /test HTTP/1.0\r\nUser-Agent: test\r\n\r\n"""
        test_event.http_request = HTTPHandler(http_request_content,
                                              None,
                                              server_version="",
                                              sys_version="")

        taxiiLogger = TaxiiLogger(self.tmpdir, os.getcwd(), config_file)
        taxii_result = taxiiLogger.insert(test_event)
        # TaxiiLogger returns false if the message could not be delivered
        self.assertTrue(taxii_result)
        f.close()  #clean the tempfile