Files
hush3/contrib/scripts/hush_scanner
dan_s a2647b106f Move 15 loose scripts from contrib/ root to contrib/scripts/
Consolidate all standalone utility scripts into contrib/scripts/:
- Perl: avg_blocktime.pl, block_time.pl, gen-zaddrs.pl, sda_checkpoints.pl,
  sdl_checkpoints.pl, hush_block_subsidy_per_halving, hush_halvings,
  hush_scanner, hush_supply, hush_supply_old
- Shell: fresh_clone_compile_and_run.sh, tidy_datadir.sh, dragonx_scanner
- Python: convert_address.py
- BAT: hush-uri.bat

Update path references in contrib/README.md, doc/OLD_WALLETS.md,
doc/relnotes/README.md, and sdl_checkpoints.pl.
2026-02-27 12:00:46 -06:00

38 lines
1.1 KiB
Perl
Executable File

#!/usr/bin/env perl
# Copyright (c) 2016-2024 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
use strict;
use warnings;
# Given a file of host data, one per line,
# scan them to see if p2p/rpc ports are accessible
# RPCs should not be open to the internet and this is
# an easy way to check many hosts, as well as seeing
# if a full node is down via an inaccessible p2p port.
# Scan a different coin via P2PPORT and RPCPORT.
print "HOST P2P RPC\n";
while (<>) {
chomp;
my $host = $_;
# skip empty lines
next unless $host;
# skip comment lines
next if ($host =~ m/^#/);
my $p2pport = $ENV{P2PPORT} || 18030;
my $rpcport = $ENV{RPCPORT} || $p2pport + 1;
my $cmd1 = qq{nc -z -w2 $host $p2pport};
my $cmd2 = qq{nc -z -w2 $host $rpcport};
qx{$cmd1};
my $errcode1 = $?;
qx{$cmd2};
my $errcode2 = $?;
my $status1 = $errcode1 ? "DOWN" : "UP";
my $status2 = $errcode2 ? "DOWN" : "UP";
print "$host $status1 $status2\n"
}