Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ chaxun.la 对请求频率过高的ip,要人工输入验证码,代码嵌入

https://github.com/ring04h/wydomain/blob/wydomain2/captcha.py
https://github.com/ring04h/wydomain/blob/wydomain2/utils/chaxunla.py#L41


passivetotal API 查询需要自行申请账号并设置key.如果频率过高可以多申请几个做个while就好。
路径: utils/passivetotal.py

### 库依赖安装
```
$ pip install -r requirements.txt
Expand Down
44 changes: 44 additions & 0 deletions utils/passivetotal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python
# encoding: utf-8
# email: c4bbage@qq.com
# weibo: @s4turnus
# encoding: utf-8

# import sys
# sys.path.append("../")

import re
import json
import requests
import logging
from common import curl_get_content, http_request_get, is_domain,http_request_post
# API INFO https://api.passivetotal.org/api/docs/
class PassiveTotal(object):
"""docstring for PassiveTotal"""
def __init__(self, domain):
super(PassiveTotal, self).__init__()
self.domain = domain
self.subset = []
self.website = "https://www.passivetotal.org"

def run(self):
try:
# 此auth 需要自行申请,每个auth 每天有查询次数限制
auth=("ouqiower@163.com","d160262241ccf53222d42edc6883c129")
payload={"query":"*.%s" % self.domain}
url = "https://api.passivetotal.org/v2/enrichment/subdomains"
response = requests.get(url,auth=auth,params=payload)

for sub in json.loads(response.content)['subdomains']:
sub="%s.%s" %(sub,self.domain)
if is_domain(sub):
self.subset.append(sub)

return list(set(self.subset))
except Exception as e:
logging.info(str(e))
return self.subset

# passive = PassiveTotal('aliyun.com')
# print passive.run()

8 changes: 7 additions & 1 deletion wydomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def run(args):
save_result(_cache_file, result.get('dns_names'))
logging.info("google TransparencyReport fetcher subdomains({0}) successfully...".format(len(result.get('dns_names'))))

logging.info("starting passivetotal fetcher...")
result = PassiveTotal(domain=domain).run()
_cache_file = os.path.join(_cache_path, 'passivetotal_dnsnames.json')
save_result(_cache_file, result)
logging.info("passivetotal fetcher subdomains({0}) successfully...".format(len(result)))
# Collection API Subdomains
sub_files = [
'alexa.json',
Expand All @@ -106,7 +111,8 @@ def run(args):
'netcraft.json',
'sitedossier.json',
'threatcrowd.json',
'threatminer.json']
'threatminer.json',
'passivetotal_dnsnames.json']

# process all cache files
subdomains = []
Expand Down