> Henrik K <h...@hege.li> kirjoitti 21.10.2018 kello 10.15:
>
>
> I wonder who's going to be the first to offer public bitcoin DNS blacklist,
> I could make plugin for it. :-)
>
> In the meantime, here's something to try..
>
> ./btcabuse.pl >btcabuse.cf.tmp && mv -f btcabuse.cf.tmp btcabuse.cf
>
> ====================================
> #!/usr/bin/perl -w
>
> use strict;
> use JSON;
> use LWP::UserAgent;
>
> my $url = 'http://www.bitcoinabuse.com/api/reports/distinct';
> my $ua = LWP::UserAgent->new(
> keep_alive => 1, agent => 'Wget/1.17.1 (linux-gnu)');
> my $json;
> my %ids;
>
> sub parse_rule {
> my $id = $_[0]->{address};
> return if $id !~ /^\w{26,35}$/;
> return if defined $ids{$id};
> $ids{$id} = 1;
> my $len = 8;
> my $idshort = uc(substr($id, 0, $len));
> while (defined $ids{$idshort}) {
> $idshort = uc(substr($id, 0, ++$len));
> }
> $ids{$idshort} = 1;
> my $i = $id =~ /^bc1/i ? 'i' : '';
> print "body BTC_$idshort /$id/$i\n";
> print "describe BTC_$idshort https://www.bitcoinabuse.com/reports/$id\n";
> print "score BTC_$idshort 5\n";
> print "priority BTC_$idshort 2\n";
> }
>
> for (my $i = 20; $i; $i--) {
> my $r = $ua->get($url);
> die $r->status_line unless $r->is_success;
> eval { $json = decode_json($r->decoded_content); }
> or die "JSON parse failed: $@\n";
> die unless $json->{data};
> parse_rule($_) foreach (@{$json->{data}});
> last unless $json->{next_page_url};
> $url = $json->{next_page_url};
> sleep(1);
> }
> ====================================
>
Thanks, testing!
br. jarif