コード例 #1
0
    def __init__(self,
                 fortify_url,
                 project_template=None,
                 application_name=None,
                 fortify_username=None,
                 fortify_password=None,
                 scan_name=None,
                 extension=None,
                 token=None):
        self.ssc_server = fortify_url
        self.project_template = project_template
        self.application_name = application_name
        self.user = fortify_username
        self.password = fortify_password
        self.fortify_version = scan_name
        self.extension = extension
        self.runenv = WebBreakerHelper.check_run_env()
        self.token = token
        if not token:
            self.token = self.get_token()

        if not self.token:
            Logger.console.error(
                "Unable to obtain a Fortify API token. Invalid Credentials")
            raise ValueError("Unable to obtain a Fortify API token.")
コード例 #2
0
    def __init__(self, webinspect_setting, endpoint=None):

        # Select an appropriate endpoint if none was provided.
        if not endpoint:
            config = WebInspectConfig()
            lb = WebInspectJitScheduler(
                endpoints=config.endpoints,
                size_list=config.sizing,
                size_needed=webinspect_setting['webinspect_scan_size'])
            endpoint = lb.get_endpoint()
            if not endpoint:
                raise EnvironmentError(
                    "Scheduler found no available endpoints.")

        self.url = endpoint
        self.settings = webinspect_setting['webinspect_settings']
        self.scan_name = webinspect_setting['webinspect_scan_name']
        self.webinspect_upload_settings = webinspect_setting[
            'webinspect_upload_settings']
        self.webinspect_upload_policy = webinspect_setting[
            'webinspect_upload_policy']
        self.webinspect_upload_webmacros = webinspect_setting[
            'webinspect_upload_webmacros']
        self.scan_mode = webinspect_setting['webinspect_overrides_scan_mode']
        self.scan_scope = webinspect_setting['webinspect_overrides_scan_scope']
        self.login_macro = webinspect_setting[
            'webinspect_overrides_login_macro']
        self.scan_policy = webinspect_setting[
            'webinspect_overrides_scan_policy']
        self.scan_start = webinspect_setting['webinspect_overrides_scan_start']
        self.start_urls = webinspect_setting['webinspect_overrides_start_urls']
        self.workflow_macros = webinspect_setting['webinspect_workflow_macros']
        self.allowed_hosts = webinspect_setting['webinspect_allowed_hosts']
        self.scan_size = webinspect_setting['webinspect_scan_size']
        self.runenv = WebBreakerHelper.check_run_env()

        Logger.console.debug("url: {}".format(self.url))
        Logger.console.debug("settings: {}".format(self.settings))
        Logger.console.debug("scan_name: {}".format(self.scan_name))
        Logger.console.debug("upload_settings: {}".format(
            self.webinspect_upload_settings))
        Logger.console.debug("upload_policy: {}".format(
            self.webinspect_upload_policy))
        Logger.console.debug("upload_webmacros: {}".format(
            self.webinspect_upload_webmacros))
        Logger.console.debug("workflow_macros: {}".format(
            self.workflow_macros))
        Logger.console.debug("allowed_hosts: {}".format(self.allowed_hosts))
        Logger.console.debug("scan_mode: {}".format(self.scan_mode))
        Logger.console.debug("scan_scope: {}".format(self.scan_scope))
        Logger.console.debug("login_macro: {}".format(self.login_macro))
        Logger.console.debug("scan_policy: {}".format(self.scan_policy))
        Logger.console.debug("scan_start: {}".format(self.scan_start))
        Logger.console.debug("start_urls: {}".format(self.start_urls))
コード例 #3
0
    def __init__(self, webinspect_setting):
        Logger.app.debug("Starting webinespect client initialization")

        config = WebInspectConfig()
        lb = WebInspectJitScheduler(
            endpoints=config.endpoints,
            size_list=config.sizing,
            size_needed=webinspect_setting['webinspect_scan_size'])
        Logger.app.info("Querying WebInspect scan engines for availability.")
        endpoint = lb.get_endpoint()
        if not endpoint:
            raise EnvironmentError("Scheduler found no available endpoints.")
        self.url = endpoint
        self.settings = webinspect_setting['webinspect_settings']
        self.scan_name = webinspect_setting['webinspect_scan_name']
        self.webinspect_upload_settings = webinspect_setting[
            'webinspect_upload_settings']
        self.webinspect_upload_policy = webinspect_setting[
            'webinspect_upload_policy']
        self.webinspect_upload_webmacros = webinspect_setting[
            'webinspect_upload_webmacros']
        self.scan_mode = webinspect_setting['webinspect_overrides_scan_mode']
        self.scan_scope = webinspect_setting['webinspect_overrides_scan_scope']
        self.login_macro = webinspect_setting[
            'webinspect_overrides_login_macro']
        self.scan_policy = webinspect_setting[
            'webinspect_overrides_scan_policy']
        self.scan_start = webinspect_setting['webinspect_overrides_scan_start']
        self.start_urls = webinspect_setting['webinspect_overrides_start_urls']
        self.workflow_macros = webinspect_setting['webinspect_workflow_macros']
        self.allowed_hosts = webinspect_setting['webinspect_allowed_hosts']
        self.scan_size = webinspect_setting['webinspect_scan_size']
        self.runenv = WebBreakerHelper.check_run_env()

        Logger.app.debug("Completed webinspect client initialization")
        Logger.app.debug("url: {}".format(self.url))
        Logger.app.debug("settings: {}".format(self.settings))
        Logger.app.debug("scan_name: {}".format(self.scan_name))
        Logger.app.debug("upload_settings: {}".format(
            self.webinspect_upload_settings))
        Logger.app.debug("upload_policy: {}".format(
            self.webinspect_upload_policy))
        Logger.app.debug("upload_webmacros: {}".format(
            self.webinspect_upload_webmacros))
        Logger.app.debug("workflow_macros: {}".format(self.workflow_macros))
        Logger.app.debug("allowed_hosts: {}".format(self.allowed_hosts))
        Logger.app.debug("scan_mode: {}".format(self.scan_mode))
        Logger.app.debug("scan_scope: {}".format(self.scan_scope))
        Logger.app.debug("login_macro: {}".format(self.login_macro))
        Logger.app.debug("scan_policy: {}".format(self.scan_policy))
        Logger.app.debug("scan_start: {}".format(self.scan_start))
        Logger.app.debug("start_urls: {}".format(self.start_urls))
コード例 #4
0
try:
    import ConfigParser as configparser
except ImportError:  #Python3
    import configparser
import argparse
import os, sys
import random
import string
import re
import xml.etree.ElementTree as ET
from subprocess import CalledProcessError, check_output
from webbreaker.webbreakerlogger import Logger
from webbreaker.webbreakerhelper import WebBreakerHelper

runenv = WebBreakerHelper.check_run_env()

# TODO: Test on Python2
try:  # Python 2
    config = configparser.SafeConfigParser()
except NameError:  # Python 3
    config = configparser.ConfigParser()


class WebInspectEndpoint(object):
    def __init__(self, uri, size):
        self.uri = uri
        self.size = size


class WebInspectSize(object):