Created
April 5, 2024 23:36
-
-
Save IAALAI/fa92c95d5881660478d3ccc4228f3c24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 将 qBittorrent-ClientBlocker 的日志中的内容提取为 ipfilter.dat 文件 | |
if [ ! -f $1 ]; then | |
echo "文件不存在" | |
exit 1 | |
fi | |
private_ip_regex='^(10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.|192\.168\.)' | |
grep -oP '(?<=^|\s)((\d{1,3}\.){3}\d{1,3})' $1 | while read line; do | |
if [[ $line =~ $private_ip_regex ]]; then | |
continue | |
fi | |
echo "$line - $line , 0 , " | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment