抛砖引玉:简单判断自己拉的库是否安全

原理:查询脚本是否加密以及都请求了哪些URL
方法:登录青龙后台 ——> 进入脚本管理 ——> 右上角 + 新建,目录选择脚本库,不要选根目录 ——> 文件名:xxx.py ——> 复制下面源码粘贴 ——> 调试,运行 ——> 会打印所有的js、ts、py脚本名字,是否加密,以及都请求了哪些url
如果脚本加密了,可以自选是否运行;请求了非京东域名的脚本,就要注意了,可以看下用了什么方法都做了哪些动作

 

import os
import re
import sys

# 获取文件中的URL
def getUrls(file):
    f = open(file, 'r', encoding="utf-8")
    file_text = f.read()
    urls = re.findall(r'[a-zA-z]+://[^\s]*', file_text)
    if 'jsjiami.com' in file_text:
        urls.append('Encrypted')
    if urls:
        return urls

def getExt(file):
    scriptType = 'jstspy'
    file_ext = os.path.splitext(file)[1]
    file_ext = file_ext.split('.')[1]
    if file_ext in scriptType:
        return True

def getFile(file):
    Files = []
    if os.path.isdir(file) == True:
        print('当前目录: %s' % os.path.abspath(child))
        os.chdir(file)
        files = os.listdir()
        for i in files:
            getFile(i)
        os.chdir('../')
    else:
        Files.append(os.path.abspath(file))
    return Files

def load_send():
    global send
    cur_path = os.path.abspath(os.path.dirname(__file__))
    sys.path.append(cur_path)
    if os.path.exists(cur_path + "/sendNotify.py"):
        try:
            from sendNotify import send
        except:
            send=False
            print("加载通知服务失败~")
    else:
        send=False
        print("加载通知服务失败~")
load_send()


if __name__ == "__main__":
    total_encrypted = 0
    print('当前目录 %s ' % os.getcwd())
    dir_childs = os.listdir()
    for child in dir_childs:
        # 判断是否目录
        # if os.path.isdir(child) == True:
        #     print('当前目录: %s' % os.path.abspath(child))
        #     os.chdir(child)
        #     # 获取文件

        #     os.chdir('../')
        total_files = getFile(child)
        try:
            for file in total_files:
                if getExt(file) == True:
                    print('###### %s ######' % file)
                    urls = getUrls(file)
                    for url in urls:
                        if 'jd.com' not in url:
                            print(url+'\n')
                            if url == 'Encrypted':
                                total_encrypted += 1
        except Exception as e:
            print(e)
    print('当前共查找到加密脚本 %d 个' % total_encrypted)
    msg = '当前共查找到加密脚本 %d 个' % total_encrypted

    send('加密脚本检测', msg)

 

-> 加入科技玩家交流群组:点击加入 注意:
1.文中二维码和链接可能带有邀请性质,请各位玩家自行抉择。
2.请勿通过链接填写qq号与密码、银行卡号与密码等个人隐私信息。
3.禁止纯拉人头,拉app注册等信息,发现必小黑屋。
4.同一种信息仅发一次,多发会被删除。
5.文章中源码或APP等,无法保证其绝对安全,需自行辨别。
6.文章关联方不想展示也可以微信站长“socutesheep”删除。
本文由 @leanfly 发布。如若转载,请注明出处: 科技玩家 » 抛砖引玉:简单判断自己拉的库是否安全

给TA买糖
共{{data.count}}人
人已买糖
教程玩家投稿

群晖 Let's Encrypt 泛域名证书自动更新

2022-5-16 14:56:38

教程玩家投稿

实用黑科技:mac完美隐藏正在运行的应用程序(程序坞&菜单栏)

2022-5-18 13:41:36

64 条回复 A文章作者 M管理员
贴心提醒
请认真对待作者付出,勿发表无意义言论,触发过滤规则的评论将无法提交,包含敏感词的评论会自动变成待审核状态哦。
  1. 七年

    感谢分享,让我好好学习一下

  2. jswxzxc

    学习学习

  3. 七年

    谢谢大佬分享,谢谢!

  4. 幻念

    辛苦了,学习一下

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索