[代码记录]使用Python进行多线程检查.moe三位剩余有效域名

import threading
import requests
import json

exitFlag = 0

class newTh(threading.Thread):
    def __init__(self, threadID, name, letter):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name
        self.letter = letter
    def run(self):
        print("Starting " + self.name)
        check_moe_domain(self.name, self.letter)
        print("Exiting " + self.name)
def check_moe_domain(threadName, letter):
    for i2 in range(1,27):
        for i3 in range(1,27):
            domain = letter+chr(i2+64)+chr(i3+64)
            #print("Checking domain",domain+".moe if is registered...")
            r = requests.get("https://domaincheck.il24.net/dm_check_domain.cgi?callback=&domain="+domain+".moe")
            print("Thread",threadName,"report:",domain + ".moe " + r.text[2:14])

for i1 in range(1,27):
    threads = {}
    threads[i1] = newTh(i1, "Thread-" + chr(i1 + 64),chr(i1 + 64))
    threads[i1].start()

print("Exiting Main Thread")

[Update 2019.2.7]
经检验这个接口也可以检查其它后缀的域名,于是做了一点小修改。

import threading
import requests
import json

exitFlag = 0
domain_suffix = ".moe"

class newTh(threading.Thread):
    def __init__(self, threadID, name, letter):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name
        self.letter = letter
    def run(self):
        print("Starting " + self.name)
        check_moe_domain(self.name, self.letter)
        print("Exiting " + self.name)
def check_moe_domain(threadName, letter):
    for i2 in range(1,27):
        for i3 in range(1,27):
            domain = letter + chr(i2 + 64) + chr(i3 + 64)
            #print("Checking domain",domain + domain_suffix + " if is registered...")
            r = requests.get("https://domaincheck.il24.net/dm_check_domain.cgi?callback=&domain=" + domain + domain_suffix)
            print("Thread",threadName,"report:",domain + domain_suffix+r.text[2:14])

for i1 in range(1,27):
    threads = {}
    threads[i1] = newTh(i1, "Thread-"+chr(i1+64),chr(i1+64))
    threads[i1].start()

print("Exiting Main Thread")

Last modification:February 8th, 2019 at 11:21 pm

Leave a Comment