删除单域名检测
Daily Domain Check / domain_check (push) Failing after 8s Details

This commit is contained in:
ahdoawhfo 2024-08-20 09:37:39 +08:00
parent 2bfe68160e
commit a338591b17
Signed by: ahdoawhfo
GPG Key ID: 5B4A734D16322C1D
7 changed files with 18 additions and 322 deletions

View File

@ -20,21 +20,17 @@ jobs:
with: with:
python-version: '3.12.5' python-version: '3.12.5'
- name: Run single domain check
run: python single_domain_check.py
- name: Run domain check - name: Run domain check
run: python domain_check.py run: python domain_check.py
- name: Save output with date - name: Save output with date
run: | run: |
today=$(date +%Y-%m-%d) today=$(date +%Y-%m-%d)
mv domain.txt "domain_$today.txt"
mv domains.txt "domains_$today.txt" mv domains.txt "domains_$today.txt"
- name: Create release and upload result - name: Create release and upload result
run: | run: |
today=$(date +%Y-%m-%d) today=$(date +%Y-%m-%d)
gitea release create --title "Single Domain Check $today" --assets "domain_$today.txt" --assets "domains_$today.txt" gitea release create --title "Domain Check $today" --assets "domains_$today.txt"
env: env:
TOKEN: ${{ secrets.TOKEN }} TOKEN: ${{ secrets.TOKEN }}

26
DICT
View File

@ -1,26 +0,0 @@
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

10
DOMAIN
View File

@ -1,10 +0,0 @@
am
at
cx
cz
de
gs
lc
lu
mk
nu

151
DOMAINS
View File

@ -1,155 +1,34 @@
ae
ag
am am
at
be
ai
ar
aw
ax
bg
bi
bj
bn
br
bw
bz
ca
cc
cd
cf
ci
cl
cm cm
cn im
co bi
cr ci
ge
lv
at
by
cl
cx cx
cz cz
de de
dk
dm
do
dz
ec
ee
eu
fi fi
fj gd
fm
fo
fr
ge
gg
gi
gl
gs gs
gy
hk
hm
hn
hr
ht
hu
id
ie
il
in
io
iq
ir
is
it
je
jp
ke
kg
ki
kn
kr
ky
kz
la
lc lc
li
lt lt
lu lu
lv
ly
ma
md
me
mg
mk mk
ml
mm
mn
mo
ms
mu
mx
my
mz
na
nc
nf
ng
nl
no
nu nu
nz nz
om pw
pe
pf
pl
pm
pr
ps
pt
qa
re
ro ro
rs rs
ru ru
rw
sa
sb
sc
se
sg
sh
si si
sk
sl
sm
sn
so
su su
sx vg
sy
tc
tf
tg
th
tk
tl
tm
tn
to
tr
tv
tw
tz
ua
ug
uk
us
uy
uz
vc
ve
vu
wf
ws ws
yt gy
zm st
qa
moe

View File

@ -1,2 +0,0 @@
AVAILABLE DOMAIN NAME LIST:
---------------------------------

View File

@ -77,7 +77,7 @@ def main():
# Automatically read domain extensions (TLDs) from the DOMAINS file # Automatically read domain extensions (TLDs) from the DOMAINS file
try: try:
with open("DOMAINS", "r") as fp: with open("CHEAP", "r") as fp:
exts = [line.strip() for line in fp.readlines() if line.strip()] exts = [line.strip() for line in fp.readlines() if line.strip()]
except FileNotFoundError: except FileNotFoundError:
print("DOMAINS FILE NOT FOUND!") print("DOMAINS FILE NOT FOUND!")
@ -126,7 +126,7 @@ def main():
) )
# Use a thread pool to check multiple domains concurrently # Use a thread pool to check multiple domains concurrently
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
futures = [ futures = [
executor.submit(domain_megabot, domain, pattern, server) executor.submit(domain_megabot, domain, pattern, server)
for domain, pattern, server in domains for domain, pattern, server in domains

View File

@ -1,141 +0,0 @@
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("DOMAIN", "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()