ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

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

2022-02-02 19:33:47  阅读:71  来源: 互联网

标签:sj text 实时 漏洞 dz str edusrc div gl


#!/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

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有