Skip to content

Commit b0ae2ba

Browse files
committed
fix a bug in domain2ip.py
fix a bug in domain2ip.py
1 parent bbbcec1 commit b0ae2ba

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

domainsites/Googlect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def parser_subject(self):
122122

123123
if __name__ == "__main__":
124124
proxy = {"https":"https://127.0.0.1:9988"}
125+
proxy = {}
125126
x = Googlect("meizu.com",proxy)
126127
#print x.parser_dnsname()
127128
print x.run()

lib/domain2ip.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def query(domain, record_type='A',server=None):
2828
#print "{0} {1}".format(domain,j.to_text())
2929
tmpcname.append(j.to_text())
3030
line ="{0}\t{1}\t{2}".format(domain.ljust(30),", ".join(tmpcname),", ".join(tmpip))
31-
if tmpip != None: #only collect IP that don't use CDN (cname)
31+
if tmpip != None: #only collect IPs that don't use CDN (cname)
3232
ips.extend(tmpip)
3333
print line
3434
return ips,line
@@ -85,15 +85,15 @@ def iprange(ip_str_list):
8585
for ip_str in ip_str_list:
8686
ip = IPNetwork(ip_str)
8787
ip.prefixlen = 24
88-
if ip.cidr == net:
88+
if ip.cidr == net:#ip属于net
8989
tmpIPlist.append(ip_str)
9090
#print tmpIPlist
9191
if len(tmpIPlist) == 1:
9292
smaller_subnet.add(tmpIPlist[0])
9393
elif len(tmpIPlist) >=2:
9494
smaller = netaddr.spanning_cidr(tmpIPlist) #type is IPNetwork
95-
if smaller != net:
96-
smaller_subnet.add(smaller)
95+
#if smaller != net:
96+
smaller_subnet.add(smaller)
9797
elif len(tmpIPlist) ==0:
9898
print "{0} has no ip".format(net)
9999

@@ -102,15 +102,17 @@ def iprange(ip_str_list):
102102
result.append(str(item))
103103
return result
104104

105-
def smaller_network(ip_str_list):
106-
x = netaddr.spanning_cidr(['192.168.0.0', '192.168.2.245', '192.168.2.255'])
105+
def smaller_network():
106+
#list = ['192.168.0.0', '192.168.0.245', '192.168.0.255']
107+
#list = ['192.168.2.245']
108+
x = netaddr.spanning_cidr(list)
107109
print x
108110

109111

110112
if __name__ == "__main__":
111-
112-
113-
domains = open("C:\Users\jax\Desktop\hrpc.txt").readlines()
113+
domains = open("C:\Users\jax\Desktop\hrpc (2).txt").readlines()
114114

115115
x,lines= domains2ips(domains,"172.30.35.35")
116-
print lines
116+
#print x
117+
#print smaller_network()
118+
print iprange(x)# problem

teemo.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ def main():
192192

193193
subdomains.extend(brute_domains)
194194
subdomains = sorted(list(set(subdomains)))
195+
subdomain_number = len(subdomains)
195196

196197
lines.extend(brute_lines)
197198
lines = list(set(lines))
@@ -210,11 +211,11 @@ def main():
210211
fp.writelines("\n".join(subdomains).encode("utf-8"))
211212

212213

213-
print "[+] {0} domains found in total".format(len(subdomains))
214+
print "[+] {0} domains found in total".format(subdomain_number)
214215
print "[+] {0} emails found in total".format(len(emails))
215216
print "[+] Results saved to {0}".format(args.output)
216217
except KeyboardInterrupt as e:
217-
logger.info("exit. due to KeyboardInterrupt")
218+
logger.info("Exit. Due To KeyboardInterrupt")
218219

219220

220221
if __name__=="__main__":

0 commit comments

Comments
 (0)