首页 > 其他 > 详细

资产收集-火器域名收集(1)

时间:2021-08-04 16:05:38      阅读:7      评论:0      收藏:0      [点我收藏+]

技术分享图片


# -*- coding:utf-8 -*-
import requests
import json
‘‘‘
Author: Mat
Created: 2021/8/04
Version:1.0
此脚本用于火器资产收集(仅能获取小于1万条数据的域名)
只有加入过的项目才能获取数据,header参数的cookie和x-token为个人账号认证请自行修改
‘‘‘
url = "https://www.huoxian.cn/fireapi/user/search/subdomain?sort=update_time_desc"
header = {
"accept": "application/json, text/plain, */*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json;charset=UTF-8",
"cookie": "",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"x-token": "", }
#获取小于1w条函数,将结果写huoxian_small.txt文件
def small(subdomains):
f = open(‘huoxian_small.txt‘,‘w‘,encoding = ‘UTF-8‘)
data = ‘{"query":[{"column":"domain","op":"eq","content":"%s","logic":"and"}],"size":10000,"pageIndex":1}‘% subdomains
resp = requests.post(url=url, data = data , headers=header)
data_json = resp.json()
items = data_json.get("data",{}).get("items",[])
for item in items:
info = (item.get("source",{}).get("subdomain"))
print("获取的域名:",info)
f.writelines(info+‘\n‘)
f.close()
if __name__ == ‘__main__‘:
subdomains = input("请输入根域名:")
small(subdomains)
接下来继续完善大于1万条数据以及其他功能

资产收集-火器域名收集(1)

原文:https://www.cnblogs.com/Matsec/p/15098328.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!