blob: 2ae8babd6319ee5c07ac494faa437c24bf6e340c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env bash
#
# List all the current bittorrent nodes
#
set -e
cd "$(dirname "${0}")" || exit 1
. ./common.sh || exit 1
# NOTE: JQ can be found at https://stedolan.github.io/jq/
CMD='curl -s -H "Accept: application/json; indent=4" https://bitnodes.io/api/v1/snapshots/latest/'
RESULT_V4="$(${CMD} | jq -r '.nodes|keys[] as $k | "\($k)"' | grep -v onion | grep -v ']' | cut -d ':' -f 1)"
RESULT_V6="$(${CMD} | jq -r '.nodes|keys[] as $k | "\($k)"' | grep -v onion | grep ']' | cut -d '[' -f 2 | cut -d ']' -f 1)"
RESULTS="echo ${RESULT_V4} ${RESULT_V6}"
OUT_FILE="../lists/99_bitcoinnodes.ip_list"
rm -f ${OUT_FILE}
strarr=($(echo $RESULT_V4 | tr " " "\n"))
for i in "${strarr[@]}"; do
echo "$i/32" >> "${OUT_FILE}"
done
#########
strarr=($(echo $RESULT_V6 | tr " " "\n"))
for i in "${strarr[@]}"; do
echo "$i/128" >> "${OUT_FILE}"
done
|