diff --git a/README.md b/README.md index 7d3e216..b2dd35d 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,25 @@ Name: zgovweb.v.bsgslb.cn [白山云 CDN] Address: 2001:428:6402:21b::5 ``` +#### Also parse IP geo + +``` + +➜ nali git:(master) ✗ nslookup www.gov.cn | nali +Server: 127.0.0.53 [局域网 IP] +Address: 127.0.0.53 [局域网 IP]#53 + +Non-authoritative answer: +www.gov.cn canonical name = www.gov.cn.bsgslb.cn [白山云 CDN]. +www.gov.cn.bsgslb.cn [白山云 CDN] canonical name = zgovweb.v.bsgslb.cn [白山云 CDN]. +Name: zgovweb.v.bsgslb.cn [白山云 CDN] +Address: 103.104.170.25 [新加坡 CZ88.NET] +Name: zgovweb.v.bsgslb.cn [白山云 CDN] +Address: 2001:428:6402:21b::5 [美国Louisiana州Monroe Qwest Communications Company, LLC (CenturyLink)] +Name: zgovweb.v.bsgslb.cn [白山云 CDN] +Address: 2001:428:6402:21b::6 [美国Louisiana州Monroe Qwest Communications Company, LLC (CenturyLink)] +``` + #### Use standalone You should parse cname by yourself diff --git a/pkg/qqwry/qqwry.go b/pkg/qqwry/qqwry.go index 607e778..a2bb3d1 100644 --- a/pkg/qqwry/qqwry.go +++ b/pkg/qqwry/qqwry.go @@ -105,6 +105,9 @@ func (db QQwry) Find(ip string) (res string) { country, _ := enc.String(string(gbkCountry)) area, _ := enc.String(string(gbkArea)) + country = strings.ReplaceAll(country, " CZ88.NET", "") + area = strings.ReplaceAll(area, " CZ88.NET", "") + return fmt.Sprintf("%s %s", country, area) } diff --git a/pkg/zxipv6wry/zxipv6wry.go b/pkg/zxipv6wry/zxipv6wry.go index 963cac6..fd3aeb0 100644 --- a/pkg/zxipv6wry/zxipv6wry.go +++ b/pkg/zxipv6wry/zxipv6wry.go @@ -8,6 +8,7 @@ import ( "math/big" "net" "os" + "strings" "github.com/zu1k/nali/pkg/common" ) @@ -63,6 +64,10 @@ func (db ZXwry) Find(ip string) (result string) { ipv6 := op.Uint64() offset := db.searchIndex(ipv6) country, area := db.getAddr(offset) + + country = strings.ReplaceAll(country, " CZ88.NET", "") + area = strings.ReplaceAll(area, " CZ88.NET", "") + return fmt.Sprintf("%s %s", country, area) }