From 5daa51c16e6c17da2429e29c13e5d4eaddaf6fb6 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 1 Jun 2017 10:14:32 +0200 Subject: Initial commit --- receive-all-keys | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ receive-key | 11 +++++++++++ test-domain | 5 +++++ 3 files changed, 75 insertions(+) create mode 100755 receive-all-keys create mode 100755 receive-key create mode 100755 test-domain diff --git a/receive-all-keys b/receive-all-keys new file mode 100755 index 0000000..80abb42 --- /dev/null +++ b/receive-all-keys @@ -0,0 +1,59 @@ +#!/bin/bash + +test_domain="$(dirname "$(readlink -f "$0")")/test-domain" +receive_key="$(dirname "$(readlink -f "$0")")/receive-key" + +echo "$receive_key" +exit + +tmp_dir="$(mktemp -d)" + +pushd "${tmp_dir}" > /dev/null + +grep '@' ~/.thunderbird/*.default/ImapMail/imap.gmx.net/INBOX | \ + sed 's|\s\+|\n|g' | \ + tr ' \t<>();"[]~=+#:,$|&/?%{}/\\!*^`'"'" '\n' | \ + grep '^[^@]\+@[^@]\+\.[^@]\+$' | \ + pv --line-mode | \ + grep '^[_0-9a-zA-Z.-]\+@[_0-9a-zA-Z.-]\+$' > \ + adressen + +sort -uf adressen | \ + tee adressen.sorted | \ + wc -l + +mv adressen.sorted adressen + +cut -d@ -f2 adressen | \ + sort -uf | \ + tee domains | \ + wc -l + +parallel -j 100 "${test_domain}" '{}' \; < domains > domains.ok + +mv domains.ok domains + +( + sed 's|$| 0|' domains + sed 's|^\(.*\)@\(.*\)$|\2 1 \1@\2|' adressen +) | \ + sort -k1,1 -k2n,2 | \ + while read -r a b c; do + if [ "${b}" == "0" ]; then + domain="${a}" + continue + fi + if [ "${a}" == "${domain}" ] && [ "${b}" == "1" ]; then + echo "${c}" + fi + done | \ + tee adressen.ok | \ + wc -l + +mv adressen.ok adressen + +xargs -n1 "${receive_key}" < adressen + +popd > /dev/null + +rm -rf --one-file-system "${tmp_dir}" diff --git a/receive-key b/receive-key new file mode 100755 index 0000000..c777bb6 --- /dev/null +++ b/receive-key @@ -0,0 +1,11 @@ +#!/bin/bash + +keyIDs="$( + gpg --batch --with-colons --search-keys "$1" 2> /dev/null | \ + grep '^pub:' | \ + cut -d: -f2 +)" + +if [ -n "${keyIDs}" ]; then + gpg --recv-keys ${keyIDs} +fi diff --git a/test-domain b/test-domain new file mode 100755 index 0000000..3ada51e --- /dev/null +++ b/test-domain @@ -0,0 +1,5 @@ +#!/bin/bash + +if ping -c1 "$1" &> /dev/null; then + echo "$1" +fi -- cgit v1.2.3-70-g09d2