Giter Club home page Giter Club logo

Comments (13)

wangwanjie avatar wangwanjie commented on June 1, 2024 1

你这个有语法错误,可以优化下,一个awk就够啦

#!/bin/bash
curl -O https://ispip.clang.cn/all_cn_cidr.txt

awk 'BEGIN{ FS="/"; OFS="" } {
    mask = "";
    if ($2 == "10") mask = "255.192.0.0";
    else if ($2 == "11") mask = "255.224.0.0";
    else if ($2 == "12") mask = "255.240.0.0";
    else if ($2 == "13") mask = "255.248.0.0";
    else if ($2 == "14") mask = "255.252.0.0";
    else if ($2 == "15") mask = "255.254.0.0";
    else if ($2 == "16") mask = "255.255.0.0";
    else if ($2 == "17") mask = "255.255.128.0";
    else if ($2 == "18") mask = "255.255.192.0";
    else if ($2 == "19") mask = "255.255.224.0";
    else if ($2 == "20") mask = "255.255.240.0";
    else if ($2 == "21") mask = "255.255.248.0";
    else if ($2 == "22") mask = "255.255.252.0";
    else if ($2 == "23") mask = "255.255.254.0";
    else if ($2 == "24") mask = "255.255.255.0";
    print "{\"val\":\""$1"/"$2"\",\"ip_mask\":\""$1"/"mask"\",\"note\":\"\"},"
}' all_cn_cidr.txt > new_all_cn_cidr.txt

grep '255.255.255.255' -n new_all_cn_cidr.txt

from anylink.

hjfxyz avatar hjfxyz commented on June 1, 2024 1

你这个有语法错误,可以优化下,一个awk就够啦

#!/bin/bash
curl -O https://ispip.clang.cn/all_cn_cidr.txt

awk 'BEGIN{ FS="/"; OFS="" } {
    mask = "";
    if ($2 == "10") mask = "255.192.0.0";
    else if ($2 == "11") mask = "255.224.0.0";
    else if ($2 == "12") mask = "255.240.0.0";
    else if ($2 == "13") mask = "255.248.0.0";
    else if ($2 == "14") mask = "255.252.0.0";
    else if ($2 == "15") mask = "255.254.0.0";
    else if ($2 == "16") mask = "255.255.0.0";
    else if ($2 == "17") mask = "255.255.128.0";
    else if ($2 == "18") mask = "255.255.192.0";
    else if ($2 == "19") mask = "255.255.224.0";
    else if ($2 == "20") mask = "255.255.240.0";
    else if ($2 == "21") mask = "255.255.248.0";
    else if ($2 == "22") mask = "255.255.252.0";
    else if ($2 == "23") mask = "255.255.254.0";
    else if ($2 == "24") mask = "255.255.255.0";
    print "{\"val\":\""$1"/"$2"\",\"ip_mask\":\""$1"/"mask"\",\"note\":\"\"},"
}' all_cn_cidr.txt > new_all_cn_cidr.txt

grep '255.255.255.255' -n new_all_cn_cidr.txt

from anylink.

xxc2011 avatar xxc2011 commented on June 1, 2024

我也想排除大陆的所有IP地址,但是里面只能一条一条加??? 要怎么导入?? 放在db里面??

from anylink.

lanrenwo avatar lanrenwo commented on June 1, 2024

目前Anyconnect桌面端的上限是2500条,移动端约200条。

from anylink.

lanrenwo avatar lanrenwo commented on June 1, 2024

我也想排除大陆的所有IP地址,但是里面只能一条一条加??? 要怎么导入?? 放在db里面??

#278 新增加了 编辑模式,可以批量导入。

from anylink.

xxc2011 avatar xxc2011 commented on June 1, 2024

我也想排除大陆的所有IP地址,但是里面只能一条一条加??? 要怎么导入?? 放在db里面??

#278 新增加了 编辑模式,可以批量导入。

谢谢,我用docker部署了,要怎么更新这个文件? 找半天没找到。

from anylink.

hjfxyz avatar hjfxyz commented on June 1, 2024

我也想排除大陆的所有IP地址,但是里面只能一条一条加??? 要怎么导入?? 放在db里面??

#!/bin/bash
curl -O https://ispip.clang.cn/all_cn_cidr.txt
awk '{print $1,$1}' all_cn_cidr.txt > new.txt
sed -i 's/^/{"val":"/g' new.txt
awk 'BEGIN{ FS=" ";OFS="," }{ print $1,$2 }' new.txt > new1.txt
sed -i 's/,/","ip_mask":"/g' new1.txt
awk -F '/' '{OFS="/"} {sub(/10$/, "255.192.0.0", $3); print}' new1.txt > new2.txt
awk -F '/' '{OFS="/"} {sub(/11$/, "255.224.0.0", $3); print}' new2.txt > new1.txt
awk -F '/' '{OFS="/"} {sub(/12$/, "255.240.0.0", $3); print}' new1.txt > new2.txt
awk -F '/' '{OFS="/"} {sub(/13$/, "255.248.0.0", $3); print}' new2.txt > new1.txt
awk -F '/' '{OFS="/"} {sub(/14$/, "255.252.0.0", $3); print}' new1.txt > new2.txt
awk -F '/' '{OFS="/"} {sub(/15$/, "255.254.0.0", $3); print}' new2.txt > new1.txt
awk -F '/' '{OFS="/"} {sub(/16$/, "255.255.0.0", $3); print}' new1.txt > new2.txt
awk -F '/' '{OFS="/"} {sub(/17$/, "255.255.128.0", $3); print}' new2.txt > new1.txt
awk -F '/' '{OFS="/"} {sub(/18$/, "255.255.192.0", $3); print}' new1.txt > new2.txt
awk -F '/' '{OFS="/"} {sub(/19$/, "255.255.224.0", $3); print}' new2.txt > new1.txt
awk -F '/' '{OFS="/"} {sub(/20$/, "255.255.240.0", $3); print}' new1.txt > new2.txt
awk -F '/' '{OFS="/"} {sub(/21$/, "255.255.248.0", $3); print}' new2.txt > new1.txt
awk -F '/' '{OFS="/"} {sub(/22$/, "255.255.252.0", $3); print}' new1.txt > new2.txt
awk -F '/' '{OFS="/"} {sub(/23$/, "255.255.254.0", $3); print}' new2.txt > new1.txt
awk -F '/' '{OFS="/"} {sub(/24$/, "255.255.255.0", $3); print}' new1.txt > all_cn_cidr.txt
sed -i 's/$/","note":""},/g' all_cn_cidr.txt
grep '255.255.255.255' -rn all_cn_cidr.txt

这个就是清洗出大陆的路由脚本,然后你再把这些数据直接添加到anylink.db相应表字段中。就可以

from anylink.

xxc2011 avatar xxc2011 commented on June 1, 2024

里面有5000多条,但是这个程序只能2000条。而且加起来麻烦啊。。。。

#278 新增加了 编辑模式,可以批量导入。不知道怎么更新这个文件?找不到这个文件。

from anylink.

hjfxyz avatar hjfxyz commented on June 1, 2024

里面有5000多条,但是这个程序只能2000条。而且加起来麻烦啊。。。。

#278 新增加了 编辑模式,可以批量导入。不知道怎么更新这个文件?找不到这个文件。
anyconnect的windows客户端只支持2000多条,但是他自家的anylink客户端支持5000多
https://anylink.pro

from anylink.

lanrenwo avatar lanrenwo commented on June 1, 2024

这么多..... 那我取消一下限制2000条的数量。

from anylink.

lanrenwo avatar lanrenwo commented on June 1, 2024

我也想排除大陆的所有IP地址,但是里面只能一条一条加??? 要怎么导入?? 放在db里面??

#278 新增加了 编辑模式,可以批量导入。

谢谢,我用docker部署了,要怎么更新这个文件? 找半天没找到。

你好,需要作者合并代码,再等几天。

from anylink.

lanrenwo avatar lanrenwo commented on June 1, 2024

作者已经合并到dev。

from anylink.

xxc2011 avatar xxc2011 commented on June 1, 2024

作者已经合并到dev。

我更新docker就行吗?

from anylink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.