0x01 前言

我们从《红蓝对抗之企业对外根域名资产收集》这篇文章可以学习到如下几种根域名的收集方式。本文将对细节再进行补充和扩展。

0x2 通过PTR记录收集

什么是PTR记录呢?

PTR记录,是电子邮件系统中的邮件交换记录的一种;另一种邮件交换记录是A记录(在IPv4协议中)或AAAA记录(在IPv6协议中)。PTR记录常被用于反向地址解析。

以Facebook为例

1. 收集IP段

https://bgp.he.net/search?search%5Bsearch%5D=facebook&commit=Search

2. 正则提取ip段

(\d{1,3}\.){3}\d{1,3}\/\d{1,2}

3. 解析ptr记录

cat facebook.txt | mapcidr -silent | dnsx -silent -ptr -resp-only -o output.txt

4. 提取根域名

cat ~/Desktop/output.txt | python extract-root-domain.py - 

import click
from wsltools.domaintools import domain

def generate(results):
 for result in results:
 if domain(result).valid:
 yield domain(result).main

@click.command()
@click.argument('filename', required=True, type=click.File(mode='r'))

def main(filename):
 results = filename.read().splitlines()
 for r in set(generate(results)):
 click.echo(r)

if __name__ == "__main__":
 main()

0x03 WHOIS反查接口推荐

https://drs.whoisxmlapi.com/reverse-whois-search

Reverse WHOIS Search

0x04 SSL证书扩展补充

除了通过fofa、shodan、zoomeye、quake等空间描绘搜索引擎,还可以通过http://tls.bufferover.run/收集

以alipay.com为例子:

http://tls.bufferover.run/dns?q=.alipay.com

通过ip获取tls证书

echo 'https://183.201.217.110/' | httpx -json -silent | jq

可以发现dns_names里有很多其他根域名。

0x05 参考

1. https://0xpatrik.com/asset-discovery/

2. https://github.com/projectdiscovery/httpx

3. https://github.com/projectdiscovery/dnsx

4. https://github.com/projectdiscovery/mapcidr

5. https://www.thinkings.org/2020/04/16/wsltools.html

6. http://ghostlulz.com/horizontal-domain-correlation/

7. https://sidxparab.gitbook.io/subdomain-enumeration-guide/types/horizontal-enumeration

8. 红蓝对抗之企业对外根域名资产收集 https://mp.weixin.qq.com/s/irX-cQ23Pzb0pS8K-EE38Q


本文迁移自知识星球“火线Zone”

1 个月 后
6 个月 后
1 年 后
说点什么吧...