이경수

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.

from django.contrib.auth.forms import UserCreationForm
from django.forms import EmailField, URLField
from django import forms
from django.contrib.auth.models import User
class UserCreationForm(UserCreationForm):
email = EmailField(label=("이메일"), required=True,
help_text=("이메일을 등록하세요."))
repository = URLField(label=("레포지토리"), required=True,
help_text=("github 레포지토리를 등록하세요."))
class Meta:
model = User
fields = ("username", "email", "repository", "password1", "password2")
def save(self, commit=True):
user = super(UserCreationForm, self).save(commit=False)
user.email = self.cleaned_data["email"]
user.repository = self.cleaned_data["repository"]
if commit:
user.save()
return user
"""
Django settings for VulnNotti project.
Generated by 'django-admin startproject' using Django 1.11.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
import json
import pymysql
pymysql.install_as_MySQLdb()
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#d(%8qta!ku!4t_2o=m6tc!p2h0q^%p$173@pac1lgm@w1rphw'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = "*"
SITE_ID = 1
LOGIN_REDIRECT_URL = '/'
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
'crispy_forms',
'chartjs',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'VulnNotti.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
# Already defined Django-related contexts here
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'VulnNotti.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'vuln',
'USER': 'yhackerbv',
'PASSWORD': 'guswhd12',
'HOST': 'vulndb.cby38wfppa7l.us-east-2.rds.amazonaws.com',
'PORT': '3306'
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'ko-kr'
TIME_ZONE = 'Asia/Seoul'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
"""VulnNotti URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth import views
from VulnNotti.views import *
from django.conf import settings
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', HomeView.as_view(), name='home'),
url(r'^home/', HomeView.as_view(), name='home'),
url(r'^myapp/', include('myapp.urls', namespace='myapp')),
url(r'^accounts/', include('django.contrib.auth.urls')),
url(r'^accounts/register/$', UserCreateView.as_view(), name='register'),
url(r'^accounts/register/done$', UserCreateDoneTV.as_view(), name='register_done'),
]
from django.views.generic.base import TemplateView
from django.views.generic.edit import CreateView
from django.views import View
from django.urls import reverse_lazy
from django.contrib.auth.forms import UserCreationForm
from django.http import HttpResponseRedirect, HttpResponse
from VulnNotti.forms import *;
from django.shortcuts import redirect, render
class HomeView(View):
template_name = 'index.html'
def get(self, request, *args, **kwargs):
# if not request.user.is_authenticated(): # 로그인한 사용자만 가능
# return HttpResponseRedirect(reverse('login'))
#
# query = 'SELECT name, code FROM server WHERE 1=1'
# param_list = []
#
# with connection.cursor() as cursor:
# cursor.execute(query, param_list)
#
# columns = [column[0] for column in cursor.description]
# object_list = []
#
# for row in cursor.fetchall():
# object_list.append(dict(zip(columns, row)))
#
# context = {}
# context['form'] = ServerList_form
# context['object_list'] = object_list
return render(self.request, self.template_name)
def post(self, request, *args, **kwargs):
name = self.request.POST['name']
email = self.request.POST['email']
phone = self.request.POST['phone']
message = self.request.POST['message']
print(name, email, phone, message)
return render(self.request, self.template_name)
# form = self.form_class(request.POST)
# instance = self.request.POST['instance']
# ipaddr = self.request.POST['ipaddr']
#
# query = "INSERT INTO mysqldb VALUES (%s, %s);"
# param_list = []
# param_list.append(instance, ipaddr)
#
# with connection.cursor() as cursor:
# cursor.execute(query, param_list)
class UserCreateView(CreateView):
template_name = 'registration/register.html'
success_url = reverse_lazy('register_done')
form_class = UserCreationForm
class UserCreateDoneTV(TemplateView):
template_name = 'registration/register_done.html'
"""
WSGI config for VulnNotti project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "VulnNotti.settings")
application = get_wsgi_application()
No preview for this file type
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "VulnNotti.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
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.