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

0.3.2.11 #268

Merged
merged 3 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions vulfocus-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM python:3.7-alpine3.15
LABEL maintainer="vulfocus" version="0.3.2.11" description="Vulfocus for Docker"

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add gcc g++ libzip-dev jpeg-dev libffi-dev freetype-dev

RUN mkdir /vulfocus-api/
WORKDIR /vulfocus-api/
ADD . /vulfocus-api/

ENV VUL_IP=""
ENV EMAIL_HOST=""
ENV EMAIL_HOST_USER=""
ENV EMAIL_HOST_PASSWORD=""
ENV DOCKER_URL="unix://var/run/docker.sock"


RUN python3 -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package -r requirements.txt

EXPOSE 8000

CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
Binary file modified vulfocus-api/db.sqlite3
Binary file not shown.
12 changes: 8 additions & 4 deletions vulfocus-api/layout_image/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,8 @@ def upload_zip_file(request):
for single_network in docker_networks:
config_list = single_network.attrs['IPAM']['Config']
for single_config in config_list:
network_list.append(single_config["Gateway"].split(".")[0:2])
if "Gateway" in single_config:
network_list.append(single_config["Gateway"].split(".")[0:2])
if single_network.name == network_name:
network_name_temp = network_name
network_name = str(uuid.uuid4())
Expand Down Expand Up @@ -1392,7 +1393,8 @@ def upload_zip_file(request):
return JsonResponse({"code": 400, "msg": "编排环境中子网或者网关设置错误"})
net_work_client_id = str(net_work.id)
if not gateway:
gateway = net_work.attrs['IPAM']['Config']['Gateway']
if "Gateway" in net_work.attrs['IPAM']['Config']:
gateway = net_work.attrs['IPAM']['Config']['Gateway']
created_network = NetWorkInfo(net_work_id=str(uuid.uuid4()),
net_work_client_id=net_work_client_id,
create_user=user.id,
Expand Down Expand Up @@ -1646,7 +1648,8 @@ def download_official_website_layout(request):
for single_network in docker_networks:
config_list = single_network.attrs['IPAM']['Config']
for single_config in config_list:
network_list.append(single_config["Gateway"].split(".")[0:2])
if "Gateway" in single_config:
network_list.append(single_config["Gateway"].split(".")[0:2])
if single_network.name == network_name:
network_name_temp = network_name
network_name = str(uuid.uuid4())
Expand Down Expand Up @@ -1679,7 +1682,8 @@ def download_official_website_layout(request):
return JsonResponse({"code": 400, "msg": "编排环境中子网或者网关设置错误"})
net_work_client_id = str(net_work.id)
if not gateway:
gateway = net_work.attrs['IPAM']['Config']['Gateway']
if "Gateway" in net_work.attrs['IPAM']['Config']:
gateway = net_work.attrs['IPAM']['Config']['Gateway']
created_network = NetWorkInfo(net_work_id=str(uuid.uuid4()),
net_work_client_id=net_work_client_id,
create_user=user.id,
Expand Down
22 changes: 16 additions & 6 deletions vulfocus-api/vulfocus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,28 @@
'notice',
]

# redis host
REDIS_HOST = "127.0.0.1"
REDIS_HOST = os.environ.get('REDIS_HOST')
if not REDIS_HOST or REDIS_HOST == '':
REDIS_HOST = "127.0.0.1"

# redis port
REDIS_PORT = 6379
REDIS_PORT = os.environ.get('REDIS_PORT')
if not REDIS_PORT or REDIS_PORT == '' or REDIS_PORT == 0:
REDIS_PORT = "6379"

# redis pass
REDIS_PASS = ""
REDIS_PASS = os.environ.get('REDIS_PASS')
if not REDIS_PASS or REDIS_PASS == '':
REDIS_PASS = ""

if REDIS_PASS:
CELERY_BROKER_URL = "redis://:%s@%s:%s/0" % (REDIS_PASS, str(REDIS_HOST), str(REDIS_PORT))
REDIS_POOL = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASS, decode_responses=True, db=1)
REDIS_POOL = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASS, decode_responses=True,
db=1)
else:
CELERY_BROKER_URL = 'redis://%s:%s/0' % (REDIS_HOST, str(REDIS_PORT))
REDIS_POOL = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), decode_responses=True,db=1)
REDIS_POOL = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), decode_responses=True, db=1)

if REDIS_PASS:
REDIS_IMG = redis.Redis(host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASS, db=6, decode_responses=True)
REDIS_USER_CACHE = redis.Redis(host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASS, db=7, decode_responses=True)
Expand Down