10.子域名和后台扫描

一、子域名扫描

1、价值与分类

1、价值与分类

(1)价值:在进行入侵之前,通常会考虑将周边的主机或应用进行排查,进而从周边系统入手。通常情况下,主站的防御体系要更加完整,而周边站点则可能会存在更多薄弱环节。

(2)分类:

---级域名:woniuxy.combaidu.comwoniuxy.cn

二级域名:www.woniuxy.com, mail.woniuxy.com

三级域名:mp.weixin.qq.com

通常情况下,一个子域名的命名相对是规范的,mail.woniuxy.com,而密码完全因人而异。

2、使用Ping命令

使用Ping命令可以获取域名对应的IP地址,则可以使用Ping命令来进行判断。

复制代码
C:\Users\22141>ping www.baidu.com

正在 Ping www.a.shifen.com [2409:8c54:870:187:0:ff:b0d9:bb1c] 具有 32 字节的数据:
来自 2409:8c54:870:187:0:ff:b0d9:bb1c 的回复: 时间=39ms
来自 2409:8c54:870:187:0:ff:b0d9:bb1c 的回复: 时间=39ms
来自 2409:8c54:870:187:0:ff:b0d9:bb1c 的回复: 时间=41ms
来自 2409:8c54:870:187:0:ff:b0d9:bb1c 的回复: 时间=36ms

2409:8c54:870:187:0:ff:b0d9:bb1c 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 36ms,最长 = 41ms,平均 = 38ms

另外,在Windows和Linux上,Ping命令的参数不太一样,所以如果扫描脚本运行于不同平台,需要做不同的参数处理

复制代码
Ping的次数:windows:ping -n 1, Linux: ping -c 1
超时时间:windows:ping -w 1,Linux: ping -W 1

3、使用socket库

python 复制代码
# 基于ping命令的子域名扫描
def ping_domain():
    with open('../dict/dic_domain.txt') as file:
        domain_list = file.readlines()
    for domain in domain_list:
        result = os.popen(f'ping -n 1 -w 1000 {domain.strip()}.baidu.com').read()
        # print(result)
        # if '请求超时' in result or 'TTL=' in result:
        #     print(f"{domain.strip()}.baidu.com")

        if '找不到主机' not in result:
            print(f"{domain.strip()}.baidu.com")
python 复制代码
# 基于socket库的DNS解析功能实现扫描
def socket_domain():
    with open('../dict/dic_domain.txt') as file:
        domain_list = file.readlines()
    for domain in domain_list:
        try:
            ip = socket.gethostbyname(f'{domain.strip()}.baidu.com')
            print(f'{domain.strip()}.baidu.com,{ip}')
        except socket.gaierror:
            pass

4、Windows工具:Layer子域挖掘机

5、Kali工具:dnsenum

复制代码
dnsenum -f /usr/share/dnsenum/dns.txt baidu.com

6、在线工具

在线子域名扫描-YoungxjTools

二、后台扫描

扫描一个网站的后台地址:通常不包含在页面的超链接中,或者无法通过爬虫获取到的一些隐藏的页面地址。

三、Web站点信息采集

1、Kali工具

复制代码
whatweb woniuxy.com

2、whois信息

查询某个域名的注册信息

3、python-whois库

复制代码
pip install python-whois
python 复制代码
# 查询域名的whois信息
def whois_info():
    from whois import whois
    import json
    result = whois('woniuxy.com')
    # print(result)
    dict = json.loads(str(result))
    print(dict)
    print(dict['domain_name'])

4、nslookup

用于确认域名是否使用了CDN网络,nslookup aliyun.com

5、fofa.so

可用于端口和服务信息搜集,其好处是不用nmap那样直接扫描,而是根本不存在扫描行为。

已经无法访问:

6、shodan.io

可以搜索一切联网的设备,如摄像头、工控设备、路由器、打印机、物联网设备等。

相关推荐
树獭非懒19 小时前
AI大模型小白手册|Embedding 与向量数据库
后端·python·llm
唐叔在学习1 天前
就算没有服务器,我照样能够同步数据
后端·python·程序员
曲幽1 天前
FastAPI流式输出实战与避坑指南:让AI像人一样“边想边说”
python·ai·fastapi·web·stream·chat·async·generator·ollama
Flittly1 天前
【从零手写 AI Agent:learn-claude-code 项目实战笔记】(1)The Agent Loop (智能体循环)
python·agent
vivo互联网技术1 天前
ICLR2026 | 视频虚化新突破!Any-to-Bokeh 一键生成电影感连贯效果
人工智能·python·深度学习
敏编程1 天前
一天一个Python库:virtualenv - 隔离你的Python环境,保持项目整洁
python
喝茶与编码1 天前
Python异步并发控制:asyncio.gather 与 Semaphore 协同设计解析
后端·python
zone77391 天前
003:RAG 入门-LangChain 读取图片数据
后端·python·面试
用户8356290780511 天前
在 PowerPoint 中用 Python 添加和定制形状的完整教程
后端·python