Example #1
0
    def run(self, fingerengine, fingerprint):
        """
        """

        utility.Msg("Obtaining deployed services...")
        base = 'http://{0}:{1}'.format(fingerengine.options.ip,
                                       fingerprint.port)

        uri = '/axis2/axis2-admin/listService'

        cookie = checkAuth(fingerengine.options.ip, fingerprint.port,
                           fingerprint.title, fingerprint.version)
        if not cookie:
            utility.Msg("Could not get auth for %s:%s" %
                            (fingerengine.options.ip, fingerprint.port),LOG.ERROR)
            return

        response = utility.requests_get(base + uri, cookies=cookie)
        if response.status_code is 200:

           data = findall("\?wsdl\">(.*?)<", response.content)
           if len(data) > 0:
               for v in data:
                   utility.Msg("\tService found: %s" % v)
           else:
               utility.Msg("No services found.")
Example #2
0
def deploy(fingerengine, fingerprint):
    """ Upload a service via the administrative interface
    """

    cookie = None
    file_path = abspath(fingerengine.options.deploy)
    file_name = parse_war_path(file_path, True)
    dip = fingerengine.options.ip

    cookie = checkAuth(dip, fingerprint.port, title, fingerprint.version)
    if not cookie:
        utility.Msg("Could not get auth to %s:%s" % (dip, fingerprint.port), LOG.ERROR)
        return

    utility.Msg("Preparing to deploy {0}".format(file_name))

    base = "http://{0}:{1}".format(dip, fingerprint.port)
    uri = "/axis2/axis2-admin/upload"

    payload = {"filename": open(file_path, "rb")}

    response = utility.requests_post(base + uri, files=payload, cookies=cookie)
    if response.status_code is 200:
        if "The following error occurred" in response.content:
            error = findall("occurred <br/> (.*?)</font>", response.content)
            utility.Msg("Failed to deploy {0}.  Reason: {1}".format(file_name, error[0]), LOG.ERROR)
        else:
            utility.Msg(
                "{0} deployed successfully to /axis2/services/{1}".format(file_name, parse_war_path(file_path)),
                LOG.SUCCESS,
            )
    else:
        utility.Msg("Failed to deploy {0} (HTTP {1})".format(file_name, response.status_code), LOG.ERROR)
Example #3
0
def deploy(fingerengine, fingerprint):
    """ Upload a service via the administrative interface
    """

    cookie = None
    file_path = abspath(fingerengine.options.deploy)
    file_name = parse_war_path(file_path, True)
    dip = fingerengine.options.ip

    cookie = checkAuth(dip, fingerprint.port, title, fingerprint.version)
    if not cookie:
        utility.Msg("Could not get auth to %s:%s" % (dip, fingerprint.port),
                                                    LOG.ERROR)
        return

    utility.Msg("Preparing to deploy {0}".format(file_name))

    base = 'http://{0}:{1}'.format(dip, fingerprint.port)
    uri = '/axis2/axis2-admin/upload'

    payload = {'filename' : open(file_path, 'rb')}

    response = utility.requests_post(base + uri, files=payload, cookies=cookie)
    if response.status_code is 200:
        utility.Msg("{0} deployed successfully to /axis2/services/{1}".
                                format(file_name, parse_war_path(file_path)),
                                LOG.SUCCESS)
    else:
        utility.Msg("Failed to deploy {0} (HTTP {1})".format(file_name, 
                                        response.status_code), LOG.ERROR)
Example #4
0
def undeploy(fingerengine, fingerprint):
    """ Remove a deployed service from the remote Axis2 server
    """

    if fingerprint.version not in ['1.6']:
        utility.Msg(
            "Version %s does not support undeploying via the web interface" %
            fingerprint.version, LOG.ERROR)
        return

    context = parse_war_path(fingerengine.options.undeploy)
    base = 'http://{0}:{1}'.format(fingerengine.options.ip, fingerprint.port)
    uri = '/axis2/axis2-admin/deleteService?serviceName={0}'.format(context)

    utility.Msg("Preparing to undeploy {0}...".format(context))

    response = utility.requests_get(base + uri)
    if "name=\"password\"" in response.content:
        utility.Msg(
            "Host %s:%s requires auth, checking..." %
            (fingerengine.options.ip, fingerprint.port), LOG.DEBUG)
        cookie = checkAuth(fingerengine.options.ip, fingerprint.port,
                           fingerprint.title, fingerprint.version)

        if cookie:
            response = utility.requests_get(base + uri, cookies=cookie)
        else:
            utility.Msg(
                "Could not get auth for %s:%s" %
                (fingerengine.options.ip, fingerprint.port), LOG.ERROR)
            return

    if "Service doesn't exist" in response.content:
        utility.Msg("Service '%s' not found on server." % context, LOG.ERROR)
    elif 'successfully removed' in response.content:
        utility.Msg("Successfully undeployed '%s'" % context, LOG.SUCCESS)
    else:
        utility.Msg(
            "Failed to undeploy '%s' (HTTP %d)" %
            (context, response.status_code), LOG.ERROR)
Example #5
0
def undeploy(fingerengine, fingerprint):
    """ Remove a deployed service from the remote Axis2 server
    """

    if fingerprint.version not in ['1.6']:
        utility.Msg("Version %s does not support undeploying via the web interface"
                        % fingerprint.version, LOG.ERROR)
        return

    context = parse_war_path(fingerengine.options.undeploy)
    base = 'http://{0}:{1}'.format(fingerengine.options.ip, fingerprint.port)
    uri = '/axis2/axis2-admin/deleteService?serviceName={0}'.format(context)

    utility.Msg("Preparing to undeploy {0}...".format(context))

    response = utility.requests_get(base + uri)
    if "name=\"password\"" in response.content:
        utility.Msg("Host %s:%s requires auth, checking..." %
                        (fingerengine.options.ip, fingerprint.port), LOG.DEBUG)
        cookie = checkAuth(fingerengine.options.ip, fingerprint.port,
                           fingerprint.title, fingerprint.version)

        if cookie:
            response = utility.requests_get(base + uri, cookies=cookie)
        else:
            utility.Msg("Could not get auth for %s:%s" % 
                            (fingerengine.options.ip, fingerprint.port), LOG.ERROR)
            return

    if "Service doesn't exist" in response.content:
        utility.Msg("Service '%s' not found on server." % context, LOG.ERROR)
    elif 'successfully removed' in response.content: 
        utility.Msg("Successfully undeployed '%s'" % context, LOG.SUCCESS)
    else:
        utility.Msg("Failed to undeploy '%s' (HTTP %d)" % (context, response.status_code),
                                                        LOG.ERROR)