9 Commits

Author SHA1 Message Date
HDK
6ae3e6eefd 取消LFS缓存 2022-04-20 20:30:53 +08:00
HDK
7880bc1623 Merge branch 'develop' of https://git.mesalab.cn/zhuyujia/diamondv 2022-04-20 19:55:37 +08:00
Baiyang Li
3bea4087f6 upload corresonding egress servers 2022-04-20 15:46:52 +08:00
韩丁康
d4274ffaa1 新增汇总的所有从NS端发现的IPv6地址集 2022-04-18 20:55:17 +08:00
韩丁康
eecdbcafb1 新增 NS端pcap结果以及探针发送结果 2022-04-18 17:25:14 +08:00
韩丁康
6002f3c16b 新增 .gitattributes文件,csv、pcap文件使用git lfs存储 2022-04-18 17:24:52 +08:00
韩丁康
cb22d3d7ce 新增 全国/山东 v4dns相关文件 2022-04-18 17:23:33 +08:00
韩丁康
479ddef2a7 新增DNSv6 说明 2022-04-18 17:21:17 +08:00
韩丁康
0acd839507 DNSv6 代码及说明 2022-04-18 16:55:57 +08:00
45 changed files with 20579 additions and 0 deletions

0
.gitattributes vendored Normal file
View File

9
DNSv6/Code/README.md Normal file
View 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
View 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
View 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)

View 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
View 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]):

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

33
DNSv6/README.md Normal file
View 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端
![自建NS端配置](README.assets/自建NS端配置.png)
#### godaddy端
![Godaddy NS配置](README.assets/Godaddy NS配置.png)

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8db10fe0868b210265cadfc885607c03de3b70323c21cd350b4c5113aad87be4
size 90037
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:8db10fe0868b210265cadfc885607c03de3b70323c21cd350b4c5113aad87be4
3 size 90037

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aad73406bc157c7de98728e70862aabef110242fabaa1745bd07dd2746e33766
size 390231878

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:11dda37428083717e91bfef79c38d1bddfdbdb867b3b56519e891c5cdd7e2c3a
size 286315
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:11dda37428083717e91bfef79c38d1bddfdbdb867b3b56519e891c5cdd7e2c3a
3 size 286315

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:39a04b88100a61ddf42a41481cebab2549e6cc902774987da60b5bc09cc6016b
size 18903728
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:39a04b88100a61ddf42a41481cebab2549e6cc902774987da60b5bc09cc6016b
3 size 18903728

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b6e478064c402803a7001197c24e5ea12ad561fe379bfd9792a4176b89be973
size 18903728
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:4b6e478064c402803a7001197c24e5ea12ad561fe379bfd9792a4176b89be973
3 size 18903728

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c3d2d29c0daa9e2a7340d37d837d65442fa53781f03f3a4146e5a19191592649
size 18903728
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:c3d2d29c0daa9e2a7340d37d837d65442fa53781f03f3a4146e5a19191592649
3 size 18903728

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d4c55429f1611df000fefbf321852c175f5deeee5ab0049c24ed04b9989b6f34
size 18903728
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:d4c55429f1611df000fefbf321852c175f5deeee5ab0049c24ed04b9989b6f34
3 size 18903728

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3b0df54d837eee7cf3a1fb03ab54cd1a072f2f44763d9aaebfa6df8db28039f2
size 18903728
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:3b0df54d837eee7cf3a1fb03ab54cd1a072f2f44763d9aaebfa6df8db28039f2
3 size 18903728

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:976ab6a95ee8fcc1ce0f3488542681e8743eb9e4e7df7f0aa36f5864c38ed3c5
size 685566

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:559f21c923ecd000065c18187f01f7763883c62a374545d293ffead7a43932ea
size 80110
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:559f21c923ecd000065c18187f01f7763883c62a374545d293ffead7a43932ea
3 size 80110

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bf9a2daa1810cd9645737530b306a28b5d4ea9510a0d13629c6a58d78b659ec3
size 80110
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:bf9a2daa1810cd9645737530b306a28b5d4ea9510a0d13629c6a58d78b659ec3
3 size 80110

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b08821bb3d4e58ff8b1f619f2aad87f615df04e9a394ece9718939e6c12e2712
size 80110
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:b08821bb3d4e58ff8b1f619f2aad87f615df04e9a394ece9718939e6c12e2712
3 size 80110

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:260216ea35f7a4f14d90dd6f617331f37ffbf50e50125c52c845b4be00fd72cc
size 80110
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:260216ea35f7a4f14d90dd6f617331f37ffbf50e50125c52c845b4be00fd72cc
3 size 80110

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7124c588bd4210a8dd2a02b81411dc9b46ef7fc72e8921935a6a98fecba4364b
size 80110
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:7124c588bd4210a8dd2a02b81411dc9b46ef7fc72e8921935a6a98fecba4364b
3 size 80110

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0965522b8685befb3ba5bef5eb4a99a0e08a0c6cf1a02d76b7c01786a7af4212
size 39175
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:0965522b8685befb3ba5bef5eb4a99a0e08a0c6cf1a02d76b7c01786a7af4212
3 size 39175

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1449fb680f91609be49bcc85cd5d8fe94922cdc82c62e9087f0eaf16fbbb17a5
size 144906

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5be788e7ab415b82a41adaea14874183b14db10aade4d5b7abfe1e2db23defa5
size 107407
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:5be788e7ab415b82a41adaea14874183b14db10aade4d5b7abfe1e2db23defa5
3 size 107407

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:256df35e84ef30fb21e4f5f81f315715ed4aeac694d17e13d5aa195e212268cc
size 107407
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:256df35e84ef30fb21e4f5f81f315715ed4aeac694d17e13d5aa195e212268cc
3 size 107407

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03ef11ce72f50841cb2a46d26473d1604a13ade41f6c7bee98e3b39410ec84f2
size 107407
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:03ef11ce72f50841cb2a46d26473d1604a13ade41f6c7bee98e3b39410ec84f2
3 size 107407

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c43fa7fc18897bb2573f2558fdfbadb361435958eac94fe63466a53d9467d21
size 107407
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:9c43fa7fc18897bb2573f2558fdfbadb361435958eac94fe63466a53d9467d21
3 size 107407

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66ff3e9df2b02cc4f18f521dd2dba7ff1e3225e05f43135414e7add68cce965d
size 107407
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:66ff3e9df2b02cc4f18f521dd2dba7ff1e3225e05f43135414e7add68cce965d
3 size 107407

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5cbeaf443756fd60e151da461595f19281e361c3a2b06d5408a6dcc7b75bf1ab
size 9473
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:5cbeaf443756fd60e151da461595f19281e361c3a2b06d5408a6dcc7b75bf1ab
3 size 9473

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b72992a643af3dc0e72ff0992550732f2280de6de082a5701cef990e141e6fba
size 147401

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ef74027f8e4d7b464ca82187020768b184f6091dd2a6ef1dd5933c9c970e954d
size 31587
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:ef74027f8e4d7b464ca82187020768b184f6091dd2a6ef1dd5933c9c970e954d
3 size 31587

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88582297fe0a20463a002984ea81e9d868d45d7f665f6d355553ed39dd7cd6d7
size 31587
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:88582297fe0a20463a002984ea81e9d868d45d7f665f6d355553ed39dd7cd6d7
3 size 31587

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88a3e7192e8a67cf18adb80e32596921844a8b4305fe816179461de5abbafe1f
size 31587
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:88a3e7192e8a67cf18adb80e32596921844a8b4305fe816179461de5abbafe1f
3 size 31587

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c0b2c4f2d1d161971d3127fb1722457550ecf29225e269ae3e037022f4f54033
size 31587
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:c0b2c4f2d1d161971d3127fb1722457550ecf29225e269ae3e037022f4f54033
3 size 31587

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b23ae77b51b06c8b73d05069f23df7c526bcccb862aa1e009c5850c28dc60c73
size 31587
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:b23ae77b51b06c8b73d05069f23df7c526bcccb862aa1e009c5850c28dc60c73
3 size 31587

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:474277b8eb90a986fc6251fc28ceb4552c90ccafe9d56986362459deeb563be7
size 11632
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:474277b8eb90a986fc6251fc28ceb4552c90ccafe9d56986362459deeb563be7
3 size 11632

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:44d48c187a3b433539040669c65008d876adb3ae13b0cc72111a708e57d7c203
size 36150
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:44d48c187a3b433539040669c65008d876adb3ae13b0cc72111a708e57d7c203
3 size 36150

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:514cdca439bd9660ec8bde7ded09601e38ffa630edd3853565ce8d4646848105
size 677892
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:514cdca439bd9660ec8bde7ded09601e38ffa630edd3853565ce8d4646848105
3 size 677892

20306
in2e_g.json Normal file

File diff suppressed because it is too large Load Diff