diff --git a/.breakpoints b/.breakpoints index 9c0c6a5..d38a946 100644 --- a/.breakpoints +++ b/.breakpoints @@ -4,7 +4,7 @@ { "id": "0e650fa4-e0c0-491d-8fb7-30fe08386e78", "line": 27, - "version": 1863, + "version": 1866, "index": 764 } ] diff --git a/gh-domains.txt b/gh-domains.txt deleted file mode 100644 index a3c3aa8..0000000 --- a/gh-domains.txt +++ /dev/null @@ -1,168 +0,0 @@ -shrekshao.github.io -dfine.tech -vzardlloo.github.io -rowkey.cn -blog.lui8.cn -toweave.github.io -dumplingbao.github.io -chai2010.cn -www.cnfeat.com -hawstein.com -www.barretlee.com -www.jeffjade.com -wsgzao.github.io -vivaxyblog.github.io -blog.forecho.com -www.yinwang.org -blog.xiayf.cn -jiongks.name -blog.devtang.com -colobu.com -feihu.me -blog.sunnyxx.com -xiangwangfeng.com -wwj718.github.io -blog.est.im -jaredtao.github.io -xiang578.com -jalan.space -nicksxs.me -www.capallen.top -alxddh.github.io -thinkhard.tech -charlesliuyx.github.io -blog.xulihang.me -102no.com -article.mebtte.com -blog.joouis.com -blog.hanschen.site -iphysresearch.github.io -desvl.xyz -lucifer.ren -anran758.github.io -jyzhu.top -zofun.github.io -gyl-coder.top -amonxu.com -www.vincentqin.tech -blog.hbsun.top -lianyongxing.github.io -objcoding.com -claude-ray.github.io -iphyer.github.io -wukaikai.tech -jiayuanzhang.com -www.965.one -www.taoweng.site -zdyxry.github.io -shen.bioitee.com -blog.guowenfh.com -huiweishijie.com -www.itrhx.com -xiaophy.com -michael728.github.io -fengxu.ink -scottyeung.top -www.larscheng.com -mazhuang.org -hijiangtao.github.io -yuechuanx.top -z.arlmy.me -typeblog.net -jhuo.ca -blog.mikeoperfect.com -notlsd.github.io -beijiu.ink -seis-jun.xyz -jw1.dev -jartto.wang -knightyun.github.io -www.yangzhiping.com -www.guyu.me -lulalap.com -chinomars.github.io -weirane.github.io -blog.joway.io -mabbs.github.io -earture.org -blog.vvzero.com -sund.site -tomotoes.com -thewanderingpotato.github.io -emuqi.github.io -ai.renyuzhuo.cn -jayzangwill.github.io -yanhang.me -frost-lee.github.io -kerminate.me -blog.chungzh.cn -lineuman.github.io -zsqk.github.io -blog.gavln.com -twistoy.com -cyril3.github.io -mutoo.im -ddadaal.me -luyuhuang.github.io -blog.xiaket.org -jingyig.com -leonson.me -blog.yangyk.com -amamiyayuko-ef.github.io -lhymwm.github.io -ngzhio.github.io -painso.com -diego.plus -mountaye.github.io -kubesphereio.com -geekplayers.com -ambroseren.github.io -tingfei.space -bubuzou.com -jasonkayzk.github.io -muyunyun.cn -www.androidperformance.com -timemachine.icu -blog.kuangjux.top -lyunvy.tk -fantalovelife.club -saulnoble.github.io -wushuo.ink -robotkang.cc -zhurongshuo.com -wangjiezhe.com -phuker.github.io -cyberve.top -zhangyet.github.io -aidaip.github.io -blog.murphyyi.com -blog.whuzfb.cn -zivlog.io -frankorz.com -noionion.top -zeqiang.fun -blog.jinreal.com -mengtnt.com -surager.pub -lumitytw.github.io -vim0.com -sanzo.top -blog.quarticcat.com -zkpeace.com -weepingdogel.github.io -ioerr.github.io -f2h2h1.github.io -www.4async.com -aemoncao.github.io -marwin.cn -acmic.top -dianjiaogit.github.io -www.zhukang.tech -itgoyo.github.io -www.imaegoo.com -gtdstudy.com -www.jiayuehua.com -github.com -ilovey.live -www.linchangyu.com -www.puronglong.com diff --git a/main.py b/main.py index fcd6f00..9a97617 100644 --- a/main.py +++ b/main.py @@ -1,15 +1,8 @@ import socket import os -import urllib.request import urllib.parse num = 1 -try: - githubip = urllib.request.urlopen('https://api.github.com/meta') - githubip = str(githubip.read()) -except: - print('无法访问GitHub-API,请检查网络。') - try: os.system("wget https://github.com/timqian/chinese-independent-blogs/raw/master/blogs-original.csv -O ./blogs-original.csv") with open('blogs-original.csv', 'r') as f: @@ -28,13 +21,19 @@ else: res = urllib.parse.urlparse(line[1]) domain = res.netloc try: - ip = socket.gethostbyname(domain) - ip = ip.split('.') - ip_head = ip[0]+'.'+ip[1]+'.'+ip[2] - isfind = githubip.find(ip_head) - if isfind != -1 : + target_host = domain + target_port = 80 + client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + client.connect((target_host,target_port)) + request = "GET / HTTP/1.1\r\nHost:%s\r\n\r\n" % target_host + client.send(request.encode()) + response = client.recv(4096) + http_response = repr(response) + http_response_len = len(http_response) + if str(response).find('Server: GitHub.com') != -1 : f.write(domain+"\n") - print(domain+" 是GH-Pages!") + print(domain+" is on GH-Pages!") except: continue - os.system("rm blogs-original.csv -rf") \ No newline at end of file + +os.system("rm blogs-original.csv -rf") \ No newline at end of file diff --git a/single-check.py b/single-check.py index ce2f821..13450e0 100644 --- a/single-check.py +++ b/single-check.py @@ -1,26 +1,17 @@ import socket -import urllib.request -import urllib.parse +import os -try: - githubip = urllib.request.urlopen('https://api.github.com/meta') - githubip = str(githubip.read()) -except: - print('无法访问GitHub-API,请检查网络。') -else: - print('请输入域名/链接') - line = input() - line = line.replace(" ", "") - res = urllib.parse.urlparse(line) - domain = res.netloc - try: - ip = socket.gethostbyname(domain) - ip = ip.split('.') - ip_head = ip[0]+'.'+ip[1]+'.'+ip[2] - isfind = githubip.find(ip_head) - if isfind != -1 : - print(domain+" 是GH-Pages!") - else: - print(domain+" 不是GH-Pages!") - except: - print('错误: DNS无法解析或其它问题。') \ No newline at end of file +print('Please input domain:) +domain = input() +target_host = domain +target_port = 80 +client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +client.connect((target_host,target_port)) +request = "GET / HTTP/1.1\r\nHost:%s\r\n\r\n" % target_host +client.send(request.encode()) +response = client.recv(4096) +http_response = repr(response) +http_response_len = len(http_response) +if str(response).find('Server: GitHub.com') != -1 : + f.write(domain+"\n") + print(domain+" is on GH-Pages!") \ No newline at end of file