fofapro / vulfocus

🚀Vulfocus 是一个漏洞集成平台,将漏洞环境 docker 镜像,放入即可使用,开箱即用。
Apache License 2.0
3.21k stars 509 forks source link

获取镜像的时候一直转圈,一键同步服务器错误 #326

Closed ksk2kk closed 1 year ago

ksk2kk commented 1 year ago

报错信息服务器内部错误,请联系管理员

操作系统: kalilinux

内核版本:Debian

Python 环境版本:3.10

Vulfocus 版本:最新版

通过社区学习将链接修改为https://vulfocus.cn/api/imgs/info,之后重启vulfocus,获取到了一些镜像,但是还是无法使用一键同步和镜像搜素功能,镜像搜素一直转圈没反应

zhoutianzi commented 1 year ago

+1

awsl404 commented 1 year ago

获取的镜像信息的格式换了,需要修改vulfocus-api/dockerapi/views.py文件中get_timing_imgs方法中的部分代码(出问题的可能都是docker启动的) 自己测试了一下,临时可用的解决办法,可以修改如下内容(只能解决同步镜像报错问题)

@api_view(http_method_names=["POST"])
def get_timing_imgs(request):
    """
    获取官网镜像信息
    """
    try:
        url = "https://vulfocus.cn/api/imgs/info"
        total_page = json.loads(requests.get(url, verify=False).content)['total_page']
        image_names = list(ImageInfo.objects.all().values_list('image_name', flat=True))
        for i in range(total_page):
            res = requests.get(url + "?page=" + str(i+1), verify=False).content
            req = json.loads(res)
            req = req['imgs']
            for item in req:
                if item['image_name'] == "":
                    continue
                if 'is_docker_compose' in item:
                    if item['is_docker_compose'] == True:
                        continue
                if item['image_name'] in image_names:
                    if item['image_name'] == "vulfocus/vulfocus:latest":
                        continue
                    single_img = ImageInfo.objects.filter(image_name__contains=item['image_name']).first()
                    if single_img.image_vul_name != item['image_vul_name'] or single_img.image_vul_name == "":
                        single_img.image_vul_name = item['image_vul_name']
                    if single_img.image_desc == "":
                        single_img.image_desc = item['image_desc']
                    if single_img.rank != item['rank']:
                        single_img.rank = item['rank']
                    if single_img.degree != item['degree']:
                        single_img.degree = json.dumps(item['degree'])
                    if "writeup_date" in item and single_img.writeup_date != item['writeup_date']:
                        single_img.writeup_date = item['writeup_date']
                    single_img.save()
                else:
                    if "writeup_date" in item:
                        writeup_date = item['writeup_date']
                    else:
                        writeup_date = ""
                    image_info = ImageInfo(image_name=item['image_name'], image_vul_name=item['image_vul_name'],
                                           image_desc=item['image_desc'], rank=item['rank'], degree=json.dumps(item['degree']),
                                           is_ok=False, create_date=timezone.now(), writeup_date=writeup_date,
                                           update_date=timezone.now())
                    image_info.save()
        return JsonResponse({"code": 200, "data": "成功"})
    except Exception as e:
        return JsonResponse({"code": 201, "data": e})
xulei1112 commented 1 year ago

修改项目目录下的vulfocus-api/dockerapi/views.py文件,修改get_timing_imgs函数,将vulfocus.fofa.so替换成vulfocus.io