{ "name": "Tenable IO Assets V2", "vendor_identifier": "Tenable IO", "comment": "Tenable assets management", "version": "4.0", "type": "REST_EVENT", "event_type": [ "LEASE", "NETWORK_IPV4", "NETWORK_IPV6", "RANGE_IPV4", "RANGE_IPV6", "FIXED_ADDRESS_IPV4", "FIXED_ADDRESS_IPV6", "HOST_ADDRESS_IPV4", "HOST_ADDRESS_IPV6", "DISCOVERY_DATA" ], "content_type": "application/json", "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}" }, "instance_variables": [ { "name": "Add_Discovery_Data", "type": "STRING", "value": "true" }, { "name": "Scan_Discovery_Data", "type": "STRING", "value": "true" }, { "name": "Discovery_Scan_Template", "type": "STRING", "value": "" }, { "name": "Discovery_Target_Group", "type": "STRING", "value": "" } ], "steps": [ { "name": "Check_for_Delete_or_Modify_operation", "comment": "Check for delete operation", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${E:A:operation_type}", "op": "==", "right": "DELETE" }, { "left": "${E:A:operation_type}", "op": "==", "right": "MODIFY" }, { "left": "${E:A:binding_state}", "op": "==", "right": "FREE" }, { "left": "${E:A:binding_state}", "op": "==", "right": "Abandoned" }, { "left": "${E:A:binding_state}", "op": "==", "right": "Expired" }, { "left": "${E:A:binding_state}", "op": "==", "right": "Released" } ], "stop": true } }, { "name": "Check_for_event_type_network", "comment": "Checking if the event was a network event", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "NETWORK" }, { "left": "${E:A:values{extattrs}{TNBL_IO_Sync}{value}}", "op": "==", "right": "true" }, { "left": "${E:A:values{extattrs}{TNBL_IO_Sync_Time}{value}}", "op": "==", "right": "" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:Temp_Value}:{E:values{network}}${XC:ASSIGN:{L:HostObjectType}:{S:Network}}${XC:ASSIGN:{L:HostObjectType}:{S:Network}}${XC:COPY:{L:Temp_Value}:{E:values{network}}", "next": "Get_Target_Group_targets" } }, { "name": "Check_for_event_type_range", "comment": "Checking if the event was a range event", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "RANGE" }, { "left": "${E:A:values{extattrs}{TNBL_IO_Sync}{value}}", "op": "==", "right": "true" }, { "left": "${E:A:values{extattrs}{TNBL_IO_Sync_Time}{value}}", "op": "==", "right": "" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:Temp_Value1}:{E:values{start_addr}}${XC:COPY:{L:Temp_Value2}:{E:values{end_addr}}${XC:COPY:{L:Temp_Value2}:{E:values{end_addr}}${XC:ASSIGN:{L:HostObjectType}:{S:Range}}${XC:ASSIGN:{L:HostObjectType}:{S:Range}}${XC:COPY:{L:Temp_Value1}:{E:values{start_addr}}", "next": "Get_Target_Group_targets" } }, { "name": "Check_for_event_type_host_with_host_Value", "comment": "Assign host values with hostname value", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "HOST" }, { "left": "${E:A:values{extattrs}{TNBL_IO_Add_By_Hostname}{value}}", "op": "==", "right": "true" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:Temp_Value}:{E:values{host}}${XC:ASSIGN:{L:HostObjectType}:{S:Host}}${XC:ASSIGN:{L:HostObjectType}:{S:Host}}${XC:COPY:{L:Temp_Value}:{E:values{host}}", "next": "Check_for_IPv4_or_IPv6_host_or_fixed" } }, { "name": "Check_for_event_type_host_with_IP4_Value", "comment": "Assign host values with IP value", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "HOST" }, { "left": "${E:A:values{ipv4addr}}", "op": "!=", "right": "" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:Temp_Value}:{E:values{ipv4addr}}${XC:ASSIGN:{L:HostObjectType}:{S:Host}}${XC:ASSIGN:{L:HostObjectType}:{S:Host}}${XC:COPY:{L:IPReq}:{E:values{ipv4addr}}${XC:COPY:{L:Temp_Value}:{E:values{ipv4addr}}", "next": "Check_for_IPv4_or_IPv6_host_or_fixed" } }, { "name": "Check_for_event_type_host_with_IPv6_Value", "comment": "Assign host values with IP value", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "HOST" }, { "left": "${E:A:values{ipv6addr}}", "op": "!=", "right": "" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:Temp_Value}:{E:values{ipv6addr}}${XC:ASSIGN:{L:HostObjectType}:{S:Host}}${XC:ASSIGN:{L:HostObjectType}:{S:Host}}${XC:COPY:{L:IPReq}:{E:values{ipv6addr}}${XC:COPY:{L:Temp_Value}:{E:values{ipv6addr}}${XC:COPY:{L:Temp_Value}:{E:values{ipv6addr}}", "next": "Check_for_IPv4_or_IPv6_host_or_fixed" } }, { "name": "Check_for_event_type_fixed_address_IPv4", "comment": "Check for fixed address IPv4", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "FIXED" }, { "left": "${E:A:values{ipv4addr}}", "op": "!=", "right": "" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:Temp_Value}:{E:values{ipv4addr}}${XC:ASSIGN:{L:HostObjectType}:{S:Fixed}}${XC:COPY:{L:IPReq}:{E:values{ipv4addr}}${XC:COPY:{L:Temp_Value}:{E:values{host}}", "next": "Check_for_IPv4_or_IPv6_host_or_fixed" } }, { "name": "Check_for_event_type_fixed_address_IPv6", "comment": "Check for fixed address IPv6", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "FIXED" }, { "left": "${E:A:values{ipv6addr}}", "op": "!=", "right": "" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:values{extattrs}{TNBL_IO_Scan_Template}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:values{extattrs}{TNBL_IO_Target_Group}{value}}${XC:COPY:{L:Temp_Value}:{E:values{ipv6addr}}${XC:ASSIGN:{L:HostObjectType}:{S:Fixed}}${XC:COPY:{L:IPReq}:{E:values{ipv6addr}}${XC:COPY:{L:Temp_Value}:{E:values{ipv6addr}}", "next": "Check_for_IPv4_or_IPv6_host_or_fixed" } }, { "name": "Check_for_event_type_Lease", "comment": "Check for Lease Event", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "LEASE" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:ip.extattrs{TNBL_IO_Scan_Template}}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{E:ip.extattrs{TNBL_IO_Scan_Template}}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:ip.extattrs{TNBL_IO_Target_Group}}}${XC:COPY:{L:TNBL_IO_Target_Group}:{E:ip.extattrs{TNBL_IO_Target_Group}}}${XC:COPY:{L:Temp_Value}:{E:address}}${XC:ASSIGN:{L:HostObjectType}:{S:Lease}}${XC:ASSIGN:{L:HostObjectType}:{S:Lease}}${XC:COPY:{L:IPReq}:{E:address}${XC:COPY:{L:Temp_Value}:{E:address}}", "next": "Get_Target_Group_targets" } }, { "name": "Check_for_event_type_Discovery", "comment": "Check for Discovery Event", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "DISCOVERY_DATA" }, { "left": "${I:A:Add_Discovery_Data}", "op": "==", "right": "true" }, { "left": "${I:A:Discovery_Scan_Template}", "op": "!=", "right": "" } ], "eval": "${XC:COPY:{L:TNBL_IO_Scan_Template}:{I:Discovery_Scan_Template}}${XC:COPY:{L:TNBL_IO_Scan_Template}:{I:Discovery_Scan_Template}}${XC:COPY:{L:TNBL_IO_Target_Group}:{I:Discovery_Target_Group}}${XC:COPY:{L:TNBL_IO_Target_Group}:{I:Discovery_Target_Group}}${XC:COPY:{L:Temp_Value}:{E:values{ip_address}}${XC:ASSIGN:{L:HostObjectType}:{S:Discovery}}${XC:ASSIGN:{L:HostObjectType}:{S:Discovery}}${XC:COPY:{L:IPReq}:{E:values{ip_address}}${XC:COPY:{L:Temp_Value}:{E:values{ip_address}}", "next": "Get_Target_Group_targets" } }, { "name": "Check_for_insert_operation", "comment": "Check for insert operation", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:operation_type}", "op": "==", "right": "INSERT" } ] } }, { "name": "Check_for_IPv4_or_IPv6_host_or_fixed", "comment": "Check for IPv4 or IPv6 host or fixed", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${E:A:values{ipv4addr}}", "op": "!=", "right": "" } ], "eval": "${XC:COPY:{L:IPReq}:{E:values{ipv4addr}}${XC:ASSIGN:{L:HostIPtype}:{S:ipv4addrs}}${XC:ASSIGN:{L:HostIPtype}:{S:ipv4addr}}", "else_eval": "${XC:COPY:{L:IPReq}:{E:values{ipv6addr}}${XC:ASSIGN:{L:HostIPtype}:{S:ipv6addrs}}${XC:ASSIGN:{L:HostIPtype}:{S:ipv6addr}}", "next": "Get_Target_Group_targets", "else_next": "Get_Target_Group_targets" } }, { "name": "Get_Target_Group_targets", "comment": "Get the Target Group targets", "operation": "GET", "parse": "JSON", "override_headers": true, "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}", "Content-Type": "application/json" }, "transport": { "path": "target-groups" } }, { "name": "Copy_over_target_groups", "comment": "Copy over target groups so that it can be searched through", "operation": "NOP", "body": "${XC:COPY:{L:target_groups}:{P:target_groups}" }, { "name": "Check_if_Target_Group_list_is_empty", "comment": "Checking if target Group list is empty and if so then stop template", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${L:L:target_groups}", "op": "==", "right": "0" } ], "stop": true } }, { "name": "Pop_asset_from_the_list_for_Assets", "comment": "Pop asset from the list", "operation": "VARIABLEOP", "variable_ops": [ { "operation": "POP", "type": "DICTIONARY", "destination": "L:One_Target_Group", "source": "L:target_groups" } ] }, { "name": "Check_If_Correct_Target_Group", "comment": "check an asset AssetIP", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${L:A:TNBL_IO_Target_Group}", "op": "==", "right": "${L:A:One_Target_Group{name}}" } ], "eval": "${XC:COPY:{L:Target_ID}:{L:One_Target_Group{id}}", "next": "Check_if_Range_To_See_if_Asset_allready_exists" } }, { "name": "Skip_back_to_check_if_Target_Group_list_is_empty", "comment": "Skip back to check if Target_Group list is empty", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "0", "op": "==", "right": "0" } ], "next": "Check_if_Target_Group_list_is_empty" } }, { "name": "Check_if_Range_To_See_if_Asset_allready_exists", "comment": "Check if Range to skip the next step", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "RANGE" } ], "next": "Check_if_Asset_allready_exists_for_range" } }, { "name": "Check_if_Asset_allready_exists", "comment": "Check if Asset allready exists", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${L:A:One_Target_Group{members}}", "op": "=~", "right": "${L:A:Temp_Value}" } ], "next": "Skip_Update_if_Lease", "else_next": "Update_Target_List" } }, { "name": "Check_if_Asset_allready_exists_for_range", "comment": "Check if Asset allready exists", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${L:A:One_Target_Group{members}}", "op": "=~", "right": "${L:A:Temp_Value1}-${L:A:Temp_Value2}" } ], "next": "Skip_Update_if_Lease", "else_next": "Update_Target_List_for_Range" } }, { "name": "Update_Target_List_for_Range", "comment": "Update_Target_List_for_Range", "operation": "PUT", "parse": "JSON", "override_headers": true, "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}", "Content-Type": "application/json" }, "transport": { "path": "target-groups/${L:A:Target_ID}" }, "body_list": [ "{", "\"members\": \"${L:A:One_Target_Group{members}} ,${L:A:Temp_Value1}-${L:A:Temp_Value2}\"}" ], "result": [ { "codes": "200,201,202,203,204", "next": "Skip_Update_if_Lease" } ] }, { "name": "Update_Target_List", "comment": "Update_Target_List", "operation": "PUT", "parse": "JSON", "override_headers": true, "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}", "Content-Type": "application/json" }, "transport": { "path": "target-groups/${L:A:Target_ID}" }, "body_list": [ "{", "\"members\": \"${L:A:One_Target_Group{members}} ,${L:A:Temp_Value}\"}" ] }, { "name": "Skip_Update_if_Lease", "comment": "can't update lease because there is no EA to attach it to", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Lease" } ], "next": "Check_if_need_to_scan_Lease" } }, { "name": "Skip_Update_if_Discovery", "comment": "can't update lease because there is no EA to attach it to", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Discovery" } ], "next": "Check_if_need_to_scan_Discovery" } }, { "name": "Check_if_fixed_address_or_network_or_range", "comment": "Check event type becuase only Host and Lease events don't have the _Ref for EA's", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Fixed" }, { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Range" }, { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Network" } ], "next": "Copy_reference_from_E_namespace" } }, { "name": "Get_Host_record_ref", "comment": "Getting Host Ref to update EA's in the next few steps", "operation": "GET", "transport": { "path": "record:host?${L:A:HostIPtype}=${L:U:IPReq}&network_view=${E:U:values{network_view}}&_return_fields=extattrs" }, "wapi": "v2.7", "result": [ { "codes": "200,201,202,203,204", "next": "Get_object_reference" } ] }, { "name": "Get_object_reference", "comment": "Setting Ref to Obj_ref to use later to update timestamp", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${P:A:PARSE[0]{_ref}}", "op": "!=", "right": "" } ], "eval": "${XC:COPY:{L:Obj_ref}:{P:PARSE[0]{_ref}}}", "next": "Update_extattrs_timestamp" } }, { "name": "Copy_reference_from_E_namespace", "comment": "Get object reference for network/range/fixed address from E namespace and set it to Obj_ref to use later to update timestamp", "operation": "NOP", "body_list": [ "${XC:COPY:{L:Obj_ref}:{E:values{_ref}}}" ] }, { "name": "Update_extattrs_timestamp", "comment": "updating the EA of the asset that was added", "operation": "PUT", "transport": { "path": "${L:A:Obj_ref}" }, "wapi": "v2.7", "wapi_quoting": "JSON", "body_list": [ "{\"extattrs+\":{\"TNBL_IO_Sync_Time\": { \"value\": \"${E:A:timestamp}\"}}}" ] }, { "name": "Check_if_need_to_scan", "comment": "Check_if_need_to_scan", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:values{extattrs}{TNBL_IO_Scan_On_Add}{value}}", "op": "==", "right": "true" }, { "left": "${E:A:values{extattrs}{TNBL_IO_Scan_Template}{value}}", "op": "!=", "right": "" } ], "next": "Get_Scan_List", "else_next": "FinExit" } }, { "name": "Check_if_need_to_scan_Lease", "comment": "Check_if_need_to_scan_Lease", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:ip.extattrs{TNBL_IO_Scan_On_Add}}", "op": "==", "right": "true" }, { "left": "${E:A:ip.extattrs{TNBL_IO_Scan_Template}}", "op": "!=", "right": "" } ], "next": "Get_Scan_List", "else_next": "FinExit" } }, { "name": "Check_if_need_to_scan_Discovery", "comment": "Check_if_need_to_scan_Discovery", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${I:A:Scan_Discovery_Data}", "op": "==", "right": "true" }, { "left": "${I:A:Discovery_Scan_Template}", "op": "!=", "right": "" } ], "next": "Get_Scan_List", "else_next": "FinExit" } }, { "name": "Get_Scan_List", "comment": "Grab all the scans available", "operation": "GET", "parse": "JSON", "override_headers": true, "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}", "Content-Type": "application/json" }, "transport": { "path": "scans" } }, { "name": "copy_over_scans_to_L_variable", "comment": "copy over scans to L namespace so that it can be used", "operation": "NOP", "body": "${XC:COPY:{L:Scans}:{P:scans}" }, { "name": "Check_if_Scan_list_is_empty", "comment": "Check to see if scans is empty after poping from the stack", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${L:L:Scans}", "op": "==", "right": "0" } ], "stop": true } }, { "name": "Pop_asset_from_the_list_for_Security", "comment": "pop top of scan list to use variable", "operation": "VARIABLEOP", "variable_ops": [ { "operation": "POP", "type": "DICTIONARY", "destination": "L:One_Scans", "source": "L:Scans" } ] }, { "name": "Check_If_Correct_Scan", "comment": "check if the scan that was poped off the list is the correct scan to run", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${L:A:TNBL_IO_Scan_Template}", "op": "!=", "right": "${L:A:One_Scans{name}}" } ], "next": "Check_if_Scan_list_is_empty", "else_eval": "${XC:COPY:{L:Scan_ID}:{L:One_Scans{id}}", "else_next": "Copy_Scan" } }, { "name": "Copy_Scan", "comment": "Copy_Scan", "operation": "POST", "parse": "JSON", "override_headers": true, "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}", "Content-Type": "application/json" }, "transport": { "path": "scans/${L:A:Scan_ID}/copy" } }, { "name": "Skip_If_Range", "comment": "Skip_If_Range", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:event_type}", "op": "=~", "right": "RANGE" } ], "next": "Configure_Copied_Scan_For_Range" } }, { "name": "Configure_Copied_Scan", "comment": "Configure_Copied_Scan", "operation": "PUT", "parse": "JSON", "override_headers": true, "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}", "Content-Type": "application/json" }, "transport": { "path": "scans/${P:A:id}/" }, "body_list": [ "{", "\"scan_id\":\"${P:A:id}\",", "\"settings\":{", "\"name\":\"Infoblox Scan for ${L:A:Temp_Value} on ${UT:A:TIME}\",", "\"description\": \"Scan occured because of a ${E:A:event_type} event\",", "\"enabled\":\"false\",", "\"text_targets\":\"${L:A:Temp_Value}\"", "}", "}" ], "result": [ { "codes": "200,201,202,203,204", "next": "Start_Copied_Scan" } ] }, { "name": "Configure_Copied_Scan_For_Range", "comment": "Configure_Copied_Scan_For_Range", "operation": "PUT", "parse": "JSON", "override_headers": true, "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}", "Content-Type": "application/json" }, "transport": { "path": "scans/${P:A:id}/" }, "body_list": [ "{", "\"scan_id\":\"${P:A:id}\",", "\"settings\":{", "\"name\":\"Infoblox Scan for ${L:A:Temp_Value1}-${L:A:Temp_Value2} on ${UT:A:TIME}\",", "\"description\": \"Scan occured because of a ${E:A:event_type} event\",", "\"enabled\":\"false\",", "\"text_targets\":\"${L:A:Temp_Value1}-${L:A:Temp_Value2}\"", "}", "}" ] }, { "name": "Start_Copied_Scan", "comment": "Start_Scan", "operation": "POST", "parse": "JSON", "override_headers": true, "headers": { "X-apikeys": "accessKey=${S:A:accessKey};secretKey=${S:A:secretKey}", "Content-Type": "application/json" }, "transport": { "path": "scans/${P:A:id}/launch" } }, { "name": "Skip_Scan_EA_Update_if_Lease_Or_Discovery", "comment": "can't update lease because there is no EA to attach it to", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Lease" }, { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Discovery" } ], "next": "FinExit" } }, { "name": "Check_if_fixed_address_or_network_or_range_for_Scan_EA_Update", "comment": "Check event type becuase only Host and Lease events don't have the _Ref for EA's", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Fixed" }, { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Range" }, { "left": "${L:A:HostObjectType}", "op": "=~", "right": "Network" } ], "next": "Copy_reference_from_E_namespace_for_Scan_EA_Update" } }, { "name": "Get_Host_record_ref_for_Scan_EA_Update", "comment": "Getting Host Ref to update EA's in the next few steps", "operation": "GET", "transport": { "path": "record:host?${L:A:HostIPtype}=${L:U:IPReq}&network_view=${E:U:values{network_view}}&_return_fields=extattrs" }, "wapi": "v2.7", "result": [ { "codes": "200,201,202,203,204", "next": "Get_object_reference_for_Scan_EA_Update" } ] }, { "name": "Get_object_reference_for_Scan_EA_Update", "comment": "Setting Ref to Obj_ref to use later to update timestamp", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${P:A:PARSE[0]{_ref}}", "op": "!=", "right": "" } ], "eval": "${XC:COPY:{L:Obj_ref}:{P:PARSE[0]{_ref}}}", "next": "Update_extattrs_timestamp_for_Scan_EA_Update" } }, { "name": "Copy_reference_from_E_namespace_for_Scan_EA_Update", "comment": "Get object reference for network/range/fixed address from E namespace and set it to Obj_ref to use later to update timestamp", "operation": "NOP", "body_list": [ "${XC:COPY:{L:Obj_ref}:{E:values{_ref}}}" ] }, { "name": "Update_extattrs_timestamp_for_Scan_EA_Update", "comment": "updating the EA of the asset that was added", "operation": "PUT", "transport": { "path": "${L:A:Obj_ref}" }, "wapi": "v2.7", "wapi_quoting": "JSON", "body_list": [ "{\"extattrs+\":{\"TNBL_IO_Last_Scan\": { \"value\": \"${E:A:timestamp}\"}}}" ] }, { "name": "FinExit", "comment": "Stop execution of the template.", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "1", "op": "==", "right": "1" } ], "stop": true } } ] }