Giter Site home page Giter Site logo

Comments (3)

awsl404 avatar awsl404 commented on August 18, 2024 3

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

from vulfocus.

zhoutianzi avatar zhoutianzi commented on August 18, 2024

+1

from vulfocus.

xulei1112 avatar xulei1112 commented on August 18, 2024

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

from vulfocus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.