域名报红检测小工具-python
本文最后更新于 1389 天前,其中的信息可能已经有所发展或是发生改变。

域名爆红检测小工具,方便做识别批量检查,作为另一种思路

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

import json
import time
import requests


def check_file(file):
    str_dump = []
    line_len = 100
    with open(file, 'r') as f1:
        for line in f1:
            line = line.replace('\n', '')
            print(line)
            # link = 'https://cgi.urlsec.qq.com/index.php?m=check&a=check&url=http://{}'.format(line)
            t = int(round(time.time()*1000))
            link = 'https://cgi.urlsec.qq.com/index.php?m=check&a=check&callback=jQuery1113049533065324068226_1585819829729&url={0}&_={1}'.format(line, t)
            try:
                # 接口header
                headers = {
                    "Content-Type": "application/json;charset=utf-8",
                    "Accept": "*/*",
                    "Connection": "keep-alive",
                    "Host": "cgi.urlsec.qq.com",
                    # "Referer": "https://guanjia.qq.com",
                    "Referer": "https://urlsec.qq.com/check.html?url={}".format(line),
                    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74",
                }

                req = requests.get(link, headers=headers, timeout=100)
                # print(req)
                response = req.text
                # print(response[len('jQuery1113049533065324068226_1585819829729('):len(response)-1])
                data = json.loads(response[len('jQuery1113049533065324068226_1585819829729('):len(response)-1])

                # whitetype: 1:安全性未知 2:危险网站 3:安全网站
                white_type = data['data']['results']['whitetype']
                # python 没switch 语法 害
                if white_type == 1:
                    type_str = 'unknown'
                elif white_type == 2:
                    type_str = 'danger'
                elif white_type == 3:
                    type_str = 'safe'
                else:
                    type_str = 'null'

                str_data = line + ',' + type_str + ',' + str(white_type) + '\n'
                str_dump.append(str_data)
                req.close()

            except Exception as e:
                print(e)

            if len(str_dump) > 0:
                if (len(str_dump) % line_len) == 0:
                    # print('够{}条啦...'.format(len(str_dump)))
                    with open('target_qq.txt', 'a+') as f3:
                        f3.write(''.join(str_dump))
                        str_dump = []

            time.sleep(0.1)

    if len(str_dump) > 0:
        with open('target_qq.txt', 'a+') as f3:
            f3.write(''.join(str_dump))
            str_dump = []


if __name__ == '__main__':
    check_file('url.txt')

 

评论

  1. Windows Firefox 88.0
    4 年前
    2021-4-13 21:33:16

    百度飘红能检测不

    • 博主
      智慧消防物联网
      Windows Edge 89.0.774.75
      4 年前
      2021-4-14 9:18:13

      不能

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇