文章目录
前言
src漏洞挖掘时,经常是会使用多个子域名探测工具,即便是中间的过程,每个工具会生成漂亮的资产展示页面但是不具有拓展性,而且过了几个月又得重新来一遍。
还不如仅仅最初的收集采用最简单的多个工具综合子域名的结果,然后再进行之后的探测和分析挖掘工作。
以下就是针对子域名文件的访问状态的展示脚本
一、使用效果

二、使用步骤
1.代码地址
代码如下:
import requests,re
import datetime
requests.packages.urllib3.disable_warnings()
html_body = '''<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<title>hacking</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入 Bootstrap -->
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- 新 Bootstrap 核心 CSS 文件 -->
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="panel panel-default">
<div class="row clearfix">
<div class="col-md-12 column">
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>
域名
</th>
<th>
检测时间
</th>
<th>
网站标题
</th>
<th>
状态码
</th>
<th>
访问链接
</th>
<th>
百度
</th>
<th>
谷歌
</th>
<th>
fofa
</th>
</tr>
</thead>
<tbody>
{}
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>'''
html_tr = '''<tr class="{0}">
<td>
{1}
</td>
<td>
{2}
</td>
<td>
{3}
</td>
<td>
{4}
</td>
<td>
<a href="{5}" target="_blank">点击</a>
</td>
<td>
<a href="https://www.baidu.com/s?wd=site:{1}" target="_blank">baidu</a>
</td>
<td>
<a href="https://www.google.com/search?q=site:{1}" target="_blank">google</a>
</td>
<td>
<a href="https://fofa.so/result?q={1}" target="_blank">fofa</a>
</td>
</tr>'''
def edr(url,domain):
today = datetime.date.today()
try:
r = requests.get(url,verify=False, timeout=0.5)
if r.status_code == 200:
title = re.findall('<title>.*</title>', r.content.decode('utf8','ignore'))
if len(title) != 0:
add_str = (html_tr.format("success",domain,title[0][7:-8],today,r.status_code,r.url))
else:
add_str = (html_tr.format("success", domain, 'NULL', today, r.status_code, r.url))
else:
add_str = (html_tr.format("warning", domain, 'NULL', today, r.status_code, url))
except EnvironmentError as e:
add_str = (html_tr.format("error", domain, 'NULL', today, 'ERROR', url))
return add_str
if __name__ == '__main__':
html_name = str(datetime.date.today())+'.html'
with open('./unpay/unpay.txt', 'r',encoding='utf8') as f:
list1 = f.readlines()
f.close()
all_td = ''
for url in list1:
mubiao = "http://"+url[:-1]
all_td = all_td+edr(mubiao,url[:-1])
with open(html_name,'a',encoding='utf8') as f1:
f1.write(html_body.format(all_td))
f1.close()
总结
当然,收集子域名的过程中还有各种工具采集的子域名进行去重处理的工作,也都是可以使用脚本实现了,后续会提供上来,帮助其他人在写自己脚本的时候提供一个思路。
本文介绍了一种Python3脚本,用于获取子域名的访问状态并生成展示页面,辅助SRC漏洞挖掘。脚本适用于子域名收集后的状态检查,提供代码地址供参考。

被折叠的 条评论
为什么被折叠?



