Skip to content

Instantly share code, notes, and snippets.

@zoff99
Created June 12, 2022 10:48
Show Gist options
  • Save zoff99/3881b8d260874cb88807e8751937d982 to your computer and use it in GitHub Desktop.
Save zoff99/3881b8d260874cb88807e8751937d982 to your computer and use it in GitHub Desktop.
#! /bin/bash
nodes_url="https://nodes.tox.chat/json"
file="n.json"
latest_toxcore_version_text="1000002018"
ok_toxcore_version="1000002013 1000002014 1000002015 1000002016 1000002017"
rm -f "$file"
wget "$nodes_url" -O "$file" >/dev/null 2>&1
echo 'all bootstrap nodes with "status_udp == true"'
echo ""
jq -c '.nodes[] | select(.status_udp == true) | {version} ' "$file"|sort -n|uniq -c
count_all=$(jq -c '.nodes[] | select(.status_udp == true) | {version} ' "$file"|wc -l)
count_latest=$(jq -c '.nodes[] | select(.status_udp == true and .version == "'"$latest_toxcore_version_text"'") | {version} ' "$file"|wc -l)
count_ok=0
for v_tmp in $ok_toxcore_version; do
count_tmp=$(jq -c '.nodes[] | select(.status_udp == true and .version == "'"$v_tmp"'") | {version} ' "$file"|wc -l)
count_ok=$[ $count_ok + $count_tmp ]
done
rm -f "$file"
count_vul=$[ $count_all - $count_ok - $count_latest ]
echo ""
printf "%2d" "$count_vul"
echo ' old vulnerable toxcore version'
printf "%2d" "$count_ok"
echo ' OK'
printf "%2d" "$count_latest"
echo ' OK and running latest release of toxcore version'
echo ""
printf "%2d" "$count_all"
echo ' running with "status_udp == true"'
echo ""
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment