Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ae3e6eefd | ||
|
|
7880bc1623 | ||
|
|
3bea4087f6 | ||
|
|
d4274ffaa1 | ||
|
|
eecdbcafb1 | ||
|
|
6002f3c16b | ||
|
|
cb22d3d7ce | ||
|
|
479ddef2a7 | ||
|
|
0acd839507 |
9
DNSv6/Code/README.md
Normal file
9
DNSv6/Code/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
## 组织结构
|
||||
|
||||
```
|
||||
allv6.py #汇总所有v6地址结果
|
||||
ch_dns.py #全国探针发送程序
|
||||
dnsfound_util.py #DNSv6工具包
|
||||
ipmatch.py #IP段匹配(山东)
|
||||
```
|
||||
|
||||
20
DNSv6/Code/allv6.py
Normal file
20
DNSv6/Code/allv6.py
Normal file
@@ -0,0 +1,20 @@
|
||||
'''
|
||||
用于将多个NS端pcap导出结果进行合并(另一种方法是将pcap文件合并后再导出)
|
||||
'''
|
||||
import pandas as pd
|
||||
|
||||
# 结果保存位置
|
||||
res_path="./result/v6/allv6dns.csv"
|
||||
# 创建结果文件
|
||||
allip=pd.DataFrame(columns=["IPv6","Count"])
|
||||
allip.to_csv("./result/v6/allv6dns.csv",encoding='gbk', header=True, index=False)
|
||||
|
||||
for i in range(5):
|
||||
# 资源路径
|
||||
path="./result/v6/v6-"+str(i+1)+".csv"
|
||||
ip_datas=pd.read_csv(path,skiprows=2,names=["level","parent","IPv6","count","ave","min","max","rate","per","BR","BS"])
|
||||
data = ip_datas.iloc[1:, [2,3]]
|
||||
data.to_csv(res_path,mode="a", encoding='gbk', header=False, index=False)
|
||||
|
||||
|
||||
|
||||
23
DNSv6/Code/ch_dns.py
Normal file
23
DNSv6/Code/ch_dns.py
Normal file
@@ -0,0 +1,23 @@
|
||||
'''
|
||||
探针发送主程序
|
||||
'''
|
||||
import pandas as pd
|
||||
import dnsfound_util as dnsu
|
||||
|
||||
alphabet=dnsu.alphabet
|
||||
#IPv4地址
|
||||
spath="./res_data/china/forwarder.xlsx"
|
||||
#返回结果保存
|
||||
dpath="./result/china/forward/res-5.csv"
|
||||
ch_dns=pd.read_excel(spath,names=["rdns","loc","company"])
|
||||
# 对于直接响应dns
|
||||
# ch_dns=pd.read_excel(spath,names=["rdns","dns"])
|
||||
# dns_result = pd.DataFrame(columns=["rdns", "result"],)
|
||||
|
||||
#保存所有多线程生成器
|
||||
List=[dnsu.dnsresolver(i,ch_dns) for i in dnsu.tqdm(range(ch_dns.shape[0]))]
|
||||
|
||||
#从所有多线程生成器中读取结果
|
||||
dns_result=pd.concat([pd.DataFrame([res.result()],columns=["rdns","result"]) for res in List],ignore_index=True)
|
||||
|
||||
dns_result.to_csv(dpath)
|
||||
51
DNSv6/Code/dnsfound_util.py
Normal file
51
DNSv6/Code/dnsfound_util.py
Normal file
@@ -0,0 +1,51 @@
|
||||
'''
|
||||
DNSv6工具包,注意tomorrow3无法在arm架构处理器上使用(m1)
|
||||
'''
|
||||
import dns.resolver
|
||||
import pandas as pd
|
||||
import random as rd
|
||||
import tomorrow3 as tm
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
alphabet = "abcdefghijklmnopqrstuvwxyz1234567890"
|
||||
|
||||
|
||||
result = pd.DataFrame(columns=["rdns", "result"])
|
||||
dot_ressult = pd.DataFrame(columns=["dot", "result"])
|
||||
|
||||
|
||||
|
||||
# val负责定位,dataframe指定数据来源
|
||||
@tm.threads(200)
|
||||
def dnsresolver(val,dataframe):
|
||||
characters = "".join(rd.sample(alphabet, 10)) # 生成子域名
|
||||
test = dataframe.loc[val, "rdns"]
|
||||
reso = dns.resolver.Resolver()
|
||||
reso.nameservers = [test]
|
||||
reso.timeout = 10
|
||||
try:
|
||||
AAAA = reso.resolve(characters + ".v4.testv4-v6.live", "AAAA").response
|
||||
# result = result.append([[test, AAAA.rcode()]], ignore_index=True)
|
||||
return [test,AAAA.rcode()]
|
||||
except:
|
||||
# result=result.append([[test, 1]], ignore_index=True)
|
||||
return [test,1]
|
||||
|
||||
|
||||
|
||||
# if __name__=="__main__":
|
||||
# mode="main"
|
||||
# rdns = pd.read_csv("./res_data/rdns-shandong.csv", names=["rdns"])
|
||||
# dot = pd.read_csv("./res_data/853-shandong.csv", names=["dot"])
|
||||
# ch_rdns = pd.read_excel("./res_data/全国-递归DNS测量结果.xlsx", names=["rdns", "loc", "company"])
|
||||
#
|
||||
# for i in tqdm(range(ch_rdns.shape[0])):
|
||||
# dnsresolver(i,ch_rdns,result)
|
||||
#
|
||||
# if (mode == "rdns"):
|
||||
# result.to_csv("./result/"+str(2)+"-ch_rdns.csv")
|
||||
# else:
|
||||
# dot_ressult.to_csv("./result/dot.csv")
|
||||
|
||||
|
||||
44
DNSv6/Code/ipmatch.py
Normal file
44
DNSv6/Code/ipmatch.py
Normal file
@@ -0,0 +1,44 @@
|
||||
'''
|
||||
IP段匹配
|
||||
'''
|
||||
import ipaddress as ipaddr
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def makecidr(DATAframe):
|
||||
cidr=pd.DataFrame()
|
||||
for i in range(DATAframe.shape[0]):
|
||||
if ":" in DATAframe.loc[i,"start_ip"]:
|
||||
start_ip=ipaddr.ip_address(DATAframe.loc[i,"start_ip"])
|
||||
end_ip=ipaddr.ip_address(DATAframe.loc[i,"end_ip"])
|
||||
ipcidr=ipaddr.summarize_address_range(start_ip,end_ip)
|
||||
for ips in ipcidr:
|
||||
cidr = cidr.append([[ips]])
|
||||
|
||||
return cidr
|
||||
def matchIP(ip,cidrs):
|
||||
for c in cidrs.keys():
|
||||
for j in range(cidrs[c].shape[0]):
|
||||
if (ipaddr.IPv6Address(ip) in ipaddr.IPv6Network(cidrs[c].iloc[j, 0])):
|
||||
|
||||
return str(c)
|
||||
if __name__=="__main__":
|
||||
# 读取原始数据
|
||||
cidrs=[]
|
||||
dx = pd.read_excel("./res_data/IPrange/山东电信.xlsx", names=["time", "start_ip", "end_ip", "organization", "company"])
|
||||
yd = pd.read_excel("./res_data/IPrange/山东移动.xlsx", names=["time", "start_ip", "end_ip", "organization", "company"])
|
||||
lt = pd.read_excel("./res_data/IPrange/山东联通.xlsx", names=["time", "start_ip", "end_ip", "organization", "company"])
|
||||
ips=pd.read_csv("./result/v6/allv6dns.csv",header=0)
|
||||
|
||||
# dx_cidr=makecidr(dx)
|
||||
# yd_cidr=makecidr(yd)
|
||||
# lt_cidr=makecidr(lt)
|
||||
cidrs={"dx":makecidr(dx),"yd":makecidr(yd),"lt":makecidr(lt)}
|
||||
ips["company"]=ips["IPv6"].map(lambda x:matchIP(x,cidrs))
|
||||
ips_n=pd.pivot_table(ips,values=["Count"],index=["IPv6"],aggfunc=sum)
|
||||
ips_c=ips.drop_duplicates(subset=["IPv6"],keep="first")
|
||||
ips_L=ips_n.merge(ips_c.loc[:,["IPv6","company"]],how="left",on="IPv6")
|
||||
ips_L.to_csv("./result/v6/v6DNSs.csv",index=False)
|
||||
# for i in range(ips.shape[0]):
|
||||
|
||||
|
||||
BIN
DNSv6/README.assets/Godaddy NS配置.png
Normal file
BIN
DNSv6/README.assets/Godaddy NS配置.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
DNSv6/README.assets/自建NS端配置.png
Normal file
BIN
DNSv6/README.assets/自建NS端配置.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
33
DNSv6/README.md
Normal file
33
DNSv6/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# DNSv6
|
||||
|
||||
### 组织结构
|
||||
|
||||
```
|
||||
├─Code #dns探针发送代码
|
||||
├─result #自建NS端的pcap结果以及5次探针发送情况
|
||||
│ └─china
|
||||
│ ├─forward #转发
|
||||
│ ├─gkdg #公开递归
|
||||
│ ├─jjdg #间接递归
|
||||
│ └─zjxy #直接响应
|
||||
└─src
|
||||
├─china #ipv4的种子地址数据,来自@莫迪凯
|
||||
└─shandong #山东v4数据
|
||||
├─IPrange #三大运营商IPv4网段数据
|
||||
└─dns #已知v4 dns
|
||||
```
|
||||
|
||||
### 原理
|
||||
|
||||
|
||||
|
||||
### 配置
|
||||
|
||||
#### 自建NS端
|
||||
|
||||

|
||||
|
||||
#### godaddy端
|
||||
|
||||

|
||||
|
||||
3
DNSv6/result/china/allv6dns.csv
Normal file
3
DNSv6/result/china/allv6dns.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8db10fe0868b210265cadfc885607c03de3b70323c21cd350b4c5113aad87be4
|
||||
size 90037
|
||||
|
3
DNSv6/result/china/forward/Allv6dns.pcap
Normal file
3
DNSv6/result/china/forward/Allv6dns.pcap
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aad73406bc157c7de98728e70862aabef110242fabaa1745bd07dd2746e33766
|
||||
size 390231878
|
||||
3
DNSv6/result/china/forward/allv6-address.csv
Normal file
3
DNSv6/result/china/forward/allv6-address.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:11dda37428083717e91bfef79c38d1bddfdbdb867b3b56519e891c5cdd7e2c3a
|
||||
size 286315
|
||||
|
3
DNSv6/result/china/forward/res-1.csv
Normal file
3
DNSv6/result/china/forward/res-1.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:39a04b88100a61ddf42a41481cebab2549e6cc902774987da60b5bc09cc6016b
|
||||
size 18903728
|
||||
|
3
DNSv6/result/china/forward/res-2.csv
Normal file
3
DNSv6/result/china/forward/res-2.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4b6e478064c402803a7001197c24e5ea12ad561fe379bfd9792a4176b89be973
|
||||
size 18903728
|
||||
|
3
DNSv6/result/china/forward/res-3.csv
Normal file
3
DNSv6/result/china/forward/res-3.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c3d2d29c0daa9e2a7340d37d837d65442fa53781f03f3a4146e5a19191592649
|
||||
size 18903728
|
||||
|
3
DNSv6/result/china/forward/res-4.csv
Normal file
3
DNSv6/result/china/forward/res-4.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d4c55429f1611df000fefbf321852c175f5deeee5ab0049c24ed04b9989b6f34
|
||||
size 18903728
|
||||
|
3
DNSv6/result/china/forward/res-5.csv
Normal file
3
DNSv6/result/china/forward/res-5.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3b0df54d837eee7cf3a1fb03ab54cd1a072f2f44763d9aaebfa6df8db28039f2
|
||||
size 18903728
|
||||
|
3
DNSv6/result/china/gkdg/20220401-OR-ch_v6.pcap
Normal file
3
DNSv6/result/china/gkdg/20220401-OR-ch_v6.pcap
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:976ab6a95ee8fcc1ce0f3488542681e8743eb9e4e7df7f0aa36f5864c38ed3c5
|
||||
size 685566
|
||||
3
DNSv6/result/china/gkdg/rdns-1.csv
Normal file
3
DNSv6/result/china/gkdg/rdns-1.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:559f21c923ecd000065c18187f01f7763883c62a374545d293ffead7a43932ea
|
||||
size 80110
|
||||
|
3
DNSv6/result/china/gkdg/rdns-2.csv
Normal file
3
DNSv6/result/china/gkdg/rdns-2.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bf9a2daa1810cd9645737530b306a28b5d4ea9510a0d13629c6a58d78b659ec3
|
||||
size 80110
|
||||
|
3
DNSv6/result/china/gkdg/rdns-3.csv
Normal file
3
DNSv6/result/china/gkdg/rdns-3.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b08821bb3d4e58ff8b1f619f2aad87f615df04e9a394ece9718939e6c12e2712
|
||||
size 80110
|
||||
|
3
DNSv6/result/china/gkdg/rdns-4.csv
Normal file
3
DNSv6/result/china/gkdg/rdns-4.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:260216ea35f7a4f14d90dd6f617331f37ffbf50e50125c52c845b4be00fd72cc
|
||||
size 80110
|
||||
|
3
DNSv6/result/china/gkdg/rdns-5.csv
Normal file
3
DNSv6/result/china/gkdg/rdns-5.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7124c588bd4210a8dd2a02b81411dc9b46ef7fc72e8921935a6a98fecba4364b
|
||||
size 80110
|
||||
|
3
DNSv6/result/china/gkdg/v6dns.csv
Normal file
3
DNSv6/result/china/gkdg/v6dns.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0965522b8685befb3ba5bef5eb4a99a0e08a0c6cf1a02d76b7c01786a7af4212
|
||||
size 39175
|
||||
|
3
DNSv6/result/china/jjdg/20220401-IR-ch_v6.pcap
Normal file
3
DNSv6/result/china/jjdg/20220401-IR-ch_v6.pcap
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1449fb680f91609be49bcc85cd5d8fe94922cdc82c62e9087f0eaf16fbbb17a5
|
||||
size 144906
|
||||
3
DNSv6/result/china/jjdg/rdns-1.csv
Normal file
3
DNSv6/result/china/jjdg/rdns-1.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5be788e7ab415b82a41adaea14874183b14db10aade4d5b7abfe1e2db23defa5
|
||||
size 107407
|
||||
|
3
DNSv6/result/china/jjdg/rdns-2.csv
Normal file
3
DNSv6/result/china/jjdg/rdns-2.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:256df35e84ef30fb21e4f5f81f315715ed4aeac694d17e13d5aa195e212268cc
|
||||
size 107407
|
||||
|
3
DNSv6/result/china/jjdg/rdns-3.csv
Normal file
3
DNSv6/result/china/jjdg/rdns-3.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:03ef11ce72f50841cb2a46d26473d1604a13ade41f6c7bee98e3b39410ec84f2
|
||||
size 107407
|
||||
|
3
DNSv6/result/china/jjdg/rdns-4.csv
Normal file
3
DNSv6/result/china/jjdg/rdns-4.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9c43fa7fc18897bb2573f2558fdfbadb361435958eac94fe63466a53d9467d21
|
||||
size 107407
|
||||
|
3
DNSv6/result/china/jjdg/rdns-5.csv
Normal file
3
DNSv6/result/china/jjdg/rdns-5.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:66ff3e9df2b02cc4f18f521dd2dba7ff1e3225e05f43135414e7add68cce965d
|
||||
size 107407
|
||||
|
3
DNSv6/result/china/jjdg/v6dns.csv
Normal file
3
DNSv6/result/china/jjdg/v6dns.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5cbeaf443756fd60e151da461595f19281e361c3a2b06d5408a6dcc7b75bf1ab
|
||||
size 9473
|
||||
|
3
DNSv6/result/china/zjxy/20220401-DR-ch_v6.pcap
Normal file
3
DNSv6/result/china/zjxy/20220401-DR-ch_v6.pcap
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b72992a643af3dc0e72ff0992550732f2280de6de082a5701cef990e141e6fba
|
||||
size 147401
|
||||
3
DNSv6/result/china/zjxy/rdns-1.csv
Normal file
3
DNSv6/result/china/zjxy/rdns-1.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ef74027f8e4d7b464ca82187020768b184f6091dd2a6ef1dd5933c9c970e954d
|
||||
size 31587
|
||||
|
3
DNSv6/result/china/zjxy/rdns-2.csv
Normal file
3
DNSv6/result/china/zjxy/rdns-2.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:88582297fe0a20463a002984ea81e9d868d45d7f665f6d355553ed39dd7cd6d7
|
||||
size 31587
|
||||
|
3
DNSv6/result/china/zjxy/rdns-3.csv
Normal file
3
DNSv6/result/china/zjxy/rdns-3.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:88a3e7192e8a67cf18adb80e32596921844a8b4305fe816179461de5abbafe1f
|
||||
size 31587
|
||||
|
3
DNSv6/result/china/zjxy/rdns-4.csv
Normal file
3
DNSv6/result/china/zjxy/rdns-4.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c0b2c4f2d1d161971d3127fb1722457550ecf29225e269ae3e037022f4f54033
|
||||
size 31587
|
||||
|
3
DNSv6/result/china/zjxy/rdns-5.csv
Normal file
3
DNSv6/result/china/zjxy/rdns-5.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b23ae77b51b06c8b73d05069f23df7c526bcccb862aa1e009c5850c28dc60c73
|
||||
size 31587
|
||||
|
3
DNSv6/result/china/zjxy/v6dns.csv
Normal file
3
DNSv6/result/china/zjxy/v6dns.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:474277b8eb90a986fc6251fc28ceb4552c90ccafe9d56986362459deeb563be7
|
||||
size 11632
|
||||
|
BIN
DNSv6/src/china/全国-递归DNS测量结果.xlsx
Normal file
BIN
DNSv6/src/china/全国-递归DNS测量结果.xlsx
Normal file
Binary file not shown.
BIN
DNSv6/src/shandong/IPrange/山东电信.xlsx
Normal file
BIN
DNSv6/src/shandong/IPrange/山东电信.xlsx
Normal file
Binary file not shown.
BIN
DNSv6/src/shandong/IPrange/山东移动.xlsx
Normal file
BIN
DNSv6/src/shandong/IPrange/山东移动.xlsx
Normal file
Binary file not shown.
BIN
DNSv6/src/shandong/IPrange/山东联通.xlsx
Normal file
BIN
DNSv6/src/shandong/IPrange/山东联通.xlsx
Normal file
Binary file not shown.
3
DNSv6/src/shandong/dns/853-shandong.csv
Normal file
3
DNSv6/src/shandong/dns/853-shandong.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:44d48c187a3b433539040669c65008d876adb3ae13b0cc72111a708e57d7c203
|
||||
size 36150
|
||||
|
3
DNSv6/src/shandong/dns/rdns-shandong.csv
Normal file
3
DNSv6/src/shandong/dns/rdns-shandong.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:514cdca439bd9660ec8bde7ded09601e38ffa630edd3853565ce8d4646848105
|
||||
size 677892
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
20306
in2e_g.json
Normal file
20306
in2e_g.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user