mirror of
https://github.com/MaintainTeam/Hypatia.git
synced 2025-03-01 05:48:23 +03:00
36 lines
1.1 KiB
Bash
36 lines
1.1 KiB
Bash
|
#!/bin/bash
|
||
|
#License: GPLv3
|
||
|
#Description: Hypatia conversion script for https://github.com/botherder/targetedthreats (CC BY-SA 4.0)
|
||
|
|
||
|
while IFS=, read -r col1MD5 col2SHA256 col3Family col4Actor col5Country col6Report
|
||
|
do
|
||
|
col4Actor=$(sed -e 's/^"//' -e 's/"$//' <<< "$col4Actor");
|
||
|
col3Family=$(sed -e 's/^"//' -e 's/"$//' <<< "$col3Family");
|
||
|
if [ -n "$col4Actor" ] && [ -n "$col3Family" ]; then
|
||
|
description="$col4Actor-$col3Family";
|
||
|
elif [ -n "$col4Actor" ] && [ -z "$col3Family" ]; then
|
||
|
description="$col4Actor";
|
||
|
elif [ -z "$col4Actor" ] && [ -n "$col3Family" ]; then
|
||
|
description="$col3Family";
|
||
|
fi;
|
||
|
if [ -z "$description" ]; then
|
||
|
description="targetedthreats";
|
||
|
fi;
|
||
|
|
||
|
col1MD5=$(sed -e 's/^"//' -e 's/"$//' <<< "$col1MD5");
|
||
|
if [ -n "$col1MD5" ]; then
|
||
|
echo "$col1MD5:0:$description" >> ./targetedthreats.hdb;
|
||
|
fi;
|
||
|
|
||
|
col2SHA256=$(sed -e 's/^"//' -e 's/"$//' <<< "$col2SHA256");
|
||
|
if [ -n "$col2SHA256" ]; then
|
||
|
echo "$col2SHA256:0:$description" >> ./targetedthreats.hsb;
|
||
|
fi;
|
||
|
done < samples.csv;
|
||
|
|
||
|
sed -i '1d' targetedthreats.hdb;
|
||
|
sed -i '1d' targetedthreats.hsb;
|
||
|
|
||
|
gzip targetedthreats.hdb;
|
||
|
gzip targetedthreats.hsb;
|