{ "kind": "open-flow-workflow", "version": 1, "name": "Analyze a URL with Cortex", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_93c73ef266302a9b": { "name": "Enter analysis details", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "instanceUrl" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "analyzerId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" } ] }, "n_d0caed6c30b47e0a": { "inputs": { "instanceUrl": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93c73ef266302a9b", "output": "instanceUrl" } ] }, "analyzerId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93c73ef266302a9b", "output": "analyzerId" } ] }, "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93c73ef266302a9b", "output": "url" } ] } }, "name": "Prepare analysis", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "instanceUrl" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "analyzerId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "base" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "name": "Prepare analysis", "moduleId": "n_33ae84ef422827ef", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_42187811df4d0857": { "inputs": { "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d0caed6c30b47e0a", "output": "url" } ] }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d0caed6c30b47e0a", "output": "body" } ] }, "auth.token": { "kind": "unset" } }, "name": "Run URL analyzer", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.token" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Run URL analyzer", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "authentication": { "type": "bearer" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_acc0e2fd1e02aaf9": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_42187811df4d0857", "output": "body" } ] }, "base": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d0caed6c30b47e0a", "output": "base" } ] } }, "name": "Prepare job lookup", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "base" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "jobId" } ], "name": "Prepare job lookup", "moduleId": "n_313f62e8733bc970", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_9746b6347b275b77": { "inputs": { "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_acc0e2fd1e02aaf9", "output": "url" } ] }, "auth.token": { "kind": "unset" } }, "name": "Read job details", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.token" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Read job details", "executor": { "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "authentication": { "type": "bearer" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_dc49e95ace972def": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9746b6347b275b77", "output": "body" } ] }, "jobId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_acc0e2fd1e02aaf9", "output": "jobId" } ] } }, "name": "Verify job", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "jobId" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "job" } ], "name": "Verify job", "moduleId": "n_953226ea347a608f", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_522e36f7b0d4cef7": { "name": "Cortex job", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "job" } ], "outputMappings": { "job": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_dc49e95ace972def", "output": "job" } ] } } } }, "edges": [ { "source": "n_93c73ef266302a9b", "target": "n_d0caed6c30b47e0a" }, { "source": "n_d0caed6c30b47e0a", "target": "n_42187811df4d0857" }, { "source": "n_42187811df4d0857", "target": "n_acc0e2fd1e02aaf9" }, { "source": "n_acc0e2fd1e02aaf9", "target": "n_9746b6347b275b77" }, { "source": "n_9746b6347b275b77", "target": "n_dc49e95ace972def" }, { "source": "n_dc49e95ace972def", "target": "n_522e36f7b0d4cef7" } ] } }, "modules": { "n_33ae84ef422827ef": { "name": "Prepare analysis", "imports": [], "source": "export default function setup({instanceUrl,analyzerId,url}){let host,target;try{host=new URL(instanceUrl);target=new URL(url)}catch{throw Error('Enter valid Cortex and observable URLs')}if(host.protocol!=='https:'||host.username||host.password||host.search||host.hash||!['http:','https:'].includes(target.protocol)||target.username||target.password)throw Error('Use an HTTPS Cortex instance and an HTTP(S) observable');if(typeof analyzerId!=='string'||! /^[a-zA-Z0-9_-]+$/.test(analyzerId))throw Error('Enter a valid analyzer ID');const base=host.toString().replace(/\\/+$/,'');return{base,url:base+'/api/analyzer/'+encodeURIComponent(analyzerId)+'/run?force=false',body:{dataType:'url',tlp:2,data:target.toString()}};}\n" }, "n_313f62e8733bc970": { "name": "Prepare job lookup", "imports": [], "source": "export default function job({body,base}){const id=body?.id;if(typeof id!=='string'||! /^[a-zA-Z0-9_-]+$/.test(id))throw Error('Cortex did not return a valid job ID');return{url:base+'/api/job/'+encodeURIComponent(id),jobId:id};}\n" }, "n_953226ea347a608f": { "name": "Verify job", "imports": [], "source": "export default function result({body,jobId}){if(!body||typeof body!=='object'||Array.isArray(body)||body.id!==jobId)throw Error('Cortex did not return the submitted job');return{job:body};}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }