#!/bin/bash

## Copyright (C) 2020 - 2023 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

while read -r -d $'\n' line ; do
   read -r first_word second_word _ <<< "$line"
   temp="$first_word"
   temp="$(echo "$temp" | LANG=C str_replace "http://" "")"
   plain_url="$(echo "$temp" | LANG=C str_replace "https://" "")"
   ## web.archive.org did not support tlsv1.3 at time of writing.
   ## XXX: --cert-status
   if scurl --tlsv1.2 --silent --location "$second_word" | grep -q "$plain_url" ; then
      continue
   fi
   echo "Failed!"
   echo scurl --tlsv1.2 --silent --location "$second_word"
   echo "plain_url: $plain_url"
   echo "second_word: $second_word"
   echo ""
done < <( /usr/share/sdwdate/onion-list-all )
