From e5e2a05237c57f183677e5d65b6a9ed0f6c91b2f Mon Sep 17 00:00:00 2001 From: terceranexus6 Date: Thu, 18 May 2023 16:49:10 +0200 Subject: [PATCH] adding a vt report script --- VT/get_report.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/VT/get_report.sh b/VT/get_report.sh index 7ad5958..5e9eafc 100644 --- a/VT/get_report.sh +++ b/VT/get_report.sh @@ -1,13 +1,15 @@ #!/bin/bash file_hash="$1" -file_name="$2.json" +file_name="$2" + +json_v="$file_name.json" touch $file_name curl --request GET \ --url https://www.virustotal.com/api/v3/files/$file_hash \ - --header 'x-apikey: ' >> $file_name + --header 'x-apikey: ' >> $json_v oname="readable_$file_name" touch $oname @@ -19,7 +21,7 @@ curl --request GET \ # Getting it parsing the raw json with jq and cleaning # the result so it's only the label name -raw_label=$(jq .data.attributes.popular_threat_classification.suggested_threat_label $file_name) +raw_label=$(jq .data.attributes.popular_threat_classification.suggested_threat_label $json_v) clean_label=${raw_label//\"} clean_label=${clean_label//.} @@ -34,7 +36,7 @@ echo -e "\n" >> $oname # Getting it parsing the raw json with jq and cleaning # the result so it's only the label name -raw_tags=$(jq .data.attributes.type_tags $file_name) +raw_tags=$(jq .data.attributes.type_tags $json_v) cl1_tags=$(echo $raw_tags | tr \[ \( | tr \] \)) declare -a arr=$cl1_tags @@ -49,7 +51,7 @@ echo -e "\n" >> $oname # Meaningful name -raw_name=$(jq .data.attributes.meaningful_name $file_name) +raw_name=$(jq .data.attributes.meaningful_name $json_v) clean_name=${raw_name//\"} clean_label=${clean_name//.} @@ -60,7 +62,7 @@ echo -e "\n" >> $oname # Imports -raw_imports=$(jq .data.attributes.pe_info.import_list[].library_name $file_name) +raw_imports=$(jq .data.attributes.pe_info.import_list[].library_name $json_v) cl1_imports=$(echo $raw_imports | tr \[ \( | tr \] \)) declare -a arr2=$cl1_imports -- 2.45.2