예제 #1
0
def get_subdomains(domain):
    subdomains = []
    try:
        headers = {
            'User-Agent':
            "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)",
            'Accept':
            'text/html,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8',
            'Accept-Language': 'en-US;q=0.8,en;q=0.3',
            'Upgrade-Insecure-Requests': "1",
            'X-Requested-With': 'XMLHttpRequest',
            'Referer': 'https://www.oshadan.com/toolkit',
        }
        data = {"site": domain, "page": "1"}
        url = 'https://www.oshadan.com/anoipdomain?info={}'.format(
            json.dumps(data))
        _, content = HttpReq(url=url, headers=headers)
        formatdata = json.loads(content)['data']
        result = [i.keys()[0] for i in formatdata]
        subdomains = [i.split('|')[1] for i in result]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
def get_subdomains(domain, page=50):
    subdomains, sites = [], []
    try:
        for i in xrange(0, page * 10, 10):
            url = 'http://www.baidu.com/s?wd=site:{}&pn={}'.format(
                domain, i)
            _, content = HttpReq(url)
            sites.extend(
                re.findall(
                    'style="text-decoration:none;">(.*?)/',
                    content))
        subdomains = [_.strip() for _ in sites if CheckDomainFormat(_.strip())]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
def get_subdomains(domain):
    subdomains = []
    try:
        url = "http://{}/crossdomain.xml".format(domain)
        status, content = HttpReq(url)
        if status == 200:
            subdomains = re.findall('domain="([\w\.]+)"', content)
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
예제 #4
0
def get_subdomains(domain):
    subdomains = []
    try:
        url = "https://api.shodan.io/shodan/host/search?key=%s&query=hostname:%s&facets={facets}" % (
            config['shodan_key'], domain)
        _, content = HttpReq(url)
        data = json.loads(content)
        if isinstance(data, list) and data[1] == "INVALID_API":
            return subdomains
        else:
            if 'matches' in data.keys():
                subdomains = [
                    i['hostnames'][0].strip() for i in data['matches']
                    if CheckDomainFormat(i['hostnames'][0].strip())
                ]
                subdomains = [_ for _ in subdomains if _.endswith(domain)]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
예제 #5
0
def get_subdomains(domain, page=5):
    subdomains = []
    try:
        for i in xrange(1, page + 1):
            url = "https://dnstrails.com/#/list/domain/{}/type/hostname/page/{}".format(
                domain, i)
            _, content = HttpReq(url)
            selector = etree.HTML(content)
            content = selector.xpath("//li/div/a/text()")
            subdomains = [each for each in content]
    except:
        pass  #maybe go wall
    finally:
        return list(set(subdomains))
예제 #6
0
def get_subdomains(domain):
    subdomains = []
    try:
        url = 'http://alexa.chinaz.com/?domain={}'.format(domain)
        _, content = HttpReq(url)
        regex = re.compile(r'(?<="\>\r\n<li>).*?(?=</li>)')
        result = regex.findall(content)
        subdomains = [sub for sub in result if CheckDomainFormat(sub)]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
예제 #7
0
def get_subdomains(domain):
    subdomains = []
    try:
        url = 'http://webscan.360.cn/sub/index/?url={}'.format(domain)
        _, content = HttpReq(url)
        item = re.findall(r'\)">(.*?)</strong>', content)
        if len(item) > 0:
            subdomains = [item[i] for i in xrange(1, len(item))]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
예제 #8
0
def get_subdomains(domain):
    subdomains = []
    try:
        url = "https://www.threatminer.org/getData.php?e=subdomains_container&q={}&t=0&rt=10&p=1".format(
            domain)
        _, content = HttpReq(url)
        regex = re.compile(r'(?<=<a  href\="domain.php\?q=).*?(?=">)')
        result = regex.findall(content)
        subdomains = [sub for sub in result if CheckDomainFormat(sub)]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
def get_subdomains(domain):
    subdomains = []
    try:
        url = "https://www.threatcrowd.org/searchApi/v2/domain/report/?domain={}".format(
            domain)
        _, content = HttpReq(url)
        subdomains = [
            sub for sub in json.loads(content).get('subdomains')
            if CheckDomainFormat(sub)
        ]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
예제 #10
0
def get_subdomains(domain):
    subdomains = []
    try:
        url = 'http://ptrarchive.com/tools/search.htm?label={}'.format(domain)
        _, content = HttpReq(url)
        selector = etree.HTML(content)
        content = selector.xpath("//td[3]/text()")
        subdomains = [
            each.split(' ')[0] for each in content
            if CheckDomainFormat(each.split(' ')[0])
        ]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
def get_subdomains(domain):
    subdomains = []
    try:
        url = 'https://crt.sh/?q=%25.{}'.format(domain)
        _, content = HttpReq(url)
        if content:
            selector = etree.HTML(content)
            content = selector.xpath("//tr/td[4]/text()")
            for each in content:
                if '*.' in each:
                    each = each.replace('*.', '')
                subdomains.append(each)
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
예제 #12
0
def get_subdomains(domain, page=50):
    subdomains = []
    try:
        for i in xrange(0, page * 50, 50):
            url = 'http://cn.bing.com/search?count=50&q=host:{}&first={}'.format(
                domain, str(i))
            _, content = HttpReq(url)
            match = re.findall('<cite>(.*?)<\/strong>', content)
            for each in match:
                if 'target="_blank"' not in each.replace('<strong>', ''):
                    url = each.replace('<strong>', '')
                    subdomains.append(urlparse.urlparse(url).netloc)
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))
예제 #13
0
def get_subdomains(domain):
    subdomains = []
    try:
        url = 'https://www.virustotal.com/en/domain/{}/information/'.format(
            domain)
        _, content = HttpReq(url)
        regex = re.compile(
            '<div class="enum.*?">.*?<a target="_blank" href=".*?">(.*?)</a>',
            re.S)
        result = regex.findall(content)
        subdomains = [
            sub.strip() for sub in result if sub.strip().endswith(domain)
        ]
    except TypeError:
        pass
    except:
        traceback.print_exc()
    finally:
        return list(set(subdomains))