aboutsummaryrefslogtreecommitdiff
path: root/query-rpki-prefixes
blob: 34c365a300c7d5816f265c8e203f10d5ff1b2b56 (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
#!/bin/bash
. common.sh

read_prefixes () {
	grep -Eoi '[a-f0-9.:]+/[0-9]{1,3}' | while read l
	do
		echo '!r'"$l"
	done
}

process_result () {
	local r

	while read -d '' r
	do
		if echo "$r" | grep -Eiqs '^rpki-ov-state:(\s+)?valid'; then
			echo "$r" |
				grep -Eoi 'route6?:(\s+)?[a-f0-9.:]+/[0-9]{1,3}' |
				sed -E 's/^route6?:(\s+)?//' |
				sort |
				uniq |
				head -n1
		fi
	done
}


read_prefixes | open_db | extract_answer | process_result