[Dxspider-support] badspotter badwords

Joaquin joaquin at cronux.net
Wed Sep 14 14:15:31 BST 2022


Hi all,

For those who want to do tests, and I'm sure it can be improved a lot.

* bad_spotter.pl beta testing procedure

1. Download TOR and Proxies IP list, first time:

curl -o /spider/local_data/tor-proxies.txt 
https://raw.githubusercontent.com/X4BNet/lists_torexit/main/ipv4.txt
curl -o /spider/local_data/proxies-exits.txt 
https://lists.fissionrelays.net/tor/relays-ipv4.txt
cat /spider/local_data/proxies-exits.txt > 
/spider/local_data/tor-proxies.txt
sed -i "s|$|/32|" /spider/local_data/tor-proxies.txt

2. Copy the bad_spotter.pl script to: /spider/local_cmd/bad_spotter.pl
3. Run chmod +x /spider/local_cmd/bad_spotter.pl
4. Add in /spider/local_cmd/crontab:

# Bad spotter
0 0 * * *  spawn('pkill -f "/usr/bin/perl -w 
/spider/local_cmd/bad_spotter.pl"')
1 0 * * *  spawn("/usr/bin/perl -w /spider/local_cmd/bad_spotter.pl")
30 * * * * spawn('curl -o /spider/local_data/tor-proxies.txt 
https://raw.githubusercontent.com/X4BNet/lists_torexit/main/ipv4.txt')
31 * * * * spawn('curl -o /spider/local_data/proxies-exits.txt 
https://lists.fissionrelays.net/tor/relays-ipv4.txt')
32 * * * * spawn('cat /spider/local_data/proxies-exits.txt > 
/spider/local_data/tor-proxies.txt')
33 * * * * spawn('sed -i "s|$|/32|" /spider/local_data/tor-proxies.txt')


4. Make sure the directory is created: /spider/cmd_import , if not:
mkdir /spider/cmd_import

5. Make log directory:
mkdir /spider local_data/bad_spotter

6. The first time you want to run it, from the prompt:

/usr/bin/perl -w /spider/local_cmd/bad_spotter.pl &

# End

Example tail -f /spider local_data/bad_spotter/log.txt

2022-09-12T14:01:53 [N9KT-2, RA1AL, 185.220.101.79, Politics and 
HAMSPIRIT no mix!]
2022-09-12T14:54:41 [N9KT-2, RA3ATX, 185.129.61.129, RU will liberate 
the world!]
2022-09-13T17:52:58 [PI4CC, PA2A, 77.171.80.188, ]

Do not forget that it is a development version.

73 de Kin

Sysop EA3CV-2 & EA4URE-2,3,5

El 14/09/2022 a las 14:54, David Spoelstra escribió:
> Joaquin-
> Yes, please, send me the script.
> -David, N9KT
>
> On Wed, Sep 14, 2022 at 8:51 AM Joaquin via Dxspider-support 
> <dxspider-support at tobit.co.uk> wrote:
>
>     Hi David,
>
>     You have two more options:
>
>     1. Enable for everyone:
>     set/register
>     set/password
>
>     2. If you want I can send you a small script that will automatically
>     block any callsign that comes from the TOR network or is using a
>     PROXY.
>     The script runs the set/bad/spotter command and logs the callsign
>     that
>     has been blocked.
>     It is a help, but it is not the definitive solution.
>
>     Regards.
>
>     Kin EA3CV
>
>     El 14/09/2022 a las 14:35, David Spoelstra via Dxspider-support
>     escribió:
>     > Seems like my cluster is being used for propaganda. I've spent the
>     > morning running "set/badspotter" and "set/badword" commands. Is
>     there
>     > anything else I should be doing?
>
>     _______________________________________________
>     Dxspider-support mailing list
>     Dxspider-support at tobit.co.uk
>     https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.tobit.co.uk/pipermail/dxspider-support/attachments/20220914/d13e4bad/attachment-0001.htm>
-------------- next part --------------
#!/usr/bin/perl

#
# Automatic callsign blocking that uses TOR or PROXIES to send spots
#
# Created by EA3CV
#
# 20220914 v0.3
#

use strict;
use warnings;
use 5.10.1;
use NetAddr::IP;
use Time::Piece;

$ENV{TZ} = "UTC";

#my $server = $ARGV[0];

my $time = Time::Piece->new;
my $d = $time->yday();
$d = sprintf("%03d", $d) + 1;
my $y = $time->year("");

my $log = "/spider/local_data/spots/$y/$d.dat";

open my $data, "-|", "/usr/bin/tail", "-n1", "-f", $log or die "could not start tail on $log: $!";

my $line;
my @rray;
my @conn;

my $tor = "/spider/local_data/tor-proxies.txt";
my $log_bad = "/spider/local_data/bad_spotter/log.txt";
#my $log_noIP = "/spider/local_data/no_IP/log.txt";

while($line = <$data>){
   chomp($line);
   my @line = split(/\^/, $line, -1);

   # Obtener [node, spotter, IP source, comment]
   my $spotter = $line[4];
   my $node = $line[7];
   my $comm = $line[3];
   if (scalar(@line) == 15) {
      my $ipAddr = $line[14];

      # Find IP tor-proxies.txt
      open TOR, $tor or die "No existe ".$tor;
      my @netAddr = <TOR>;
      my $i = 0;
      my $x = 0;

      while ($x < 1 && $i < scalar(@netAddr)) {
         my $network  = NetAddr::IP->new($netAddr[$i]);
         my $ip = NetAddr::IP->new($ipAddr);

         if ($ip->within($network)) {
            # Send set/badspotter to DXSpider
            open (FH, '>', "/spider/cmd_import/EA3CV");
            my $msg = "set/badspotter $spotter";
            say FH $msg;
            close (FH);

#            # Send set/baddx to DXSpider
#            open (FH, '>', "/spider/cmd_import/EA3CV");
#            $msg = "set/baddx $spotter";
#            say FH $msg;
#            close (FH);

            # Log bad_spotter
            my $times = gmtime();
            my $ts = Time::Piece->strptime($times, '%a %b %d %H:%M:%S %Y')->datetime("");

            open (LOGBAD, '>>', "/spider/local_data/bad_spotter/log.txt");
            my $out = "$ts [$node, $spotter, $ipAddr, $comm]";
            say LOGBAD $out;
            close (LOGBAD);

            $x = 1;
         }
         $i++;
      }
      close TOR;

   } else {
#       # Log no_ip
#       open (LOGNOIP, '>>', "/spider/local_data/no_IP/log.txt");
#       my $out = "[$node, $spotter]";
#       say LOGNOIP $out;
#       close (LOGNOIP);
   }

}
close $data;


More information about the Dxspider-support mailing list