이경수

merged web code

Showing 1000 changed files with 304 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +from django.contrib.auth.forms import UserCreationForm
2 +from django.forms import EmailField, URLField
3 +from django import forms
4 +from django.contrib.auth.models import User
5 +
6 +class UserCreationForm(UserCreationForm):
7 + email = EmailField(label=("이메일"), required=True,
8 + help_text=("이메일을 등록하세요."))
9 +
10 + repository = URLField(label=("레포지토리"), required=True,
11 + help_text=("github 레포지토리를 등록하세요."))
12 +
13 +
14 + class Meta:
15 + model = User
16 + fields = ("username", "email", "repository", "password1", "password2")
17 +
18 + def save(self, commit=True):
19 + user = super(UserCreationForm, self).save(commit=False)
20 + user.email = self.cleaned_data["email"]
21 + user.repository = self.cleaned_data["repository"]
22 + if commit:
23 + user.save()
24 + return user
1 +"""
2 +Django settings for VulnNotti project.
3 +
4 +Generated by 'django-admin startproject' using Django 1.11.5.
5 +
6 +For more information on this file, see
7 +https://docs.djangoproject.com/en/1.11/topics/settings/
8 +
9 +For the full list of settings and their values, see
10 +https://docs.djangoproject.com/en/1.11/ref/settings/
11 +"""
12 +
13 +import os
14 +import json
15 +import pymysql
16 +pymysql.install_as_MySQLdb()
17 +
18 +# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
19 +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
20 +
21 +
22 +# Quick-start development settings - unsuitable for production
23 +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
24 +
25 +# SECURITY WARNING: keep the secret key used in production secret!
26 +SECRET_KEY = '#d(%8qta!ku!4t_2o=m6tc!p2h0q^%p$173@pac1lgm@w1rphw'
27 +
28 +# SECURITY WARNING: don't run with debug turned on in production!
29 +DEBUG = True
30 +
31 +ALLOWED_HOSTS = "*"
32 +
33 +SITE_ID = 1
34 +
35 +LOGIN_REDIRECT_URL = '/'
36 +
37 +# Application definition
38 +
39 +INSTALLED_APPS = [
40 + 'django.contrib.admin',
41 + 'django.contrib.auth',
42 + 'django.contrib.sites',
43 + 'django.contrib.contenttypes',
44 + 'django.contrib.sessions',
45 + 'django.contrib.messages',
46 + 'django.contrib.staticfiles',
47 + 'myapp',
48 + 'crispy_forms',
49 + 'chartjs',
50 +]
51 +
52 +MIDDLEWARE = [
53 + 'django.middleware.security.SecurityMiddleware',
54 + 'django.contrib.sessions.middleware.SessionMiddleware',
55 + 'django.middleware.common.CommonMiddleware',
56 + 'django.middleware.csrf.CsrfViewMiddleware',
57 + 'django.contrib.auth.middleware.AuthenticationMiddleware',
58 + 'django.contrib.messages.middleware.MessageMiddleware',
59 + 'django.middleware.clickjacking.XFrameOptionsMiddleware',
60 +]
61 +
62 +ROOT_URLCONF = 'VulnNotti.urls'
63 +
64 +TEMPLATES = [
65 + {
66 + 'BACKEND': 'django.template.backends.django.DjangoTemplates',
67 + 'DIRS': [os.path.join(BASE_DIR, 'templates')],
68 + 'APP_DIRS': True,
69 + 'OPTIONS': {
70 + 'context_processors': [
71 + # Already defined Django-related contexts here
72 + 'django.template.context_processors.debug',
73 + 'django.template.context_processors.request',
74 + 'django.contrib.auth.context_processors.auth',
75 + 'django.contrib.messages.context_processors.messages',
76 + ],
77 + },
78 + },
79 +]
80 +
81 +WSGI_APPLICATION = 'VulnNotti.wsgi.application'
82 +
83 +
84 +# Database
85 +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
86 +
87 +DATABASES = {
88 + 'default': {
89 + 'ENGINE': 'django.db.backends.mysql',
90 + 'NAME': 'vuln',
91 + 'USER': 'yhackerbv',
92 + 'PASSWORD': 'guswhd12',
93 + 'HOST': 'vulndb.cby38wfppa7l.us-east-2.rds.amazonaws.com',
94 + 'PORT': '3306'
95 + }
96 +}
97 +
98 +
99 +# Password validation
100 +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
101 +
102 +AUTH_PASSWORD_VALIDATORS = [
103 + {
104 + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
105 + },
106 + {
107 + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
108 + },
109 + {
110 + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
111 + },
112 + {
113 + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
114 + },
115 +]
116 +
117 +
118 +# Internationalization
119 +# https://docs.djangoproject.com/en/1.11/topics/i18n/
120 +
121 +LANGUAGE_CODE = 'ko-kr'
122 +
123 +TIME_ZONE = 'Asia/Seoul'
124 +
125 +USE_I18N = True
126 +
127 +USE_L10N = True
128 +
129 +USE_TZ = True
130 +
131 +
132 +# Static files (CSS, JavaScript, Images)
133 +# https://docs.djangoproject.com/en/1.11/howto/static-files/
134 +
135 +STATIC_URL = '/static/'
136 +# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
137 +STATICFILES_DIRS = [
138 + os.path.join(BASE_DIR, 'static')
139 +]
1 +"""VulnNotti URL Configuration
2 +
3 +The `urlpatterns` list routes URLs to views. For more information please see:
4 + https://docs.djangoproject.com/en/1.11/topics/http/urls/
5 +Examples:
6 +Function views
7 + 1. Add an import: from my_app import views
8 + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9 +Class-based views
10 + 1. Add an import: from other_app.views import Home
11 + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12 +Including another URLconf
13 + 1. Import the include() function: from django.conf.urls import url, include
14 + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15 +"""
16 +from django.conf.urls import url, include
17 +from django.contrib import admin
18 +from django.contrib.auth import views
19 +from VulnNotti.views import *
20 +from django.conf import settings
21 +
22 +
23 +urlpatterns = [
24 + url(r'^admin/', admin.site.urls),
25 + url(r'^$', HomeView.as_view(), name='home'),
26 + url(r'^home/', HomeView.as_view(), name='home'),
27 + url(r'^myapp/', include('myapp.urls', namespace='myapp')),
28 +
29 + url(r'^accounts/', include('django.contrib.auth.urls')),
30 + url(r'^accounts/register/$', UserCreateView.as_view(), name='register'),
31 + url(r'^accounts/register/done$', UserCreateDoneTV.as_view(), name='register_done'),
32 +
33 +]
1 +from django.views.generic.base import TemplateView
2 +from django.views.generic.edit import CreateView
3 +from django.views import View
4 +from django.urls import reverse_lazy
5 +from django.contrib.auth.forms import UserCreationForm
6 +from django.http import HttpResponseRedirect, HttpResponse
7 +from VulnNotti.forms import *;
8 +from django.shortcuts import redirect, render
9 +
10 +class HomeView(View):
11 + template_name = 'index.html'
12 +
13 + def get(self, request, *args, **kwargs):
14 +
15 + # if not request.user.is_authenticated(): # 로그인한 사용자만 가능
16 + # return HttpResponseRedirect(reverse('login'))
17 + #
18 + # query = 'SELECT name, code FROM server WHERE 1=1'
19 + # param_list = []
20 + #
21 + # with connection.cursor() as cursor:
22 + # cursor.execute(query, param_list)
23 + #
24 + # columns = [column[0] for column in cursor.description]
25 + # object_list = []
26 + #
27 + # for row in cursor.fetchall():
28 + # object_list.append(dict(zip(columns, row)))
29 + #
30 + # context = {}
31 + # context['form'] = ServerList_form
32 + # context['object_list'] = object_list
33 +
34 +
35 +
36 + return render(self.request, self.template_name)
37 +
38 + def post(self, request, *args, **kwargs):
39 +
40 + name = self.request.POST['name']
41 + email = self.request.POST['email']
42 + phone = self.request.POST['phone']
43 + message = self.request.POST['message']
44 +
45 + print(name, email, phone, message)
46 +
47 +
48 + return render(self.request, self.template_name)
49 +
50 +
51 + # form = self.form_class(request.POST)
52 + # instance = self.request.POST['instance']
53 + # ipaddr = self.request.POST['ipaddr']
54 + #
55 + # query = "INSERT INTO mysqldb VALUES (%s, %s);"
56 + # param_list = []
57 + # param_list.append(instance, ipaddr)
58 + #
59 + # with connection.cursor() as cursor:
60 + # cursor.execute(query, param_list)
61 +
62 +
63 +
64 +class UserCreateView(CreateView):
65 + template_name = 'registration/register.html'
66 + success_url = reverse_lazy('register_done')
67 + form_class = UserCreationForm
68 +
69 +class UserCreateDoneTV(TemplateView):
70 + template_name = 'registration/register_done.html'
1 +"""
2 +WSGI config for VulnNotti 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/1.11/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", "VulnNotti.settings")
15 +
16 +application = get_wsgi_application()
No preview for this file type
1 +#!/usr/bin/env python
2 +import os
3 +import sys
4 +
5 +if __name__ == "__main__":
6 + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "VulnNotti.settings")
7 + try:
8 + from django.core.management import execute_from_command_line
9 + except ImportError:
10 + # The above import may fail for some other reason. Ensure that the
11 + # issue is really that Django is missing to avoid masking other
12 + # exceptions on Python 2.
13 + try:
14 + import django
15 + except ImportError:
16 + raise ImportError(
17 + "Couldn't import Django. Are you sure it's installed and "
18 + "available on your PYTHONPATH environment variable? Did you "
19 + "forget to activate a virtual environment?"
20 + )
21 + raise
22 + execute_from_command_line(sys.argv)
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.