I've seen this thread yesterday, I've built a script in python that checks the XYZ domains
for availability. I haven't shared anything for a while, and I was thinking to give something back.
How the script works:
It takes a filename, that should contains words like:
somethingiWant
myowndomain
myfirstdomain
The software will check each domain, if it's available. I'm pretty sure there are tools out already that provide
this type of thing but hei ... it's free. You will find some false positives as well. The script is just making a http get
request to the url, eg:
http://somethingiwant.xyz and if it throws an error, the domain might be available,
if it doesn't, it returns a status code, it's most likely taken. The domains that will be reported as unavailable
are 100% unavailable (or at least you can't buy them for $1). You'll get false positives only for the available ones.
The requests that return a status code different than 200 (Success status code), will show with orange, and
instead of Y or N will show the status code returned. The report is a nice looking html file.
The TLD can be changed, so you can check for .com or other TLDs as well.
Example of HTML report generated by the script:
http://codebeautify.org/htmlviewer/6965e4
The script is built in python and here is the code for it:
Code:
#!/usr/bin/python2.7
# getyourbots.com
HTML_START = """
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<style>
#footer {
text-align:center;
position:absolute;
bottom:0;
width:100%;
height:25px; /* Height of the footer */
background:#008000
}
#footer_a{
color:white;
font-size:18px;
}
#main{
height: 700px;
overflow: auto;
}
#main_table
{
border: 3px solid black;
margin-left: auto;
margin-right: auto;
}
td{
text-align: center;
}
.yes{
background-color: #008000;
color: white;
font-size:18px;
}
.no{
background-color: #FF0000;
color: black;
font-size:17px;
}
.status{
background-color: #DE4E0B;
color: black;
font-size:17px;
}
</style>
<title>Domain checker report - getyourbots.com</title>
</head>
<body>
<div id="main">
<table id="main_table">
<tr>
<td><h3>Domain</h3></td>
<td><h3>Available</h3></td>
</tr>
"""
HTML_TD_NO = """
<tr class="no">
<td><a class="no" href="DOMAIN">DOMAIN</a></td>
<td>N</td>
</tr>
"""
HTML_TD_YES = """
<tr class="yes">
<td><a class="yes" href="DOMAIN">DOMAIN</a></td>
<td>Y</td>
</tr>
"""
HTML_TD_STATUS = """
<tr class="status">
<td><a class="status" href="DOMAIN">DOMAIN</a></td>
<td>STATUS</td>
</tr>
"""
HTML_END = """
</table>
</div>
<div id="footer"><a id="footer_a" href="https://getyourbots.com">GetYourBots.com</a></div>
</body>
</html>
"""
import requests as req
import signal
#import workerpool
import threading
class DomainChecker:
def __init__(self, f, TLD='xyz'):
f = f.strip()
if TLD.startswith('..'):
TLD = ''.join(list(TLD[2:]))
try:
words = self.read_wordlist(f)
except:
raise Exception('[!] Cannot read wordlist file: ' + f)
#self._pool = workerpool.WorkerPool(size=10)
self._domains = []
self._output = open('output.html', 'wb')
start_html = HTML_START.strip()
self._lock = threading.Lock()
self._output.write(start_html)
self._running = True
signal.signal(signal.SIGINT, self.signal_handler)
for word in words:
self._domains.append('http://{0}.{1}'.format(word.strip(), TLD))
# read wordlist file
def read_wordlist(self, f):
lines = []
f = open(f,'rb')
lines = f.readlines()
f.close()
return lines
# do work
def check_domains(self):
self._errs = 0
for domain in self._domains:
self.check_domain(domain)
def check_domain(self, domain):
if not self._running:
return
try:
resp = self.scan_domain(domain)
# does a type check not a value check !
if type(True) == type(resp):
if resp:
self.save_domain(domain, True)
print '[+] Available: ' + domain
else:
self.save_domain(domain, False)
print '[-] Unavailable: ' + domain
else:
print '[?] Domain :{0} - status code: {1}'.format(domain, str(resp))
self.save_domain(domain, False, None, str(resp))
self._errs = 0
except Exception, e:
print '[!] Error on domain: ' + domain
print '[!] Error: ' + str(e)
self.save_domain(domain, False, str(e))
self._errs += 1
with self._lock:
self._errs += 1
if self._errs == 50:
print '[!] Error: Got 30 consecutive errors, stopping.'
self._running = False
# check if domain exists
def scan_domain(self, d):
try:
r = req.get(d, timeout=15)
if r.status_code == 200:
return False
return r.status_code
except Exception, e:
return True
def save_domain(self, d, available=False, error=None, status_code=None):
if available:
self.save_yes(d)
return
if error:
self.save_status(d, 'Error: ' + error)
return
if type(status_code) == type('str'):
self.save_status(d, 'Response code: ' + status_code)
return
if not available:
self.save_no(d)
def signal_handler(self, signal, frame):
print '[-] CTRL+C pressed. Waiting for thread to finish ...'
self._running = False
def save_yes(self, d):
self._output.write(HTML_TD_YES.strip().replace('DOMAIN', d))
def save_no(self, d):
self._output.write(HTML_TD_NO.strip().replace('DOMAIN', d))
def save_status(self, d, s):
self._output.write(HTML_TD_STATUS.strip().replace('DOMAIN', d).replace('STATUS', str(s)))
# close output file
def close_output(self):
self._output.write(HTML_END)
self._output.close()
def main():
print '[+] Domain checker'
print '[+] getyourbots.com'
print ''
wl = raw_input('[+] Words file path (eg. words.txt): ')
TLD = raw_input('[+] TLD (eg: xyz): ')
d = DomainChecker(wl, TLD)
print ''
print '[+] Checking started'
d.check_domains()
d.close_output()
print '[+] Finished.'
a = raw_input()
if __name__ == "__main__":
main()
Installation:
1. Download and install python 2.7. latest:
https://www.python.org/download/releases/2.7/
2. Open a CMD and type
C:\Python27\Scripts\pip.exe install requests
3. That's all, open it, press F5, and you should be good to go.