From 4d5b1abaca81b8c1fc5171532f519c6533bff2dd Mon Sep 17 00:00:00 2001 From: aloftus23 Date: Wed, 11 Oct 2023 08:58:09 -0400 Subject: [PATCH] add shodan test script --- backend/src/tasks/scanExecution.ts | 10 ++++++++-- backend/worker/shodan.sh | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 backend/worker/shodan.sh diff --git a/backend/src/tasks/scanExecution.ts b/backend/src/tasks/scanExecution.ts index 1eec806bc..f6c1eb881 100644 --- a/backend/src/tasks/scanExecution.ts +++ b/backend/src/tasks/scanExecution.ts @@ -8,10 +8,16 @@ export const handler: Handler = async (event) => { try { // Get the SQS record and message body const sqsRecord: SQSRecord = event.Records[0]; - const commandOptions: string = sqsRecord.body; + const body: string = sqsRecord.body; - console.log(commandOptions); + console.log(body); + let commandOptions; + if (body === 'SHODAN') { + commandOptions = './worker/shodan.sh'; + } else { + commandOptions = body; + } // Run command in queue message in Fargate const params: AWS.ECS.RunTaskRequest = { cluster: process.env.FARGATE_CLUSTER_NAME!, diff --git a/backend/worker/shodan.sh b/backend/worker/shodan.sh new file mode 100644 index 000000000..d73535fa8 --- /dev/null +++ b/backend/worker/shodan.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +cd /app/pe-reports + +echo "Starting Shodan" + +pe-source shodan --orgs=DHS --soc_med_included + +echo "Done" \ No newline at end of file