我需要生成分配给某个AS (ipv4)编号的所有(ASN)子网的ipset表。你知道Linux工具吗?
谢谢。
发布于 2016-11-26 21:27:06
完成:
#!/bin/bash
# define AS to block
as=( AS1111
AS2222
)
# define output
output=('create block hash:net family inet hashsize 1024 maxelem 1024')
# build list of subnets
for i in "${as[@]}"
do
echo $i
output+=(`whois -h whois.radb.net -- "-i origin $i" | grep -Eo "([0-9.]+){4}/[0-9]+" | head`)
done
# dump output to file
printf '%s\n' "${output[@]}" > /etc/sysconfig/ipset
exit 0https://stackoverflow.com/questions/40818424
复制相似问题