Пример #1
0
    def execute_api_call(self):
        name = json.get_name(self.request_body)
        make_unique = json.get_make_unique(self.request_body) 
        asset_hosts_filter = json.get_asset_hosts_filter(self.request_body) 
        hosts = json.get_hosts(self.request_body)
        comment = json.get_comment(self.request_body)
        exclude_hosts = json.get_exclude_hosts(self.request_body)
        ssh_credential_id = json.get_ssh_credential_id(self.request_body)
        ssh_credential_port = json.get_ssh_credential_port(self.request_body) 
        alive_test = json.get_alive_test(self.request_body) 
        reverse_lookup_only = json.get_reverse_lookup_only(self.request_body)
        reverse_lookup_unify = json.get_reverse_lookup_unify(self.request_body)
        port_range = json.get_port_range(self.request_body)
        port_list_id = json.get_port_list_id(self.request_body)

        response = openvas.create_target(
            name,
            make_unique=make_unique,
            asset_hosts_filter=asset_hosts_filter,
            hosts=hosts,
            comment=comment,
            exclude_hosts=exclude_hosts,
            ssh_credential_id=ssh_credential_id,
            ssh_credential_port=ssh_credential_port,
            alive_test=alive_test,
            reverse_lookup_only=reverse_lookup_only,
            reverse_lookup_unify=reverse_lookup_unify,
            port_range=port_range,
            port_list_id=port_list_id
        )

        xml_root = etree.fromstring(response)

        return self.make_json_response(xml_root)
Пример #2
0
    def execute_api_call(self):
        name = json.get_name(self.request_body)

        scp_credential_key = RequestMethodDataType.SCP_CREDENTIAL.value
        scp_path_key = RequestMethodDataType.SCP_PATH.value
        scp_report_format_key = RequestMethodDataType.SCP_REPORT_FORMAT.value
        scp_known_hosts_key = RequestMethodDataType.SCP_KNOWN_HOSTS.value
        scp_host_key = RequestMethodDataType.SCP_HOST.value

        method_data = {
            scp_credential_key : json.get_string_data(self.request_body, scp_credential_key),
            scp_host_key : json.get_string_data(self.request_body, scp_host_key),
            scp_report_format_key : json.get_string_data(self.request_body, scp_report_format_key),
            scp_path_key : json.get_string_data(self.request_body, scp_path_key),
            scp_known_hosts_key : json.get_string_data(self.request_body, scp_known_hosts_key)
        }

        event_data = {
            RequestEventDataType.STATUS.value : json.get_status(self.request_body)
        }

        response = openvas.create_scp_alert(name, method_data=method_data, event_data=event_data)
        xml_root = etree.fromstring(response)

        return self.make_json_response(xml_root)
Пример #3
0
    def execute_api_call(self):
        name = json.get_name(self.request_body)
        login = json.get_login(self.request_body)
        password = json.get_password(self.request_body)
        comment = json.get_comment(self.request_body)
        allow_insecure = json.get_allow_insecure(self.request_body)

        response = openvas.create_username_password_credential(name, login, password, comment=comment, allow_insecure=allow_insecure)
        xml_root = etree.fromstring(response)

        return self.make_json_response(xml_root)
Пример #4
0
    def execute_api_call(self):
        name = json.get_name(self.request_body)
        config_id = json.get_config_id(self.request_body)
        target_id = json.get_target_id(self.request_body)
        scanner_id = json.get_scanner_id(self.request_body)
        alert_ids = json.get_alert_ids(self.request_body)
        comment = json.get_comment(self.request_body)

        response = openvas.create_task(name, config_id, target_id, scanner_id, alert_ids=alert_ids, comment=comment)
        xml_root = etree.fromstring(response)

        return self.make_json_response(xml_root)
Пример #5
0
    def execute_api_call(self):
        name = json.get_name(self.request_body)
        method_data = {
            RequestMethodDataType.SEND_HOST.value : json.get_send_host(self.request_body),
            RequestMethodDataType.SEND_PORT.value : json.get_send_port(self.request_body),
            RequestMethodDataType.SEND_REPORT_FORMAT.value : json.get_send_report_format(self.request_body)
        }
        event_data = {
            RequestEventDataType.STATUS.value : json.get_status(self.request_body)
        }

        response = openvas.create_xml_report_to_host_alert(name, method_data=method_data, event_data=event_data)
        xml_root = etree.fromstring(response)

        return self.make_json_response(xml_root)