├── .gitignore
├── client
├── .gitignore
├── package.json
├── public
│ ├── favicon.ico
│ └── index.html
└── src
│ ├── App.js
│ ├── app.css
│ ├── index.css
│ ├── index.js
│ └── logo.svg
└── server
├── Pipfile
├── Pipfile.lock
├── environment
├── __init__.py
├── admin.py
├── apps.py
├── migrations
│ └── __init__.py
├── models.py
├── serializers.py
├── tests.py
├── urls.py
└── views.py
├── manage.py
└── vulhub
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | __pycache__
3 | *.pyc
4 | .vscode
5 | .DS_Store
6 | db.sqlite3
7 | /meta/
--------------------------------------------------------------------------------
/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | **/node_modules
5 | # roadhog-api-doc ignore
6 | /src/utils/request-temp.js
7 | _roadhog-api-doc
8 |
9 | # production
10 | /dist
11 | /.vscode
12 |
13 | # misc
14 | .DS_Store
15 | npm-debug.log*
16 | yarn-error.log
17 |
18 | /coverage
19 | .idea
20 | yarn.lock
21 | package-lock.json
22 | *bak
23 | .vscode
24 |
25 | # visual studio code
26 | .history
27 | *.log
28 |
29 | functions/mock
30 | .temp/**
31 |
32 | # umi
33 | .umi
34 | .umi-production
35 |
36 | # screenshot
37 | screenshot
38 | .firebase# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
39 |
40 | # dependencies
41 | /node_modules
42 | /.pnp
43 | .pnp.js
44 |
45 | # testing
46 | /coverage
47 |
48 | # production
49 | /build
50 |
51 | # misc
52 | .DS_Store
53 | .env.local
54 | .env.development.local
55 | .env.test.local
56 | .env.production.local
57 |
58 | npm-debug.log*
59 | yarn-debug.log*
60 | yarn-error.log*
61 |
--------------------------------------------------------------------------------
/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "client",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "antd": "^3.11.2",
7 | "react": "^16.6.3",
8 | "react-dom": "^16.6.3",
9 | "react-scripts": "2.1.1"
10 | },
11 | "scripts": {
12 | "start": "react-scripts start",
13 | "build": "react-scripts build",
14 | "test": "react-scripts test",
15 | "eject": "react-scripts eject"
16 | },
17 | "eslintConfig": {
18 | "extends": "react-app"
19 | },
20 | "browserslist": [
21 | ">0.2%",
22 | "not dead",
23 | "not ie <= 11",
24 | "not op_mini all"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vulhub/vulhub-ui/1e3b6aecef882b21964224d448ca64ccf7a79708/client/public/favicon.ico
--------------------------------------------------------------------------------
/client/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
17 | React App
18 |
19 |
20 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component, Fragment } from 'react';
2 | import { Layout, Menu, Icon } from 'antd';
3 |
4 | import './app.css'
5 |
6 | const { Header, Sider, Content } = Layout;
7 |
8 | class App extends Component {
9 | state = {
10 | collapsed: false,
11 | };
12 |
13 | toggle = () => {
14 | this.setState({
15 | collapsed: !this.state.collapsed,
16 | });
17 | }
18 |
19 | render() {
20 | return (
21 |
22 |
27 |
28 |
42 |
43 |
44 |
51 |
55 | Content
56 |
57 |
58 |
59 | );
60 | }
61 | }
62 |
63 | export default App;
64 |
--------------------------------------------------------------------------------
/client/src/app.css:
--------------------------------------------------------------------------------
1 | #root .trigger {
2 | font-size: 18px;
3 | line-height: 64px;
4 | padding: 0 24px;
5 | cursor: pointer;
6 | transition: color .3s;
7 | }
8 |
9 | #root .trigger:hover {
10 | color: #1890ff;
11 | }
12 |
13 | #root .logo {
14 | height: 32px;
15 | background: rgba(255,255,255,.2);
16 | margin: 16px;
17 | }
--------------------------------------------------------------------------------
/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
6 | sans-serif;
7 | -webkit-font-smoothing: antialiased;
8 | -moz-osx-font-smoothing: grayscale;
9 | }
10 |
11 | code {
12 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
13 | monospace;
14 | }
15 |
--------------------------------------------------------------------------------
/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import 'antd/dist/antd.css';
4 | import './index.css';
5 | import App from './App';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
--------------------------------------------------------------------------------
/client/src/logo.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/server/Pipfile:
--------------------------------------------------------------------------------
1 | [[source]]
2 | url = "https://pypi.org/simple"
3 | verify_ssl = true
4 | name = "pypi"
5 |
6 | [packages]
7 | django = "*"
8 | djangorestframework = "*"
9 | markdown = "*"
10 | django-filter = "*"
11 |
12 | [dev-packages]
13 |
14 | [requires]
15 | python_version = "3.7"
16 |
--------------------------------------------------------------------------------
/server/Pipfile.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "hash": {
4 | "sha256": "13760cd6d273a68d354dd9f4494a7bdf453aa3a82ee95222a52861bd64f3428b"
5 | },
6 | "pipfile-spec": 6,
7 | "requires": {
8 | "python_version": "3.7"
9 | },
10 | "sources": [
11 | {
12 | "name": "pypi",
13 | "url": "https://pypi.org/simple",
14 | "verify_ssl": true
15 | }
16 | ]
17 | },
18 | "default": {
19 | "django": {
20 | "hashes": [
21 | "sha256:068d51054083d06ceb32ce02b7203f1854256047a0d58682677dd4f81bceabd7",
22 | "sha256:55409a056b27e6d1246f19ede41c6c610e4cab549c005b62cbeefabc6433356b"
23 | ],
24 | "index": "pypi",
25 | "version": "==2.1.4"
26 | },
27 | "django-filter": {
28 | "hashes": [
29 | "sha256:6f4e4bc1a11151178520567b50320e5c32f8edb552139d93ea3e30613b886f56",
30 | "sha256:86c3925020c27d072cdae7b828aaa5d165c2032a629abbe3c3a1be1edae61c58"
31 | ],
32 | "index": "pypi",
33 | "version": "==2.0.0"
34 | },
35 | "djangorestframework": {
36 | "hashes": [
37 | "sha256:607865b0bb1598b153793892101d881466bd5a991de12bd6229abb18b1c86136",
38 | "sha256:63f76cbe1e7d12b94c357d7e54401103b2e52aef0f7c1650d6c820ad708776e5"
39 | ],
40 | "index": "pypi",
41 | "version": "==3.9.0"
42 | },
43 | "markdown": {
44 | "hashes": [
45 | "sha256:c00429bd503a47ec88d5e30a751e147dcb4c6889663cd3e2ba0afe858e009baa",
46 | "sha256:d02e0f9b04c500cde6637c11ad7c72671f359b87b9fe924b2383649d8841db7c"
47 | ],
48 | "index": "pypi",
49 | "version": "==3.0.1"
50 | },
51 | "pytz": {
52 | "hashes": [
53 | "sha256:31cb35c89bd7d333cd32c5f278fca91b523b0834369e757f4c5641ea252236ca",
54 | "sha256:8e0f8568c118d3077b46be7d654cc8167fa916092e28320cde048e54bfc9f1e6"
55 | ],
56 | "version": "==2018.7"
57 | }
58 | },
59 | "develop": {}
60 | }
61 |
--------------------------------------------------------------------------------
/server/environment/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vulhub/vulhub-ui/1e3b6aecef882b21964224d448ca64ccf7a79708/server/environment/__init__.py
--------------------------------------------------------------------------------
/server/environment/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/server/environment/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class EnvironmentConfig(AppConfig):
5 | name = 'environment'
6 |
--------------------------------------------------------------------------------
/server/environment/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vulhub/vulhub-ui/1e3b6aecef882b21964224d448ca64ccf7a79708/server/environment/migrations/__init__.py
--------------------------------------------------------------------------------
/server/environment/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/server/environment/serializers.py:
--------------------------------------------------------------------------------
1 | from rest_framework import serializers
2 |
3 |
4 | class EnvironmentSerializer(serializers.Serializer):
5 | name = serializers.CharField()
6 | app = serializers.CharField()
7 | cve = serializers.CharField(allow_null=True)
8 | path = serializers.CharField()
9 | description = serializers.CharField(default='')
10 |
--------------------------------------------------------------------------------
/server/environment/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/server/environment/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, include
2 | from . import views
3 |
4 | app_name = 'environment'
5 | urlpatterns = [
6 | path('environments/', views.EnvironmentList.as_view(), name='environment-list'),
7 | path('environment//', views.EnvironmentDetail.as_view(), name='environment-detail'),
8 | ]
9 |
--------------------------------------------------------------------------------
/server/environment/views.py:
--------------------------------------------------------------------------------
1 | import json
2 |
3 | from pathlib import Path
4 | from rest_framework import generics, response, exceptions
5 | from django.conf import settings
6 | from django.http import Http404
7 | from . import serializers
8 |
9 |
10 | class InitialMixin(object):
11 | def initial(self, request, *args, **kwargs):
12 | with open(settings.VULHUB['CONF_FILE'], 'r', encoding='utf-8') as f:
13 | self.environments = json.load(f)
14 |
15 | super().initial(request, *args, **kwargs)
16 |
17 |
18 | class EnvironmentList(InitialMixin, generics.ListAPIView):
19 | serializer_class = serializers.EnvironmentSerializer
20 |
21 | def get_queryset(self):
22 | return self.environments
23 |
24 |
25 | class EnvironmentDetail(InitialMixin, generics.RetrieveAPIView):
26 | serializer_class = serializers.EnvironmentSerializer
27 |
28 | def get_queryset(self):
29 | return self.environments
30 |
31 | def get_object(self):
32 | path = self.kwargs['path']
33 | meta = next((meta for meta in self.get_queryset() if path == meta['path']), None)
34 |
35 | if meta is None:
36 | raise Http404
37 |
38 | dockerfile_cn = Path(settings.VULHUB['VULHUB_DIR']).joinpath(meta['path'], 'README.zh-cn.md')
39 | dockerfile = Path(settings.VULHUB['VULHUB_DIR']).joinpath(meta['path'], 'README.md')
40 | if dockerfile_cn.exists():
41 | meta['description'] = dockerfile_cn.read_text(encoding='utf-8')
42 | elif dockerfile.exists():
43 | meta['description'] = dockerfile.read_text(encoding='utf-8')
44 | else:
45 | raise Http404
46 |
47 | return meta
48 |
--------------------------------------------------------------------------------
/server/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == '__main__':
6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vulhub.settings')
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError as exc:
10 | raise ImportError(
11 | "Couldn't import Django. Are you sure it's installed and "
12 | "available on your PYTHONPATH environment variable? Did you "
13 | "forget to activate a virtual environment?"
14 | ) from exc
15 | execute_from_command_line(sys.argv)
16 |
--------------------------------------------------------------------------------
/server/vulhub/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vulhub/vulhub-ui/1e3b6aecef882b21964224d448ca64ccf7a79708/server/vulhub/__init__.py
--------------------------------------------------------------------------------
/server/vulhub/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for vulhub project.
3 |
4 | Generated by 'django-admin startproject' using Django 2.1.4.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/2.1/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/2.1/ref/settings/
11 | """
12 |
13 | import os
14 |
15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17 |
18 |
19 | # Quick-start development settings - unsuitable for production
20 | # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
21 |
22 | # SECURITY WARNING: keep the secret key used in production secret!
23 | SECRET_KEY = ')&5q#w#yzgd84pj93lgyi4y@+j5chb&ndcu#c#jo*ly)=+#cui'
24 |
25 | # SECURITY WARNING: don't run with debug turned on in production!
26 | DEBUG = True
27 |
28 | ALLOWED_HOSTS = []
29 |
30 |
31 | # Application definition
32 |
33 | INSTALLED_APPS = [
34 | 'django.contrib.admin',
35 | 'django.contrib.auth',
36 | 'django.contrib.contenttypes',
37 | 'django.contrib.sessions',
38 | 'django.contrib.messages',
39 | 'django.contrib.staticfiles',
40 | 'rest_framework',
41 | 'environment',
42 | ]
43 |
44 | MIDDLEWARE = [
45 | 'django.middleware.security.SecurityMiddleware',
46 | 'django.contrib.sessions.middleware.SessionMiddleware',
47 | 'django.middleware.common.CommonMiddleware',
48 | 'django.middleware.csrf.CsrfViewMiddleware',
49 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
50 | 'django.contrib.messages.middleware.MessageMiddleware',
51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
52 | ]
53 |
54 | ROOT_URLCONF = 'vulhub.urls'
55 |
56 | TEMPLATES = [
57 | {
58 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
59 | 'DIRS': [],
60 | 'APP_DIRS': True,
61 | 'OPTIONS': {
62 | 'context_processors': [
63 | 'django.template.context_processors.debug',
64 | 'django.template.context_processors.request',
65 | 'django.contrib.auth.context_processors.auth',
66 | 'django.contrib.messages.context_processors.messages',
67 | ],
68 | },
69 | },
70 | ]
71 |
72 | WSGI_APPLICATION = 'vulhub.wsgi.application'
73 |
74 |
75 | # Database
76 | # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
77 |
78 | DATABASES = {
79 | 'default': {
80 | 'ENGINE': 'django.db.backends.sqlite3',
81 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
82 | }
83 | }
84 |
85 |
86 | # Password validation
87 | # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
88 |
89 | AUTH_PASSWORD_VALIDATORS = [
90 | {
91 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
92 | },
93 | {
94 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
95 | },
96 | {
97 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
98 | },
99 | {
100 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
101 | },
102 | ]
103 |
104 |
105 | # Internationalization
106 | # https://docs.djangoproject.com/en/2.1/topics/i18n/
107 |
108 | LANGUAGE_CODE = 'en-us'
109 |
110 | TIME_ZONE = 'UTC'
111 |
112 | USE_I18N = True
113 |
114 | USE_L10N = True
115 |
116 | USE_TZ = True
117 |
118 |
119 | # Static files (CSS, JavaScript, Images)
120 | # https://docs.djangoproject.com/en/2.1/howto/static-files/
121 |
122 | STATIC_URL = '/static/'
123 |
124 |
125 | REST_FRAMEWORK = {
126 | # Use Django's standard `django.contrib.auth` permissions,
127 | # or allow read-only access for unauthenticated users.
128 | 'DEFAULT_PERMISSION_CLASSES': [
129 | 'rest_framework.permissions.AllowAny'
130 | ],
131 | 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
132 | 'PAGE_SIZE': 20
133 | }
134 |
135 |
136 | VULHUB = {
137 | 'CONF_FILE': os.path.join(BASE_DIR, '..', 'meta', 'environments.json'),
138 | 'CONF_MIRROR': 'https://raw.githubusercontent.com/vulhub/vulhub-org/master/src/environments.json',
139 | 'VULHUB_MIRROR': 'https://github.com/vulhub/vulhub.git',
140 | 'VULHUB_DIR': os.path.join(BASE_DIR, '..', 'meta', 'vulhub'),
141 | }
142 |
--------------------------------------------------------------------------------
/server/vulhub/urls.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 | from django.urls import path, include
3 |
4 | urlpatterns = [
5 | path('admin/', admin.site.urls),
6 | path('api-auth/', include('rest_framework.urls', namespace='auth')),
7 | path('api/', include('environment.urls', namespace='environment'))
8 | ]
9 |
--------------------------------------------------------------------------------
/server/vulhub/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for vulhub project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vulhub.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------