其他分享
首页 > 其他分享> > 一个实时监控edusrc上那些学校存在什么漏洞的脚本

一个实时监控edusrc上那些学校存在什么漏洞的脚本

作者:互联网

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import requests, time
import dingtalkchatbot.chatbot as cb
from lxml import etree



        
# 钉钉
def dingding(text, msg):
    webhook = 钉钉机器人API

    ding = cb.DingtalkChatbot(webhook)
    ding.send_text(msg='{}\r\n{}'.format(text, msg), is_at_all=False)

def gl(sj):
    sj = str(sj)
    sj = sj.replace("[", "")
    sj = sj.replace("]", "")
    sj = sj.replace(" ", "")
    sj = sj.replace("'", "")
    sj = sj.replace('\\n', "")
    return sj


def sendNews():
    list = []
    while 1:
        try:
          for i in range(2,3):
              url = "https://src.sjtu.edu.cn/"
              time.sleep(3600)
              data = requests.get(url=url).text
              tree = etree.HTML(data)
              title= tree.xpath('/html/body/div/div/div[2]/div/div/table/tr['+str(i)+']/td[2]/a/text()')
              sj = tree.xpath('/html/body/div/div/div[2]/div/div/table/tr['+str(i)+']/td[1]/text()')
              jb = tree.xpath('/html/body/div/div/div[2]/div/div/table/tr['+str(i)+']/td[3]/span/text()')
              zz = tree.xpath('/html/body/div/div/div[2]/div/div/table/tr['+str(i)+']/td[4]/a/text()')
              dz = tree.xpath('/html/body/div/div/div[2]/div/div/table/tr['+str(i)+']/td[2]/a/@href')


              title=gl(title)
              jb = gl(jb)
              sj = gl(sj)
              zz = gl(zz)
              dz = gl(dz)
              sm = "危害级别:" + jb + "\n更新时间:" + str(sj) + "\n"+"地址:https://src.sjtu.edu.cn" + str(dz) + "\n"

              if dz in list:
                print("cunzai\n")
              else:
                  if "中危" in jb:
                      dingding(title, sm)
                      print(title + '\n' + sm + '\n')
                      list.append(dz)
                  else:
                      print("危险程度底\n")

        except Exception as e:
            raise e


if __name__ == '__main__':
    sendNews()

代码写的很垃圾,自行修改。

钉钉CVE漏洞及红队工具自动推送群:31797046(欢迎加群)

标签:sj,text,实时,漏洞,dz,str,edusrc,div,gl
来源: https://blog.csdn.net/suporsuluo/article/details/122771366