文章目录
子域名和后台扫描
1、理解子域名扫描的价值和原理
2、熟练使用后台扫描工具御剑1.使用Python或Ping命令完成子域名扫描
3、使用御剑扫描某个网站的后台路径
除了IP地址或端口扫描外,还可以对某个域名进行子域名扫描,或针对某个网址进行后台URL地址扫描,这些都是采集信息的有效手段。
一、子域名扫描
1、价值与分类
(1)价值:在进行入侵之前,通常会考虑将周边的主机或应用进行排查,进而从周边系统入手。通常情况下,主站的防御体系要更加完整,而周边站点则可能会存在更多薄弱环节。
(2)分类:
一级域名: woniuxy.com,baidu.com,woniuxy.cn
二级域名: www.woniuxy.com mail.woniuxy.com
三级域名: mp.weixin.qq.com
通常情况下,一个子域名的命名相对是规范的,mail.woniuxy.com,而密码完全因人而异。
2、使用ping命令
使用ping命令可以获取域名对应的ip地址,则可以使用ping命令来i你选哪个判断
另外,在windows和Linux上,Ping命令的参数不太一样,所以如果扫描脚本运行在不同平台需要做不同的参数处理
Ping的次数 :Windows : ping -n 1 Linux: ping -c 1
超时时间:Windows: ping -w 1 Linux: ping -w 1
实现代码:
def ping_domain():
with open('../dict/subdomain-top160k.txt') as file:
domain list = file.readlines()
for domain in domain list:
result = os popen(f"ping -n 1 -w 1000 {domain.strip()}.woniuxy.com").read()
# print(result)
#if'请求超时' in result or'TTL=' in result:
# print(f"fdomain.strip()}.woniuxy.com")
if '找不到主机' not in result:
print(f"{domain.strip()}.woniuxy.com")
3、使用socket库
def socket domain()
with open('../dict/subdomain-top160k.txt') as file:
domain list = file.readlines()
for domain in domain list:
try:
ip=socket.gethostbyname(f'{domain.strip()}.woniuxy.com')
print(f{domain .strip()}.woniuxy.com, {ip}')
except socket.gaierror:
pass
socket.gethostbyname(域名)
会对域名进行解析并获取IP地址的,如果解析获取ip成功就返回,失败就抛异常
4、windows工具:Layer子域挖掘机
5、Kali工具:dnsenum
dnsenum -f /usr/share/dnsenum/dns.txt woniuxy.com
6、在线网站:http://z.zcjun.com/
如果要使用工具,优先选择在线工具
二、后台扫描
扫描一个网站的后台地址:通常不包含在页面的超连接中,后者无法通过爬虫获取到的一些隐藏那个的页面地址