自动化漏洞挖掘

自动化漏洞挖掘

工具准备

  • vps一台
  • subfinder、oneforall【资产监控,收集域名】
  • httpx 【存活检测】
  • anew 【过滤重复】
  • nuclei、xray【漏洞扫描】
  • python3 【微信通知】

工具部署

下载工具

git clone https://github.com/projectdiscovery/subfinder.git
git clone https://github.com/shmilylty/OneForAll.git
ghttps://github.com/projectdiscovery/httpx.git
git clone https://github.com/tomnomnom/anew.git
git clone https://github.com/chaitin/xray.git
git clone https://github.com/projectdiscovery/nuclei.git

编译安装

这些工具是个人的选择,感觉哪些不好用的话,可以自己进行编写或者对原脚本进行修改,这些都是github的项目,这些脚本都是由python和go进行编写的,go语言编写的程序使用的时候需要进行编译。

subfinder增强

接下来要为subfinder配置好一些获取资产的api接口,在/root/.config/subfinder/config.yaml文件中,尽量都配好,当然少配几个也没关系。

可以看到许多API Key 服务是空的,把这些尽量补全,这将会大大提升subfinder的资产发现能力,而且这些接口都是免费的,少部分会有一些限制,不过没关系,注册链接都放在下面了。

https://app.binaryedge.io/account/apiCensys 
https://censys.io/account/apiCertspotter 
https://sslmate.com/account/api_credentialsChaos https://chaos.projectdiscovery.io/#/Github 
https://github.com/settings/tokensIntelx 
https://intelx.io/account?tab=developerPassivetotal https://community.riskiq.com/settingsRobtex 
https://www.robtex.com/dashboard/Security Trails https://securitytrails.com/app/account/credentialsShodan 
https://account.shodan.io/Spyse 
https://spyse.com/userUrlScan 
https://urlscan.io/user/profile/Virustotal https://www.virustotal.com/gui/user/username/apikeyZoomEye https://www.zoomeye.org/profile

编写企微通知脚本

# -*- coding: utf-8 -*-
import requests
import json


def push_report(web_hook):
    header = {
        "Content-Type": "application/json;charset=UTF-8"
    }
    message_body = {
        "msgtype": "markdown",
        "markdown": {
            "content": "#### %s \n" % "消息推送展示项目:企业微信" +
                    "##### •  环境:测试环境 \n" +
                    "##### •  类型:%s \n" % "消息推送" +
                    "##### •  测试结果:%s \n" % "通过"
        },
        "at": {
            "atMobiles": [],
            "isAtAll": False
        }
    }
    send_data = json.dumps(message_body)  # 将字典类型数据转化为json格式
    ChatBot = requests.post(url=web_hook, data=send_data, headers=header)
    opener = ChatBot.json()
    if opener["errmsg"] == "ok":
        print(u"%s 通知消息发送成功!" % opener)
    else:
        print(u"通知消息发送失败,原因:{}".format(opener))


if __name__ == '__main__':
    # webhook 来自于 获取机器人webhook:复制webhook 中的那个值
    webhook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXXX"
    push_report(webhook)

此事收到的通知为

image-20220509205437822

可以根据自己的需求进行更改。

然后使用subfinder搜集hackerone子域名,httpx来验证存活,结束后,会把存活的资产发送到手机端的企业微信。如果你手机能收到,恭喜,可以下一步了。

subfinder -d hackerone.com | httpx -o res-hackerone.txt ;python3 notify.py res-hackerone.txt

anew主要将输出与旧文件进行比较,只会输出新添加的内容,项目介绍:https://github.com/tomnomnom/anew

例如 domain.txt,包含一组子域和现在新发现的subs.txt有相同的子域,这里anew就只会输出有新增的子域名。

posted @ 2023-02-06 14:38  tomyyyyy  阅读(364)  评论(0编辑  收藏  举报