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

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

相关推荐
Warson_L1 天前
Python `Annotated` 与 LangGraph Reducer 学习笔记
python
韩师傅1 天前
海天线算法的前世今生
python·计算机视觉
韩师傅1 天前
当你的甲方设备过烂,要如何快速出效果?
python·计算机视觉
Warson_L1 天前
LangGraph的MessageState and HumanMessage
python
韩师傅1 天前
当你的甲方吐槽天空不够蓝,你应该如何应对
python·计算机视觉
Warson_L1 天前
python的类&继承
python
Warson_L1 天前
类型标注/type annotation
python
ThreeS1 天前
手搓MiniVLA全实战教程-一步一步用pytorch解释原理与思路
人工智能·python
金銀銅鐵1 天前
[Python] 模 n 乘法的逆元计算器
python·数学·游戏