Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ksk2kk opened this issue Feb 11, 2023 · 3 comments
Closed

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

ksk2kk opened this issue Feb 11, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ksk2kk
Copy link

ksk2kk commented Feb 11, 2023

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

操作系统: kalilinux

内核版本:Debian

Python 环境版本:3.10

Vulfocus 版本:最新版

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

@ksk2kk ksk2kk added the bug Something isn't working label Feb 11, 2023
@zhoutianzi
Copy link

+1

@awsl404
Copy link

awsl404 commented Mar 14, 2023

获取的镜像信息的格式换了,需要修改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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants