We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
目前状况:
167.71.18.94 207.154.224.242 [美国 纽约市DigitalOcean云公司] 47.106.88.234 120.246.107.20 [中国 移动] 111.59.153.137 118.123.213.221 172.105.90.107 207.180.236.214 [美国 ] 143.198.50.119 [美国 ] 165.232.161.232 182.150.48.140 [四川省成都市 电信]
分析:看了一下代码,正则匹配是正常的。出错的原因是ip同时命中了ipv4和domain的正则,sort之后有的ip在数组中是ipv4匹配在前,有的是domain在前,ipv4在前的结果就被domain的覆盖了,而domain查询结果为空,导致最终结果为空。
Element[0] = &{[%!s(int=0) %!s(int=12)] %!s(entity.EntityType=2) 167.71.18.94 } Element[1] = &{[%!s(int=0) %!s(int=12)] %!s(entity.EntityType=0) 167.71.18.94 } Element[2] = &{[%!s(int=13) %!s(int=28)] %!s(entity.EntityType=0) 207.154.224.242 } Element[3] = &{[%!s(int=13) %!s(int=28)] %!s(entity.EntityType=2) 207.154.224.242 }
解决方案: 核心原因是正则问题,所以我的修复方式是修改正则,增加domain匹配的时候匹配一级域名,一级域名是在cdn.json里找出来的 `[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*.(cc|cloud|com.cn|com|co|cn|io|me|net|org|tv)`` ps:其实改成同个ip多次匹配返回非空那个比较合理,但不会写go。。。。 pps:正则改成这样肯定也会有问题,但我一般不查cdn问题不大
结果:
➜ nali git:(master) ✗ go run . 167.71.18.94 207.154.224.242 47.106.88.234 120.246.107.20 111.59.153.137 118.123.213.221 172.105.90.107 207.180.236.214 143.198.50.119 165.232.161.232 182.150.48.140 167.71.18.94 [美国 ] 207.154.224.242 [美国 纽约市DigitalOcean云公司] 47.106.88.234 [广东省深圳市 阿里云] 120.246.107.20 [中国 移动] 111.59.153.137 [广西南宁市 移动] 118.123.213.221 [四川省成都市 电信] 172.105.90.107 [德国 黑森州法兰克福Linode数据中心] 207.180.236.214 [美国 ] 143.198.50.119 [美国 ] 165.232.161.232 [美国 ] 182.150.48.140 [四川省成都市 电信]
The text was updated successfully, but these errors were encountered:
fix: Prevent domain name matching IP #64
2d86ad7
感谢反馈,试一下 https://github.com/zu1k/nali/releases/tag/v0.3.2
Sorry, something went wrong.
确认已修复,感谢。 close
dd4507b
8e87230
zu1k
No branches or pull requests
目前状况:
分析:看了一下代码,正则匹配是正常的。出错的原因是ip同时命中了ipv4和domain的正则,sort之后有的ip在数组中是ipv4匹配在前,有的是domain在前,ipv4在前的结果就被domain的覆盖了,而domain查询结果为空,导致最终结果为空。
解决方案:
核心原因是正则问题,所以我的修复方式是修改正则,增加domain匹配的时候匹配一级域名,一级域名是在cdn.json里找出来的
`[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*.(cc|cloud|com.cn|com|co|cn|io|me|net|org|tv)``
ps:其实改成同个ip多次匹配返回非空那个比较合理,但不会写go。。。。
pps:正则改成这样肯定也会有问题,但我一般不查cdn问题不大
结果:
The text was updated successfully, but these errors were encountered: