关于IPV6DNS,基本上IPV6是相当难封的,特别是部分封时,相当有难度。
全封當然是撥電源就可以了,但這不現實。
基本可以確認,國外知名DNS全被攔截了。
現在對IPV6主要是在DNS上,我用過很多方法,也用過很多網IPV6地址的DNS結果,這些DNS服務器所找不到google的ipv6地址。太假了。是暗協議,還是DNS攔截?
對付這個用遠程DNS是一種方法,但會減慢網速。用本地DNS吧。但google的可用ipv6地址是在變的,因為封,所以變。這就要更新。用遠程DNS是一種好方法。但因為DNS攔截,所有對比較有名的網站的DNS訪問都會被代替。不過我找到了一些網上可以查找IPV6地址的。因為走的不是DNS報文,而HTTPS報文,所以還是可用的。
用它,加上以前的google的hosts文件,自已寫個代碼,更新google的ipv6地址吧。路由器中的DNS設置就還有114吧,這個速度快。先找hosts再找114,足用了。
google的DNS服務8.8.8.8找到的ipv 地址是根據記問的IP然后給出的最快的google 服務器地址。同樣的域名,地址可能我很多。最近google好擬把它的服務配成了,直接通過IPV6不可訪問。只有通過域名才可以。
最近google地地址又換封鎖了一批,自已寫的從網頁上下ipv6的python代碼是收集了一把IPV6地址,都能ping通。但youtube還是訪問不了。個別地址,從這個網頁上找不到IPV6。直接給個python2。7的代碼吧。因為是有go-agent開始用python的,所以只用2。7主 3以上的不相容。代碼是把我以前寫的下載m3u8直播地址的東西改的。
需要注意的是:
'Accept-Encoding': 'deflate, br',
deflate,chrome是能解gzip格式的,python就不要這樣了,用deflate,要不返回內容亂碼。我本以為這個網頁要什么cookie之類的。結果代碼比登錄代碼簡單多了。只是這個網站訪問多了會封IP,這個網站還好只能是ipv4的,個人用戶同,撥號上網,封ipv4,沒大影響。看上去對google的ipv6訪問架構還是不太了解,或者封網封住要害了,能ping通,youtube就是不可用。最怪的是,電腦與手機,有時google也連不上。導向式快封嗎?封youtube我還能理解,要是google也封了,現在的好多android 開始,不連網玩不了啊。
調用方法如下。其中hosts文件 是主機文件,asc編碼,“IPV6地址 (空格) 域名”這樣的東西就是對其域名,在網頁上找對應的IPV6地址。代碼改了一上午,下午用新的IPV6地址試了一下,google沒什么問題,youtube上不了。主頁能打開,沒圖片或者沒視頻。關聯的IPV6地址不可有。具體是什么地址,我沒找出來,對youtube我應用上不是特別需要。有了更好,沒了也不想花太長時間。有誰知道原因的話,給留一下言。
>python (下面的py文件名)? ?(hosts文件名)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# coding:utf-8
# ?tvtest.py
# ?測試m3u8的可下載性,基本的直播可用性測試。
# ?Copyright 2018 ququ
import datetime
import sys
import urllib
import urllib2
import urlparse
import time
import os
import re
import pprint
import json
from pyquery import PyQuery as pq
?? ??? ??? ??? ??? ??? ?
headers = {
?? ??? ??? ?'Host': 'mxtoolbox.com',
?? ??? ??? ?'Origin': 'https://mxtoolbox.com',
?? ??? ??? ?'X-Requested-With': 'XMLHttpRequest',
?? ??? ??? ?'MasterTempAuthorization': 'f67aac26-fe12-4a9c-b1c2-771db0816033',
?? ??? ??? ?'Content-Type': 'application/json; charset=UTF-8',
?? ??? ??? ?'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36',
?? ??? ??? ?'Accept': 'application/json, text/javascript, */*; q=0.01',
?? ??? ??? ?'Accept-Encoding': 'deflate, br',
?? ??? ??? ?'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
?? ??? ??? ?'Cookie': ''
?? ??? ??? ?}
#urlDNSlookup 是在線DNS網站,沒事可以自已多找找然后按網站返回數據改代碼。
urlDNSlookup='https://mxtoolbox.com/Public/Lookup.aspx/DoLookup2'
def gethosts():
?? ??? ?if len(sys.argv) != 2:
?? ??? ??? ?print("arg error, " + sys.argv[0] + " input hosts file"); ?
?? ??? ??? ?exit(1)
?? ??? ?input_file = sys.argv[1];
?? ??? ?hinFile = open(input_file,"r+");?
?? ??? ?print ('get ipv6 for the hosts in '+input_file )
?? ??? ?output_file=input_file+"-new"
?? ??? ?error_file=input_file+"-err"
?? ??? ?houtFile = open(output_file, "w")
?? ??? ?herrorFile = open(error_file, "w")
?? ??? ?
?? ??? ?L=0
?? ??? ?FileList = hinFile.readlines()
?? ??? ?FileList2=[]
?? ??? ?for Line0 in FileList:
?? ??? ??? ?if Line0[0]!='#' and len(Line0) >2:
?? ??? ??? ??? ?position = Line0.index(' ')
?? ??? ??? ??? ?Line1 = Line0[position:]
?? ??? ??? ??? ?#print(position)
?? ??? ??? ??? ?position2 = Line1.find('#')
?? ??? ??? ??? ?#print(position2)
?? ??? ??? ??? ?if position2 > 0:
?? ??? ??? ??? ??? ?strhost = Line1[1:position2-1]
?? ??? ??? ??? ?else:
?? ??? ??? ??? ??? ?strhost = Line1[1:len(Line1)-1]
?? ??? ??? ??? ?#print("the host is: %s: " +strhost)
?? ??? ??? ??? ?url = urlDNSlookup
?? ??? ??? ??? ?dataraw ='{"inputText":"aaaa:'+strhost+'","resultIndex":4}'
?? ??? ??? ??? ?#data = urllib.urlencode(dataraw)
?? ??? ??? ??? ?print(dataraw)
?? ??? ??? ??? ?#print(data)
?? ??? ??? ??? ?try:
?? ??? ??? ??? ??? ?#response = urllib2.urlopen('https://mxtoolbox.com/')
?? ??? ??? ??? ??? ?request = urllib2.Request(url, data=dataraw, headers = headers)
?? ??? ??? ??? ??? ?#request = urllib2.Request(url,headers = headers)
?? ??? ??? ??? ??? ?response = urllib2.urlopen(request)
?? ??? ??? ??? ??? ?text = response.read()
?? ??? ??? ??? ??? ?#text = unicode(response.read(),"utf-8")
?? ??? ??? ??? ??? ?#找tAAAA\\t?? ?
?? ??? ??? ??? ??? ?p1 = text.find("AAAA\\\\t")
?? ??? ??? ??? ??? ?if p1 > 0:
?? ??? ??? ??? ??? ??? ?p2 = text.find(",",p1)
?? ??? ??? ??? ??? ??? ?stripv6=text[p1+7:p2]
?? ??? ??? ??? ??? ??? ?Lineout=stripv6+' '+strhost+'\n'
?? ??? ??? ??? ??? ??? ?houtFile.writelines(Lineout)
?? ??? ??? ??? ??? ?else:
?? ??? ??? ??? ??? ??? ?stripv6="error"
?? ??? ??? ??? ??? ??? ?Lineout=stripv6+' '+strhost+'\n'
?? ??? ??? ??? ??? ??? ?herrorFile.writelines(Lineout)
?? ??? ??? ??? ??? ?print(Lineout)?? ??? ??? ??? ??? ?
?? ??? ??? ??? ?except urllib2.URLError as e:
?? ??? ??? ??? ??? ?print "Error: %s, url: %s" % (e,url)
?? ??? ?herrorFile.close()
?? ??? ?houtFile.close()
?? ??? ?hinFile.close()
?? ??? ?print('done\n')
?? ??? ?
if __name__ == '__main__':
? ? gethosts()
?
總結
以上是生活随笔為你收集整理的关于IPV6DNS,基本上IPV6是相当难封的,特别是部分封时,相当有难度。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 硬盘的接口、协议
- 下一篇: 关于tomcat开启gzip的配置