Skip to content

Commit 6b6ae7a

Browse files
authored
Moudled multi (#17)
有几个小地方没处理好 还有没用的引入
1 parent 6d069e9 commit 6b6ae7a

File tree

2 files changed

+35
-27
lines changed

2 files changed

+35
-27
lines changed

multi.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
from threading import Thread, Lock
55
from ping3 import ping
66
import time
7+
import subprocess
78

89
ip_dic = dict()
910

11+
1012
class PING(Thread):
1113
def __init__(self, ip):
1214
Thread.__init__(self)
@@ -28,3 +30,35 @@ def multi_ping(iplist):
2830
T_thread[i].start()
2931
time.sleep(3)
3032
return ip_dic
33+
34+
35+
iplist = []
36+
37+
38+
class DIG(Thread):
39+
def __init__(self, ip, domain):
40+
Thread.__init__(self)
41+
self.ip = ip
42+
self.domain = domain
43+
44+
def run(self):
45+
response = subprocess.check_output(
46+
"dig @{0} {1}".format(self.ip, self.domain), shell=True)
47+
if r";; connection timed out; no servers could be reached" not in str(response):
48+
iplist.append(self.ip)
49+
50+
51+
def multi_local_dns(domain):
52+
with open("dns.txt", "r") as f_dns:
53+
iplist_unsolve = [x.replace('\n', '') for x in f_dns.readlines()]
54+
55+
# 多线程dig
56+
T_thread = []
57+
for i in iplist_unsolve:
58+
T_thread.append(DIG(i, domain=domain))
59+
for i in range(len(T_thread)):
60+
T_thread[i].start()
61+
time.sleep(3)
62+
63+
print("[+]Got domain! \n" + str(iplist))
64+
return domain, iplist

myutils.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,17 @@
1-
import subprocess
2-
import time
31
import requests
42
import re
53
from ping3 import ping
64
import multi
75
from prettytable import PrettyTable
8-
from threading import Thread, Lock
96

10-
ipll = []
11-
class DIG(Thread):
12-
def __init__(self, ip, domain):
13-
Thread.__init__(self)
14-
self.ip = ip
15-
self.domain = domain
16-
17-
def run(self):
18-
response = subprocess.check_output("dig @{0} {1}".format(self.ip, self.domain), shell=True)
19-
if r";; connection timed out; no servers could be reached" not in str(response):
20-
ipll.append(self.ip)
21-
227

238
def run_core(domain, area):
249
# Encrypt!
2510
if area == "debug":
2611
iplist = ['220.181.38.148', '39.156.69.79', '210.23.129.34', '210.23.129.34', '220.181.38.148', '39.156.69.79', '202.108.22.220', '220.181.33.31', '112.80.248.64', '14.215.178.80', '180.76.76.92', '210.23.129.34', '210.23.129.34', '39.156.69.79', '220.181.38.148', '203.12.160.35', '203.12.160.35', '39.156.69.79', '220.181.38.148',
2712
'202.108.22.220', '220.181.33.31', '112.80.248.64', '14.215.178.80', '180.76.76.92', '203.12.160.35', '203.12.160.35', '220.181.38.148', '39.156.69.79', '61.8.0.113', '61.8.0.113', '220.181.38.148', '39.156.69.79', '202.108.22.220', '220.181.33.31', '112.80.248.64', '14.215.178.80', '180.76.76.92', '61.8.0.113', '61.8.0.113']
2813
else:
29-
with open("dns.txt", "r") as f_dns:
30-
iplist_unsolve = [x.replace('\n', '') for x in f_dns.readlines() ]
31-
32-
# 多线程dig
33-
T_thread = []
34-
for i in iplist_unsolve:
35-
T_thread.append(DIG(i, domain=domain))
36-
for i in range(len(T_thread)):
37-
T_thread[i].start()
38-
time.sleep(3)
39-
40-
print("[+]Got domain! \n" + str(ipll))
14+
domain, ipll = multi.multi_local_dns(domain)
4115
return domain, ipll
4216

4317

0 commit comments

Comments
 (0)