Verified Commit 9a279f05 authored by Luc Didry's avatar Luc Didry

Improve safebrowsingcheck CLI

parent cf5f4e88
Pipeline #73390 passed with stages
in 6 minutes and 40 seconds
Revision history for Perl application Lstu
0.20-0 2018-??-??
- Improve safebrowsingcheck CLI (displays creators' IP addresses + other URLs from thoses IPs)
0.19-3 2018-09-08
- Update translations
......
......@@ -58,7 +58,7 @@ sub run {
my $progress = Term::ProgressBar::Quiet->new(
{ name => 'Scanning '.$urls->size.' URLs', count => $urls->size, ETA => 'linear' }
);
my @bad;
my (@bad, %bad_ips, @bad_from_ips);
my $gsb = $c->app->gsb;
$urls->each(sub {
my ($e, $num) = @_;
......@@ -69,14 +69,24 @@ sub run {
if (@matches) {
push @bad, $e->{short};
$bad_ips{$e->{created_by}} = 1 if $e->{created_by};
}
});
say sprintf('All URLs (%d) have been scanned.', $urls->size);
say sprintf('%d bad URLs detected.', scalar(@bad));
say scalar($c->app->gsb->lookup(url => 'http://malware.testing.google.test/testing/malware/'));
say sprintf("If you want to delete the detected bad URLs, please do:\n carton exec script/lstu url --remove %s", join(' ', @bad)) if @bad;
for my $ip (keys %bad_ips) {
my $u = Lstu::DB::URL->new(app => $c->app)->search_creator($ip);
$u->each(sub {
my ($e, $num) = @_;
push @bad_from_ips, $e->{short};
});
}
say sprintf("Bad URLs creators' IP addresses: \n %s", join(", ", keys %bad_ips)) if (keys %bad_ips);
say sprintf("If you want to delete the URLs created by the same IPs than the detected bad URLs, please do:\n carton exec script/lstu url --remove %s", join(' ', @bad_from_ips)) if @bad_from_ips;
} else {
say 'It seems that safebrowsing_api_key isn\'t set. Please, check your configuration';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment