diff --git a/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/get_campaign.yml b/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/get_campaign.yml new file mode 100644 index 0000000000..badbc61289 --- /dev/null +++ b/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/get_campaign.yml @@ -0,0 +1,29 @@ +type: action +definition: + title: Get campaign + description: Get a campaign from Gophish. + display_group: Gophish + doc_url: https://docs.getgophish.com/api-documentation/campaigns#get-campaigns + namespace: tools.gophish + name: get_campaign + secrets: + - name: gophish + keys: ["GOPHISH_API_KEY"] + expects: + base_url: + type: str + description: The base URL of the Gophish instance. + required: true + campaign_id: + type: int + description: The ID of the campaign to get. + required: true + steps: + - ref: get_campaign + action: core.http_request + args: + url: ${{ inputs.base_url }}/api/campaigns/${{ inputs.campaign_id }} + method: GET + headers: + Authorization: Bearer ${{ SECRETS.gophish.GOPHISH_API_KEY }} + returns: ${{ steps.get_campaign.result.data }} diff --git a/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/get_campaign_results.yml b/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/get_campaign_results.yml new file mode 100644 index 0000000000..f8f066035b --- /dev/null +++ b/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/get_campaign_results.yml @@ -0,0 +1,29 @@ +type: action +definition: + title: Get campaign results + description: Get a campaign's results from Gophish. + display_group: Gophish + doc_url: https://docs.getgophish.com/api-documentation/campaigns#get-campaigns + namespace: tools.gophish + name: get_campaign_results + secrets: + - name: gophish + keys: ["GOPHISH_API_KEY"] + expects: + base_url: + type: str + description: The base URL of the Gophish instance. + required: true + campaign_id: + type: int + description: The ID of the campaign to get results for. + required: true + steps: + - ref: get_campaign_results + action: core.http_request + args: + url: ${{ inputs.base_url }}/api/campaigns/${{ inputs.campaign_id }}/results + method: GET + headers: + Authorization: Bearer ${{ SECRETS.gophish.GOPHISH_API_KEY }} + returns: ${{ steps.get_campaign_results.result.data }} diff --git a/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/list_campaigns.yml b/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/list_campaigns.yml new file mode 100644 index 0000000000..d5b8f78493 --- /dev/null +++ b/packages/tracecat-registry/tracecat_registry/templates/tools/gophish/list_campaigns.yml @@ -0,0 +1,38 @@ +type: action +definition: + title: List campaigns + description: List campaigns from Gophish. + display_group: Gophish + doc_url: https://docs.getgophish.com/api-documentation/campaigns#get-campaigns + namespace: tools.gophish + name: list_campaigns + secrets: + - name: gophish + keys: ["GOPHISH_API_KEY"] + expects: + base_url: + type: str + description: The base URL of the Gophish instance. + required: true + steps: + - ref: list_campaigns + action: core.http_request + args: + url: ${{ inputs.base_url }}/api/campaigns/ + method: GET + headers: + Authorization: Bearer ${{ SECRETS.gophish.GOPHISH_API_KEY }} + + # This is needed because the API will return results and timelines for all campaigns. This can exeed the max size of workflow data steps very easily. For example a campaign with 1,000 recipients will return 11,000 lines of just results, in addition to the at least 1000 timeline items which are each another 8 lines of data. Very quickly this can exeed the max size of workflow data steps. + - ref: parse_campaigns_list + action: core.script.run_python + args: + inputs: + data: ${{ steps.list_campaigns.result.data }} + script: | + def main(data): + return [ + {"id": campaign["id"], "name": campaign["name"]} + for campaign in data + ] + returns: ${{ steps.parse_campaigns_list.result }}