{

my %db = $DB->get('clamav-unofficial-sigs')->props;

my @ss = ();
my @si = ();
my @mbl = ();

if ((${'clamav-unofficial-sigs'}{'status'} || 'disabled') eq 'enabled'){
  while (my ($param,$value) = each(%db)){
    if ($value eq 'ss'){
      push @ss, $param;
    }
    elsif ($value eq 'si'){
      push @si, $param;
    }
    elsif ($value eq 'mbl'){
      push @mbl, $param;
    }
  }
#  $OUT .= "ss_dbs=\"\n    "  . join("\n    ", @ss)  . "\n\"\n" if (scalar @ss > 0);
#  $OUT .= "si_dbs=\"\n    "  . join("\n    ", @si)  . "\n\"\n" if (scalar @si > 0);
#  $OUT .= "mbl_dbs=\"\n    " . join("\n    ", @mbl) . "\n\"\n" if (scalar @mbl > 0);
}
$OUT ="\n";
}
# securiteinfo
securiteinfo_premium={((${'clamav-unofficial-sigs'}{'securiteinfo_premium'}|| "no" ) eq '"yes"' )? "yes" : '"no"' }
securiteinfo_authorisation_signature={my $key=${'clamav-unofficial-sigs'}{'securiteinfo_authorisation_signature'}|| 'YOUR-SIGNATURE-NUMBER'; $OUT="\"$key\""; }

#malwareexpert
malwareexpert_serial_key={my $key=${'clamav-unofficial-sigs'}{'malwareexpert_serial_key'}||'YOUR-SERIAL-KEY'; $OUT="\"$key\""} 

#malwarepatrol
malwarepatrol_receipt_code={my $key=${'clamav-unofficial-sigs'}{'malwarepatrol_receipt_code'}||'YOUR-RECEIPT-NUMBER'; $OUT="\"$key\"";}
malwarepatrol_product_code="8"
malwarepatrol_list={((${'clamav-unofficial-sigs'}{'malwarepatrol_list'}||"clamav_basic") eq "clamav_basic") ? "\"clamav_basic\"" : "\"clamav_ext\"";} 


# ========================
# Enabled Databases
# ========================
# Set to no to disable an entire database, if the database is empty it will also be disabled.
additional_enabled={((${'clamav-unofficial-sigs'}{'additional_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}
interserver_enabled={((${'clamav-unofficial-sigs'}{'interserver_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}
linuxmalwaredetect_enabled={((${'clamav-unofficial-sigs'}{'linuxmalwaredetect_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}
# if serial_key YOUR-SERIAL-KEY will be forced to disabled in script
malwareexpert_enabled={((${'clamav-unofficial-sigs'}{'malwareexpert_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}
# if receipt_code YOUR-RECEIPT-NUMBER will be forced to disabled in script
malwarepatrol_enabled={((${'clamav-unofficial-sigs'}{'malwarepatrol_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}
sanesecurity_enabled={((${'clamav-unofficial-sigs'}{'sanesecurity_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}
# if authorisation_signature YOUR-SIGNATURE-NUMBER will be forced to disabled in script
securiteinfo_enabled=={((${'clamav-unofficial-sigs'}{'securiteinfo_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}
urlhaus_enabled={((${'clamav-unofficial-sigs'}{'urlhaus_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}
# Yara-Rule Project, automatically disabled if clamav is older than 0.100 and enable_yararules is disabled
yararulesproject_enabled={((${'clamav-unofficial-sigs'}{'yararulesproject_enabled'} || "yes") eq "yes") ? "\"yes\"" : "\"no\"";}

#Enables yararules in the various databases, automatically
enable_yararules={((${'clamav-unofficial-sigs'}{'enable_yararules'} || "no") eq "yes") ? "\"yes\"" : "\"no\"";}   


# valid rating: LOW, MEDIUM, HIGH, DISABLE
{
my $defaultDBR = (( ${'clamav-unofficial-sigs'}{'default_dbs_rating'} || "NOP") ~~ ['LOW', 'MEDIUM', 'HIGH', 'DISABLE']) ? ${'clamav-unofficial-sigs'}{'default_dbs_rating'} : 'MEDIUM' ;

$OUT .= "default_dbs_rating=\"$defaultDBR\"\n";

$OUT .= "# Per Database
# These ratings will override the global rating for the specific database
# valid ratings: LOW | MEDIUM | HIGH | DISABLE\n";

my $lmd = (( ${'clamav-unofficial-sigs'}{'linuxmalwaredetect_dbs_rating'} || "NOP") ~~ ['LOW', 'MEDIUM', 'HIGH', 'DISABLE']) ? ${'clamav-unofficial-sigs'}{'linuxmalwaredetect_dbs_rating'} : 'NOP' ;
$OUT .= "linuxmalwaredetect_dbs_rating=\"$lmd\"\n" unless $lmd eq 'NOP';
my $ss = (( ${'clamav-unofficial-sigs'}{'sanesecurity_dbs_rating'} || "NOP") ~~ ['LOW', 'MEDIUM', 'HIGH', 'DISABLE']) ? ${'clamav-unofficial-sigs'}{'sanesecurity_dbs_rating'} : 'NOP' ;
$OUT .= "sanesecurity_dbs_rating=\"$ss\"\n" unless $ss eq 'NOP';
my $si = (( ${'clamav-unofficial-sigs'}{'securiteinfo_dbs_rating'} || "NOP") ~~ ['LOW', 'MEDIUM', 'HIGH', 'DISABLE']) ? ${'clamav-unofficial-sigs'}{'securiteinfo_dbs_rating'} : 'NOP' ;
$OUT .= "securiteinfo_dbs_rating=\"$si\"\n" unless $si eq 'NOP';
my $uhd = (( ${'clamav-unofficial-sigs'}{'urlhaus_dbs_rating'} || "NOP") ~~ ['LOW', 'MEDIUM', 'HIGH', 'DISABLE']) ? ${'clamav-unofficial-sigs'}{'urlhaus_dbs_rating'} : 'NOP' ; 
$OUT .= "urlhaus_dbs_rating=\"$uhd\"\n" unless $uhd eq 'NOP';
my $yrp = (( ${'clamav-unofficial-sigs'}{'yararulesproject_dbs_rating'} || "NOP") ~~ ['LOW', 'MEDIUM', 'HIGH', 'DISABLE']) ? ${'clamav-unofficial-sigs'}{'yararulesproject_dbs_rating'} : 'NOP' ;
$OUT .= "yararulesproject_dbs_rating=\"$yrp\"\n" unless $yrp eq 'NOP';

}

# ========================
# Additional Databases
# ========================
{
return "# additional disabled\n"  unless ((${'clamav-unofficial-sigs'}{'additional_enabled'} || "yes") eq "yes");

my $additionnal = ${'clamav-unofficial-sigs'}{'additional'} or return "# additional list empty\n";

$OUT = "declare -a additional_dbs=(\n";
my @values =  split(/;,/, $additionnal);
for ( @values ) {
  $OUT .= "   $_ \n";
}

$OUT .= ") #END ADDITIONAL DATABASES
";

#TODO

}
