예제 #1
0
    def test_scan(self):
        # FIXME: This unittest will only work in Linux
        cf.cf.save('interface', 'lo')
        cf.cf.save('local_ip_address', '127.0.0.1')
        es = extrusionScanner(commands.getoutput)

        inbound_port = es.get_inbound_port()
        self.assertEquals(inbound_port, 8080)
예제 #2
0
    def test_basic(self):
        es = extrusionScanner(commands.getoutput)

        self.assertTrue(es.can_scan())

        self.assertTrue(es.estimate_scan_time() >= 8)

        self.assertTrue(es.is_available(54545, 'tcp'))
예제 #3
0
    def _get_inbound_port(self):
        # Do an extrusion scan and return the inbound open ports
        es = extrusionScanner(self._exec_method)
        try:
            inbound_port = es.get_inbound_port()
        except Exception, e:

            om.out.error('The extrusion scan failed.')
            om.out.error('Error: ' + str(e))

            for p in [8080, 5060, 3306, 1434, 1433, 443, 80, 25, 22]:
                if self._is_locally_available(p) and es.is_available(p, 'TCP'):
                    msg = 'Using inbound port "%s" without knowing if the remote'
                    msg += ' host will be able to connect back.'
                    om.out.console(msg % p)
                    return p

            raise e
예제 #4
0
    def _get_inbound_port(self):
        # Do an extrusion scan and return the inbound open ports
        es = extrusionScanner(self._exec_method)
        try:
            inbound_port = es.get_inbound_port()
        except Exception, e:

            om.out.error('The extrusion scan failed.')
            om.out.error('Error: ' + str(e))

            for p in [8080, 5060, 3306, 1434, 1433, 443, 80, 25, 22]:
                if self._is_locally_available(p) and es.is_available(p, 'TCP'):
                    msg = 'Using inbound port "%s" without knowing if the remote'
                    msg += ' host will be able to connect back.'
                    om.out.console(msg % p)
                    return p

            raise e
예제 #5
0
    def test_upload_file_root(self):
        exec_method = commands.getoutput
        os = 'linux'

        create_temp_dir()
        cf.cf.save('interface', 'lo')
        cf.cf.save('local_ip_address', '127.0.0.1')
        es = extrusionScanner(exec_method)

        inbound_port = es.get_inbound_port()
        echo_linux = ClientlessReverseHTTP(exec_method, os, inbound_port)

        self.assertTrue(echo_linux.can_transfer())

        file_len = 8195
        file_content = 'A' * file_len
        echo_linux.estimate_transfer_time(file_len)

        temp_file_inst = tempfile.NamedTemporaryFile()
        temp_fname = temp_file_inst.name
        upload_success = echo_linux.transfer(file_content, temp_fname)

        self.assertTrue(upload_success)
    def test_upload_file_root(self):
        exec_method = commands.getoutput
        os = "linux"

        create_temp_dir()
        cf.cf.save("interface", "lo")
        cf.cf.save("local_ip_address", "127.0.0.1")
        es = extrusionScanner(exec_method)

        inbound_port = es.get_inbound_port()
        echo_linux = ClientlessReverseHTTP(exec_method, os, inbound_port)

        self.assertTrue(echo_linux.can_transfer())

        file_len = 8195
        file_content = "A" * file_len
        echo_linux.estimate_transfer_time(file_len)

        temp_file_inst = tempfile.NamedTemporaryFile()
        temp_fname = temp_file_inst.name
        upload_success = echo_linux.transfer(file_content, temp_fname)

        self.assertTrue(upload_success)
예제 #7
0
 def __init__(self, exec_method):
     self._exec_method = exec_method
     self._es = extrusionScanner(exec_method)