From cb3bff499d5cea8ee286ff9dd0100635497d13f2 Mon Sep 17 00:00:00 2001 From: ahdoawhfo Date: Mon, 19 Aug 2024 12:05:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E7=89=88=E6=9C=AC=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81Actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/daily_domain_check.yml | 39 ++ .gitea/workflows | 0 DICT | 702 ++++++++++++++++++++++++++++++++++ DOMAINS | 1 + TLD_DATA | 211 ++++++++++ domain_check.py | 141 +++++++ 6 files changed, 1094 insertions(+) create mode 100644 .gitea/daily_domain_check.yml create mode 100644 .gitea/workflows create mode 100644 DICT create mode 100644 DOMAINS create mode 100644 TLD_DATA create mode 100644 domain_check.py diff --git a/.gitea/daily_domain_check.yml b/.gitea/daily_domain_check.yml new file mode 100644 index 0000000..22b8985 --- /dev/null +++ b/.gitea/daily_domain_check.yml @@ -0,0 +1,39 @@ +name: Daily Domain Check + +on: + schedule: + - cron: "0 0 * * *" # Runs daily at midnight + workflow_dispatch: + +jobs: + domain_check: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + # Add any other dependencies your script needs here + + - name: Run domain check + run: python domain_check.py + + - name: Save output with date + run: | + today=$(date +%Y-%m-%d) + mv domain.txt "domain_$today.txt" + + - name: Create release and upload result + run: | + today=$(date +%Y-%m-%d) + gitea release create --title "Domain Check $today" --assets "domain_$today.txt" + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} diff --git a/.gitea/workflows b/.gitea/workflows new file mode 100644 index 0000000..e69de29 diff --git a/DICT b/DICT new file mode 100644 index 0000000..62e37e0 --- /dev/null +++ b/DICT @@ -0,0 +1,702 @@ +# a +# b +# c +# d +# e +# f +# g +# h +# i +# j +# k +# l +# m +# n +# o +# p +# q +# r +# s +# t +# u +# v +# w +# x +# y +# z +aa +ab +ac +ad +ae +af +ag +ah +ai +aj +ak +al +am +an +ao +ap +aq +ar +as +at +au +av +aw +ax +ay +az +ba +bb +bc +bd +be +bf +bg +bh +bi +bj +bk +bl +bm +bn +bo +bp +bq +br +bs +bt +bu +bv +bw +bx +by +bz +ca +cb +cc +cd +ce +cf +cg +ch +ci +cj +ck +cl +cm +cn +co +cp +cq +cr +cs +ct +cu +cv +cw +cx +cy +cz +da +db +dc +dd +de +df +dg +dh +di +dj +dk +dl +dm +dn +do +dp +dq +dr +ds +dt +du +dv +dw +dx +dy +dz +ea +eb +ec +ed +ee +ef +eg +eh +ei +ej +ek +el +em +en +eo +ep +eq +er +es +et +eu +ev +ew +ex +ey +ez +fa +fb +fc +fd +fe +ff +fg +fh +fi +fj +fk +fl +fm +fn +fo +fp +fq +fr +fs +ft +fu +fv +fw +fx +fy +fz +ga +gb +gc +gd +ge +gf +gg +gh +gi +gj +gk +gl +gm +gn +go +gp +gq +gr +gs +gt +gu +gv +gw +gx +gy +gz +ha +hb +hc +hd +he +hf +hg +hh +hi +hj +hk +hl +hm +hn +ho +hp +hq +hr +hs +ht +hu +hv +hw +hx +hy +hz +ia +ib +ic +id +ie +if +ig +ih +ii +ij +ik +il +im +in +io +ip +iq +ir +is +it +iu +iv +iw +ix +iy +iz +ja +jb +jc +jd +je +jf +jg +jh +ji +jj +jk +jl +jm +jn +jo +jp +jq +jr +js +jt +ju +jv +jw +jx +jy +jz +ka +kb +kc +kd +ke +kf +kg +kh +ki +kj +kk +kl +km +kn +ko +kp +kq +kr +ks +kt +ku +kv +kw +kx +ky +kz +la +lb +lc +ld +le +lf +lg +lh +li +lj +lk +ll +lm +ln +lo +lp +lq +lr +ls +lt +lu +lv +lw +lx +ly +lz +ma +mb +mc +md +me +mf +mg +mh +mi +mj +mk +ml +mm +mn +mo +mp +mq +mr +ms +mt +mu +mv +mw +mx +my +mz +na +nb +nc +nd +ne +nf +ng +nh +ni +nj +nk +nl +nm +nn +no +np +nq +nr +ns +nt +nu +nv +nw +nx +ny +nz +oa +ob +oc +od +oe +of +og +oh +oi +oj +ok +ol +om +on +oo +op +oq +or +os +ot +ou +ov +ow +ox +oy +oz +pa +pb +pc +pd +pe +pf +pg +ph +pi +pj +pk +pl +pm +pn +po +pp +pq +pr +ps +pt +pu +pv +pw +px +py +pz +qa +qb +qc +qd +qe +qf +qg +qh +qi +qj +qk +ql +qm +qn +qo +qp +qq +qr +qs +qt +qu +qv +qw +qx +qy +qz +ra +rb +rc +rd +re +rf +rg +rh +ri +rj +rk +rl +rm +rn +ro +rp +rq +rr +rs +rt +ru +rv +rw +rx +ry +rz +sa +sb +sc +sd +se +sf +sg +sh +si +sj +sk +sl +sm +sn +so +sp +sq +sr +ss +st +su +sv +sw +sx +sy +sz +ta +tb +tc +td +te +tf +tg +th +ti +tj +tk +tl +tm +tn +to +tp +tq +tr +ts +tt +tu +tv +tw +tx +ty +tz +ua +ub +uc +ud +ue +uf +ug +uh +ui +uj +uk +ul +um +un +uo +up +uq +ur +us +ut +uu +uv +uw +ux +uy +uz +va +vb +vc +vd +ve +vf +vg +vh +vi +vj +vk +vl +vm +vn +vo +vp +vq +vr +vs +vt +vu +vv +vw +vx +vy +vz +wa +wb +wc +wd +we +wf +wg +wh +wi +wj +wk +wl +wm +wn +wo +wp +wq +wr +ws +wt +wu +wv +ww +wx +wy +wz +xa +xb +xc +xd +xe +xf +xg +xh +xi +xj +xk +xl +xm +xn +xo +xp +xq +xr +xs +xt +xu +xv +xw +xx +xy +xz +ya +yb +yc +yd +ye +yf +yg +yh +yi +yj +yk +yl +ym +yn +yo +yp +yq +yr +ys +yt +yu +yv +yw +yx +yy +yz +za +zb +zc +zd +ze +zf +zg +zh +zi +zj +zk +zl +zm +zn +zo +zp +zq +zr +zs +zt +zu +zv +zw +zx +zy +zz \ No newline at end of file diff --git a/DOMAINS b/DOMAINS new file mode 100644 index 0000000..bc41c37 --- /dev/null +++ b/DOMAINS @@ -0,0 +1 @@ +am cm im bi ci ge lv at by cl cx cz de fi gd gs lc lt lu mk nu nz pw ro rs ru si su vg ws gy st qa moe cyou hair \ No newline at end of file diff --git a/TLD_DATA b/TLD_DATA new file mode 100644 index 0000000..47a2086 --- /dev/null +++ b/TLD_DATA @@ -0,0 +1,211 @@ +=Edited and Archived by Har-Kuun = (https://qing.su) +com=whois.verisign-grs.com=No match for= +edu=whois.verisign-grs.com=No match for= +net=whois.verisign-grs.com=No match for= +//ad=whois.ripe.net=o entries found= +ae=whois.aeda.net.ae=No Data Found= +af=whois.nic.af=No Object Found= +ag=whois.nic.ag=NOT FOUND= +am=whois.amnic.net=o match= +as=whois.nic.as=NOT FOUND= +at=whois.nic.at=othing found= +au=whois.audns.net.au=No Data Found= +be=whois.dns.be=AVAILABLE= +ai=whois.ai=not registered= +ar=whois.nic.ar=dominio no se= +aw=whois.nic.aw=is free= +ax=whois.ax=Domain not found= +//al=whois.ripe.net=No entries found= +//az=whois.ripe.net=No entries found= +//ba=whois.ripe.net=No entries found= +bg=whois.register.bg=does not exist in database= +bi=whois1.nic.bi=No Object Found= +bingo=whois.donuts.co=Domain not found= +bio=whois.ksregistry.net=bject does not exist= +biz=whois.nic.biz=ot found= +bj=whois.nic.bj=No Object Found= +bn=whois.bnnic.bn=Domain Not Found= +br=whois.nic.br=o match for= +buy=whois.afilias-srs.net=NOT FOUND= +buzz=whois.nic.buzz=vailable= +bw=whois.nic.net.bw=No Object Found= +bz=whois.afilias-grs.info=NOT FOUND= +ca=whois.cira.ca=available= +cat=whois.nic.cat=o match= +cc=ccwhois.verisign-grs.com=No match for= +cd=whois.nic.cd=No Object Found= +cf=whois.dot.cf=not known= +ci=whois.nic.ci=No Object Found= +cl=whois.nic.cl=no existe= +cm=whois.netcom.cm=Not Registered= +cn=whois.cnnic.net.cn=No matching record= +co=whois.nic.co=Not found= +cool=whois.donuts.co=Domain not found= +cr=whois.nic.cr=No entries found= +cx=whois.nic.cx=No Object Found= +//cy=whois.ripe.net=No entries found= +cz=whois.nic.cz=o entries found= +de=whois.nic.de=Status: free= +dk=whois.dk-hostmaster.dk=o entries found= +dm=whois.nic.dm=ot found= +do=whois.nic.do=No Object Found= +dog=whois.donuts.co=Domain not found= +dz=whois.nic.dz=NO OBJECT FOUND= +ec=whois.nic.ec=Not Registered= +ee=whois.eenet.ee=not found= +email=whois.donuts.co=Domain not found= +eu=whois.eu=Status: AVAILABLE= +fi=whois.fi=ot found= +fj=whois.usp.ac.fj=ot found= +fm=whois.nic.fm=ot found= +fo=whois.nic.fo=No entries found= +fr=whois.nic.fr=o entries found= +//gb=whois.ripe.net=No entries found= +gd=whois.nic.gd=ot found= +//ge=whois.ripe.net=No entries found= +gg=whois.gg=NOT FOUND= +gi=whois2.afilias-grs.net=NOT FOUND= +gl=whois.nic.gl=No Object Found= +gov=whois.dotgov.gov=o match for= +gq=whois.dominio.gq=ot known= +gs=whois.nic.gs=No Object Found= +gy=whois.registry.gy=No Object Found= +hk=whois.hkirc.hk=has not been registered= +hm=whois.registry.hm=ot found= +hn=whois.nic.hn=No Object Found= +host=whois.nic.host=NOT FOUND= +hr=whois.dns.hr=o entries found= +ht=whois.nic.ht=No Object Found= +hu=whois.nic.hu=o match= +id=whois.pandi.or.id=NOT FOUND= +ie=whois.domainregistry.ie=Not Registered= +il=whois.isoc.org.il=o data was found= +im=whois.nic.im=ot found= +in=whois.inregistry.in=NOT FOUND= +info=whois.afilias.info=NOT FOUND= +int=whois.iana.org=this server does not have= +//io=whois.nic.io=available= +iq=whois.cmc.iq=No Object Found= +ir=whois.nic.ir=o entries found= +is=whois.isnic.is=o entries found= +it=whois.nic.it=AVAILABLE= +je=whois.je=NOT FOUND= +jp=whois.jprs.jp=No match= +ke=whois.kenic.or.ke=No Object Found= +kg=whois.domain.kg=ot found= +ki=whois.nic.ki=No Object Found= +kn=whois.nic.kn=No Object Found= +kr=whois.kr=ot found= +ky=whois.kyregistry.ky=vailable= +kz=whois.nic.kz=othing found= +la=whois.nic.la=DOMAIN NOT FOUND= +lc=whois2.afilias-grs.net=NOT FOUND= +//li=whois.nic.li=not have an entry= +lt=whois.domreg.lt=available= +lu=whois.dns.lu=o such domain= +lv=whois.nic.lv= free= +ly=whois.nic.ly=Not found= +ma=whois.iam.net.ma=No Object Found= +md=whois.nic.md=No match for= +me=whois.nic.me=NOT FOUND= +mg=whois.nic.mg=No Object Found= +mk=whois.marnet.mk=No entries found= +ml=whois.dot.ml=ot known= +//mm=whois.nic.mm=No domains matched= +mn=whois.nic.mn=NOT FOUND= +mo=whois.monic.mo=o match for= +mobi=whois.afilias.net=NOT FOUND= +moe=whois.nic.moe=available= +mom=whois.uniregistry.net=available= +ms=whois.nic.ms=No Object Found= +mu=whois.nic.mu=No Object Found= +mx=whois.mx=Object_Not_Found= +//my=whois.mynic.net.my=does not exist= +mz=whois.nic.mz=No Object Found= +na=whois.na-nic.com.na=No Object Found= +name=whois.nic.name=o match= +nc=whois.nc=o entries found= +nf=whois.nic.nf=No Object Found= +ng=whois.nic.net.ng=No Object Found= +nl=whois.domain-registry.nl=is free= +no=whois.norid.no=o match= +nu=whois.nic.nu=ot found= +nz=whois.srs.net.nz=220 Available= +co.nz=whois.srs.net.nz=220 Available= +om=whois.registry.om=No Data Found= +one=whois.nic.one=No Data Found= +ooo=whois.nic.ooo=o match for= +org=whois.publicinterestregistry.net=NOT FOUND= +ovh=whois-ovh.nic.fr=bject does not exist= +pe=kero.yachay.pe=No Object Found= +pet=whois.afilias.net=NOT FOUND= +pf=whois.registry.pf=Domain unknown= +pl=whois.dns.pl=No information available= +pm=whois.nic.pm=o entries found= +pr=whois.nic.pr=is not registered= +pro=whois.registrypro.pro=NOT FOUND= +ps=whois.pnina.ps=No Object Found= +pt=whois.dns.pt=o match= +pub=whois.unitedtld.com=ot found= +pw=whois.nic.pw=DOMAIN NOT FOUND= +qa=whois.registry.qa=No Data Found= +re=whois.nic.re=o entries found= +ro=whois.rotld.ro=o entries found= +rs=whois.rnids.rs=is not registered= +ru=whois.tcinet.ru=No entries found= +rw=whois.ricta.org.rw=No Object Found= +sa=whois.nic.net.sa=No Match= +sb=whois.nic.net.sb=No Object Found= +com.sb=whois.nic.net.sb=No Object Found= +//sc=whois.afilias-grs.net=ot found= +se=whois.nic.se=ot found= +sg=whois.nic.net.sg=Not Found= +com.sg=whois.nic.net.sg=Not Found= +//sh=whois.nic.sh=is available for purchase= +si=whois.arnes.si=o entries found= +site=whois.centralnic.com=NOT FOUND= +sk=whois.sk-nic.sk=ot found= +sl=whois.nic.sl=No Object Found= +sm=whois.nic.sm=No entries found= +sn=whois.nic.sn=NOT FOUND= +so=whois.nic.so=ot found= +st=whois.nic.st=o entries found= +su=whois.tcinet.ru=No entries found= +sx=whois.sx=o match for= +//sy=whois.tld.sy=No Object Found= +tc=whois.nic.tc=No Object Found= +tel=whois.nic.tel=No Domain= +tf=whois.nic.tf=o entries found= +tg=whois.nic.tg=NO OBJECT FOUND= +th=whois.thnic.co.th=o match for= +tk=whois.dot.tk=ot known= +tl=whois.nic.tl=No Object Found= +tm=whois.nic.tm=is available= +tn=whois.ati.tn=NO OBJECT FOUND= +to=whois.tonic.to=o match for= +top=whois.nic.top=bject does not exist= +tr=whois.nic.tr=Invalid input= +tv=tvwhois.verisign-grs.com=o match for= +tw=whois.twnic.net.tw=No Found= +tz=whois.tznic.or.tz=No entries found= +ua=whois.ua=o entries found= +ug=whois.co.ug=o entries found= +uk=whois.nic.uk=No match= +co.uk=whois.nic.uk=No match= +us=whois.nic.us=ot found= +uy=whois.nic.org.uy=o match for= +uz=whois.cctld.uz=ot found= +vc=whois2.afilias-grs.net=NOT FOUND= +ve=whois.nic.ve=o match for= +vg=whois.nic.vg=ot found= +vip=whois.nic.vip=has not been registered= +vu=vunic.vu=is not valid= +wang=whois.gtld.knet.cn=bject does not exist= +wf=whois.nic.wf=o entries found= +wiki=whois.nic.wiki=NOT FOUND= +win=whois.nic.win=vailable= +ws=whois.name.com=NO DOMAIN= +xin=whois.nic.xin=NOT FOUND= +xyz=whois.nic.xyz=NOT FOUND= +yt=whois.nic.yt=o entries found= +zm=whois.nic.zm=No Object Found= diff --git a/domain_check.py b/domain_check.py new file mode 100644 index 0000000..ae4270c --- /dev/null +++ b/domain_check.py @@ -0,0 +1,141 @@ +import os +import socket +import sys +import concurrent.futures +import time +import random + + +def domain_megabot(domain, no_match_pattern, whois_server): + retry_count = 0 + while True: + response = whois_query(whois_server, domain) + if response: + if no_match_pattern in response: + print(f"{domain} AVAILABLE FOR REGISTRATION!") + with open("domain.txt", "a") as f: + f.write(f"{domain}\n") + else: + print(f"{domain} NOT AVAILABLE.") + # Add random delay to avoid triggering rate limits + time.sleep(random.uniform(1, 5)) + break + else: + retry_count += 1 + sleep_time = min(60, 2**retry_count + random.uniform(0, 1)) + print(f"Retrying query for {domain} in {sleep_time:.2f} seconds...") + time.sleep(sleep_time) + + +def whois_query(server, query): + ip = hostname_to_ip(server) + if not ip: + print("FAILED TO RESOLVE HOSTNAME") + return "" + + try: + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + s.settimeout(10) + s.connect((ip, 43)) + s.sendall(f"{query}\r\n".encode()) + response = b"" + while True: + data = s.recv(4096) + if not data: + break + response += data + return response.decode() + except socket.error as err: + print(f"Error during WHOIS query: {err}") + return None + + +def hostname_to_ip(hostname): + try: + return socket.gethostbyname(hostname) + except socket.error as err: + print(f"Error resolving hostname: {err}") + return None + + +def str_split(s, delimiter): + return s.split(delimiter) + + +def str_conn(s1, s2): + return f"{s1}{s2}" + + +def main(): + # Automatically read TLDs from the TLD_DATA file in the current directory + try: + with open("TLD_DATA", "r") as fp: + tld_data = fp.readlines() + except FileNotFoundError: + print("TLD DATABASE NOT FOUND!") + sys.exit(1) + + # Automatically read domain extensions (TLDs) from the DOMAINS file + try: + with open("DOMAINS", "r") as fp: + exts = [line.strip() for line in fp.readlines() if line.strip()] + except FileNotFoundError: + print("DOMAINS FILE NOT FOUND!") + sys.exit(1) + + # Load TLD information + tld_info = {} + for line in tld_data: + arr = str_split(line.strip(), "=") + if arr[0] in exts: + tld_info[arr[0]] = { + "whois_server": arr[1], + "no_match_pattern": arr[2], + } + + if not tld_info: + print("NO VALID TLDs FOUND IN DOMAINS FILE!") + sys.exit(2) + + # Automatically read the dictionary from the DICT file + try: + with open("DICT", "r") as fp_dict: + dictionary = fp_dict.readlines() + except FileNotFoundError: + print("DICTIONARY FILE NOT FOUND!") + sys.exit(3) + + with open("domain.txt", "w") as fp_result: + fp_result.write( + "AVAILABLE DOMAIN NAME LIST:\n" "---------------------------------\n" + ) + + # Prepare domain names to check + domains = [] + for line in dictionary: + domain_prefix = line.strip() + if domain_prefix: + for ext in exts: + domain = str_conn(str_conn(domain_prefix, "."), ext) + domains.append( + ( + domain, + tld_info[ext]["no_match_pattern"], + tld_info[ext]["whois_server"], + ) + ) + + # Use a thread pool to check multiple domains concurrently + with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor: + futures = [ + executor.submit(domain_megabot, domain, pattern, server) + for domain, pattern, server in domains + ] + for future in concurrent.futures.as_completed(futures): + future.result() # Handle any exceptions in threads + + print("TASK FINISHED! RESULTS SAVED TO domain.txt") + + +if __name__ == "__main__": + main()