Skip to content
This repository was archived by the owner on Dec 23, 2020. It is now read-only.

配置好数据库之后运行报错 #6

Closed
nullptrKey opened this issue Nov 9, 2016 · 10 comments
Closed

配置好数据库之后运行报错 #6

nullptrKey opened this issue Nov 9, 2016 · 10 comments

Comments

@nullptrKey
Copy link

配置好数据库账号密码之后,
运行python manage.py makemigrations scanner报错
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/SQLiScanner/venv/lib/python3.5/site-packages/django/core/management/init.py", line 350, in execute_from_command_line
utility.execute()
File "/SQLiScanner/venv/lib/python3.5/site-packages/django/core/management/init.py", line 302, in execute
settings.INSTALLED_APPS
File "/SQLiScanner/venv/lib/python3.5/site-packages/django/conf/init.py", line 55, in getattr
self._setup(name)
File "/SQLiScanner/venv/lib/python3.5/site-packages/django/conf/init.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/SQLiScanner/venv/lib/python3.5/site-packages/django/conf/init.py", line 99, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/SQLiScanner/venv/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 669, in exec_module
File "", line 775, in get_code
File "", line 735, in source_to_code
File "", line 222, in _call_with_frames_removed
File "/SQLiScanner/SQLiScanner/settings.py", line 2
Django settings for SQLiScanner project.
^
SyntaxError: invalid syntax

@0xbug
Copy link
Owner

0xbug commented Nov 9, 2016

@99bt File "/SQLiScanner/SQLiScanner/settings.py", line 2 Django settings for SQLiScanner project. ^ SyntaxError: invalid syntax 应该是编辑 SQLiScanner/settings.py 的时候删掉某些东西了,可否提供一下脱敏后的SQLiScanner/settings.py

@nullptrKey
Copy link
Author

nullptrKey commented Nov 9, 2016

@0xbug

(venv) root@kali:/SQLiScanner# cat SQLiScanner/settings.py 

Django settings for SQLiScanner project.

Generated by 'django-admin startproject' using Django 1.9.

For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""

import os
import djcelery

# 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.9/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'p2mot&vgzvk2a93zsp5t173b6oe=ye43po!t%6((v*w(1ike7-'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'rest_framework',
    'django_filters',
    'corsheaders',
    'djcelery',
    'scanner',
]

MIDDLEWARE_CLASSES = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'SQLiScanner.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'SQLiScanner.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'sqltest',
        'USER': 'sqltest',
        'PASSWORD': 'sqltest',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}


# Password validation
# https://docs.djangoproject.com/en/1.9/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.9/topics/i18n/

LANGUAGE_CODE = 'zh-Hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = False


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_URL = '/static/'
# STATIC_ROOT = [os.path.join(BASE_DIR, "static/"), BASE_DIR]
STATIC_ROOT = os.path.join(BASE_DIR, "/static/")
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/"), BASE_DIR]

# Celery

djcelery.setup_loader()
BROKER_URL = "redis://localhost:6379"
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'

# CORS

CORS_ORIGIN_ALLOW_ALL = True

# REST_FRAMEWORK

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.SessionAuthentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    ),
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 10,
    # 'DATETIME_FORMAT': ("%m-%d %H:%M"),
}

# Email

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = False
EMAIL_HOST = ''
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
DEFAULT_FROM_EMAIL = ''

@nullptrKey
Copy link
Author

@0xbug 这个是我的数据库的状态

root@kali:/# service postgresql status 
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; disabled; vendor pres
   Active: active (exited) since Wed 2016-11-09 01:59:53 EST; 6min ago
  Process: 1486 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 1486 (code=exited, status=0/SUCCESS)

Nov 09 01:59:53 kali systemd[1]: Starting PostgreSQL RDBMS...
Nov 09 01:59:53 kali systemd[1]: Started PostgreSQL RDBMS.

@nullptrKey
Copy link
Author

@0xbug 是少了3个“符号,我真是太粗心了

@0xbug
Copy link
Owner

0xbug commented Nov 9, 2016

@99bt 仔细看报错信息就能发现问题啦,哈哈

@nullptrKey
Copy link
Author

@0xbug 安装好之后是挂本地代理使用吗?

@0xbug
Copy link
Owner

0xbug commented Nov 9, 2016

@99bt 嗯,目前支持上传 har 文件;可以用 Charles 做代理然后保存请求为 har 格式,也可以用 Charles 打开 pcap 文件然后再导出为 har 格式

@nullptrKey
Copy link
Author

@0xbug 好的,就说要先浏览器浏览一遍网页之后,然后倒入进去扫描对吧?

@0xbug
Copy link
Owner

0xbug commented Nov 9, 2016

@99bt 对,有时间可以研究研究 Charles里面的设置项

@nullptrKey
Copy link
Author

@0xbug 好的,

@0xbug 0xbug closed this as completed Nov 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants