blob: d07a69f6f0b577eaeea159af8d090d665fd92ef1 (
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
|
open_db () {
cat bangbang - | nc whois.radb.net 43
}
extract_answer () {
set -e
local c
local l
local eot
while read l
do
c="${l:0:1}"
if [ "$c" == "A" ]; then
c="${l:1}"
read -N "$c" l
# consume "C"
read eot && [ "$eot" == "C" ] || echo "Protocol error" >&2 || exit 1
printf '%s\0' "$l"
elif [ "$c" == "%" ]; then
read
printf '\0'
elif [ "$c" == "D" ]; then
printf '\0'
fi
done
}
|