Export resultat in JSON format

master
heuzef 6 yıl önce
ebeveyn ab4534639d
işleme 07bb168ade
  1. 19
      defacement_check.pl

@ -2,6 +2,7 @@
use strict; use strict;
use XML::Simple; use XML::Simple;
use Data::Dumper; use Data::Dumper;
use JSON qw(to_json);
# Date # Date
use POSIX qw(strftime); use POSIX qw(strftime);
@ -126,13 +127,23 @@ foreach $file (@files)
} }
close(FH); close(FH);
# print "\033[36mTREATH detected on this site \t\t\t\t=> [" . $somme_total_found . "]\n\n"; # Total # print "\033[36mTREATH detected on this site \t\t\t\t=> [" . $somme_total_found . "]\n\n"; # Total
print $somme_total_found; # Total # print $somme_total_found; # Total
$grand_total_found = $somme_total_found + $grand_total_found; $grand_total_found = $somme_total_found + $grand_total_found;
} }
# print "\033[36mGrand Total TREATH detected on ALL website \t\t=> [" . $grand_total_found . "]\n\n"; # Grand Total # print "\033[36mGrand Total TREATH detected on ALL website \t\t=> [" . $grand_total_found . "]\n\n"; # Grand Total
# Print just the last binaire results in output file # Print just the last binaire results in output file
open(my $out, '>', 'out.txt'); # open(my $out, '>', 'out.txt');
print $out $grand_total_found; # print $out $grand_total_found;
close $out; # close $out;
# Print results in JSON
my $out = {
site => $site,
threats => $grand_total_found,
date => $date
};
print to_json($out, { pretty => 1 });

Yükleniyor…
İptal
Kaydet