commit df7f7550353859ac26e8381b420d9c693edc806d Author: 陈冠林 Date: Tue Dec 4 15:41:58 2018 +0800 VPN_CGI创建 diff --git a/CGI_config.conf b/CGI_config.conf new file mode 100644 index 0000000..7c79a44 --- /dev/null +++ b/CGI_config.conf @@ -0,0 +1,5 @@ +[server] +server_pwd=111111 +[redis] +host=192.168.10.180 +port=26379 diff --git a/VPN_CGI/__init__.py b/VPN_CGI/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/VPN_CGI/__pycache__/__init__.cpython-36.pyc b/VPN_CGI/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..f8237ee Binary files /dev/null and b/VPN_CGI/__pycache__/__init__.cpython-36.pyc differ diff --git a/VPN_CGI/__pycache__/settings.cpython-36.pyc b/VPN_CGI/__pycache__/settings.cpython-36.pyc new file mode 100644 index 0000000..8fc1cbd Binary files /dev/null and b/VPN_CGI/__pycache__/settings.cpython-36.pyc differ diff --git a/VPN_CGI/__pycache__/urls.cpython-36.pyc b/VPN_CGI/__pycache__/urls.cpython-36.pyc new file mode 100644 index 0000000..91c423f Binary files /dev/null and b/VPN_CGI/__pycache__/urls.cpython-36.pyc differ diff --git a/VPN_CGI/__pycache__/wsgi.cpython-36.pyc b/VPN_CGI/__pycache__/wsgi.cpython-36.pyc new file mode 100644 index 0000000..11492fc Binary files /dev/null and b/VPN_CGI/__pycache__/wsgi.cpython-36.pyc differ diff --git a/VPN_CGI/settings.py b/VPN_CGI/settings.py new file mode 100644 index 0000000..443069e --- /dev/null +++ b/VPN_CGI/settings.py @@ -0,0 +1,120 @@ +""" +Django settings for VPN_CGI project. + +Generated by 'django-admin startproject' using Django 2.1. + +For more information on this file, see +https://docs.djangoproject.com/en/2.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.1/ref/settings/ +""" + +import os + +# 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/2.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'tpnj_u$-4ymf6_#m9m+hecrsaa0@ouvr8&_!9xs#p2($mnp27!' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = ['192.168.11.137', 'localhost', '127.0.0.1','192.168.10.220'] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +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 = 'VPN_CGI.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + '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 = 'VPN_CGI.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.1/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/2.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.1/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/VPN_CGI/urls.py b/VPN_CGI/urls.py new file mode 100644 index 0000000..e6063b7 --- /dev/null +++ b/VPN_CGI/urls.py @@ -0,0 +1,21 @@ +"""VPN_CGI URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/2.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import include, path +urlpatterns = [ + path('command/', include('command.urls')), + path('admin/', admin.site.urls), +] \ No newline at end of file diff --git a/VPN_CGI/wsgi.py b/VPN_CGI/wsgi.py new file mode 100644 index 0000000..ada8d65 --- /dev/null +++ b/VPN_CGI/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for VPN_CGI 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/2.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'VPN_CGI.settings') + +application = get_wsgi_application() diff --git a/command/CGI_config.conf b/command/CGI_config.conf new file mode 100644 index 0000000..a0e5aa3 --- /dev/null +++ b/command/CGI_config.conf @@ -0,0 +1,2 @@ +[server] +server_pwd=111111 \ No newline at end of file diff --git a/command/CGI_config.conf.txt b/command/CGI_config.conf.txt new file mode 100644 index 0000000..a0e5aa3 --- /dev/null +++ b/command/CGI_config.conf.txt @@ -0,0 +1,2 @@ +[server] +server_pwd=111111 \ No newline at end of file diff --git a/command/__init__.py b/command/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/command/__pycache__/__init__.cpython-36.pyc b/command/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..907673e Binary files /dev/null and b/command/__pycache__/__init__.cpython-36.pyc differ diff --git a/command/__pycache__/urls.cpython-36.pyc b/command/__pycache__/urls.cpython-36.pyc new file mode 100644 index 0000000..bb33926 Binary files /dev/null and b/command/__pycache__/urls.cpython-36.pyc differ diff --git a/command/__pycache__/views.cpython-36.pyc b/command/__pycache__/views.cpython-36.pyc new file mode 100644 index 0000000..7e2d71c Binary files /dev/null and b/command/__pycache__/views.cpython-36.pyc differ diff --git a/command/admin.py b/command/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/command/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/command/apps.py b/command/apps.py new file mode 100644 index 0000000..af2c2b4 --- /dev/null +++ b/command/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class CommandConfig(AppConfig): + name = 'command' diff --git a/command/migrations/__init__.py b/command/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/command/models.py b/command/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/command/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/command/stat_ip_redis.py b/command/stat_ip_redis.py new file mode 100644 index 0000000..4c9f4ee --- /dev/null +++ b/command/stat_ip_redis.py @@ -0,0 +1,188 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Nov 21 16:04:46 2018 + +@author: dell +""" +#%% +import redis +from pandas import DataFrame +import sys +import getopt +import os +#%% + +class Redis: + def __init__(self,host,port): + self.host=host + self.port=port + def connect(self): + try: + pool = redis.ConnectionPool(host=self.host, port=self.port, db=0,decode_responses=True) + r = redis.StrictRedis(connection_pool=pool) + except redis.RedisError as e:# Exception,e:print(str(e)) + print("Error:"+str(e)) + sys.exit(2) + try: + connect_result=r.ping() + except redis.ConnectionError: + print("Error:can not connect to redis server with host:"+self.host+" and port:"+self.port) + sys.exit(2) + else: + if connect_result==True: + self.r=r + else: + print("Error:Ping the Redis server returns not True, check again.") + sys.exit(2) + +# #%% +# def IpExist(candidate_ip):# IpExist(candidate_ip) +# ret=[] +# if candidate_ip in iplist_DF: +# ret.append("Ip found") +# else: +# ret.append("Ip not found") +# return ret + +# def IpNumGet(group_id):# IpNumGet(group_id) +# ret=[] +# if group_id in grpby_group_cnt_DF.index: +# ret.append(grpby_group_cnt_DF[group_id]) +# return ret + +# def AllIpGet(group_id):# AllIpGet(group_id) +# ret=[] +# if group_id in grpby_group_keys_DF: +# for i in grpby_group_DF.get_group(group_id): +# ret.append(i) +# return ret +# #%% +# def main(argv): +# global iplist_DF +# global grpby_group_cnt_DF +# global grpby_group_DF +# global grpby_group_keys_DF +# col_DF=["config_id","addr_pool_id","addr_type","ip_addr","location","mrl_ip",\ +# "link_id","encap_type","direction","outer_sport","outer_dport","outer_sip",\ +# "outer_dip","outer_smac","outer_dmac","inner_smac","inner_dmac",\ +# "is_valid","op_time"] +# DF=DataFrame(None,columns=col_DF) + +# try: +# opts,args=getopt.getopt(argv,"hf:g:",\ +# ["help","host=","port=","ip="]) +# except getopt.GetoptError: +# print("stat_ip_redis.py --host --port --ip "+"\n"+"\ +# -f -g "+"\n"+"\ +# -h --help ") +# sys.exit(2) +# for opt, arg in opts: +# if opt in ("-h", "--help"): +# print("stat_ip_redis.py --host --port --ip \ +# -f -g ") +# print("-f :\te:IpExist\tn:IpNumGet\ta:AllIpGet") +# sys.exit() +# elif opt in ("--host"): +# host=arg +# elif opt in ("--port"): +# port=arg +# elif opt in ("-f"): +# func=arg +# if func not in ["e","n","a"]: +# print("Need inputting available statistics function requirements.") +# sys.exit() +# elif opt in ("-g"): +# group_id=arg +# elif opt in ("--ip"): +# ip_addr=arg +# try: +# host,port,func +# except NameError: +# print("Error:Need inputting -h -p -f ") +# sys.exit(2) + +# P=Redis(host,port) +# P.connect() +# scan_CANDIDATE=P.r.scan_iter(match="EFFECTIVE_RULE:IR_CANDIDATE_IP*") +# for i in scan_CANDIDATE: +# DF.loc[i]=P.r.get(i).split("\t") + +# if func=="e":#function of IpExist,need parameters:candidate_ip(ip_addr) +# try: +# ip_addr +# except NameError: +# print("Error:miss parameters") +# sys.exit(2) +# else: +# iplist_DF=list(DF['ip_addr'].drop_duplicates()) +# return IpExist(ip_addr) + +# elif func=="n":#function of IpNumGet, need parameters:group_id +# try: +# group_id +# except NameError: +# print("Error:miss parameters") +# sys.exit(2) +# else: +# ipgroup_sel_DF=DF[['addr_pool_id','ip_addr']].drop_duplicates() +# grpby_group_DF=ipgroup_sel_DF["ip_addr"].groupby(ipgroup_sel_DF['addr_pool_id']) +# grpby_group_cnt_DF=grpby_group_DF.count() +# return IpNumGet(group_id) + +# elif func=="a":#function of AllIpGet, need parameters:group_id +# try: +# group_id +# except NameError: +# print("Error:miss parameters") +# sys.exit(2) +# else: +# ipgroup_sel_DF=DF[['addr_pool_id','ip_addr']].drop_duplicates() +# grpby_group_DF=ipgroup_sel_DF["ip_addr"].groupby(ipgroup_sel_DF['addr_pool_id']) +# grpby_group_keys_DF=grpby_group_DF.groups.keys() +# return AllIpGet(group_id) + + +#%% +# if __name__ == "__main__": +# stat_result=main(sys.argv[1:]) +# print(stat_result) +# os._exit(0) + +def IpExist(host,port,candidate_ip): + P=Redis(host,port) + P.connect() + scan_CANDIDATE=P.r.scan_iter(match="EFFECTIVE_RULE:IR_CANDIDATE_IP*") + for i in scan_CANDIDATE: + DF.loc[i]=P.r.get(i).split("\t") + iplist_DF=list(DF['ip_addr'].drop_duplicates()) + if candidate_ip in iplist_DF: + return True + else: + return False + +def IpNumGet(host,port,group_id):# IpNumGet(group_id) + P=Redis(host,port) + P.connect() + scan_CANDIDATE=P.r.scan_iter(match="EFFECTIVE_RULE:IR_CANDIDATE_IP*") + ipgroup_sel_DF=DF[['addr_pool_id','ip_addr']].drop_duplicates() + grpby_group_DF=ipgroup_sel_DF["ip_addr"].groupby(ipgroup_sel_DF['addr_pool_id']) + grpby_group_cnt_DF=grpby_group_DF.count() + if group_id in grpby_group_cnt_DF.index: + return grpby_group_cnt_DF[group_id] + else + return 0 + +def AllIpGet(host,port,group_id):# AllIpGet(group_id) + P=Redis(host,port) + P.connect() + scan_CANDIDATE=P.r.scan_iter(match="EFFECTIVE_RULE:IR_CANDIDATE_IP*") + for i in scan_CANDIDATE: + DF.loc[i]=P.r.get(i).split("\t") + ipgroup_sel_DF=DF[['addr_pool_id','ip_addr']].drop_duplicates() + grpby_group_DF=ipgroup_sel_DF["ip_addr"].groupby(ipgroup_sel_DF['addr_pool_id']) + grpby_group_keys_DF=grpby_group_DF.groups.keys() + ret=list() + if group_id in grpby_group_keys_DF: + for i in grpby_group_DF.get_group(group_id): + ret.append(i) + return ret \ No newline at end of file diff --git a/command/tests.py b/command/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/command/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/command/urls.py b/command/urls.py new file mode 100644 index 0000000..f94d9ff --- /dev/null +++ b/command/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('',views.command,name='command'), +] \ No newline at end of file diff --git a/command/views.py b/command/views.py new file mode 100644 index 0000000..fd84e09 --- /dev/null +++ b/command/views.py @@ -0,0 +1,583 @@ +from django.shortcuts import render +from django.http import HttpResponse +import subprocess +import shlex +import json +import configparser +import re +import redis +# from pandas import DataFrame +import sys +import getopt +import os + +command_dic={'vpncmd':'vpncmd','server':'/SERVER','password':'/PASSWORD:','cmd':'/CMD','hub':'/HUB:', + 'secret':'/SECRET:','retry_interval':'/RETRY_INTERVAL:','group':'/GROUP:','realname':'/REALNAME:','note':'/NOTE:', + 'alias':'/ALIAS:','name':'/NAME:','value':'/VALUE:','client':'/CLIENT','username':'/USERNAME:','nicname':'/NICNAME:', + 'type':'/TYPE:','start':'/START:','expire':'/EXPIRE:','gw':'/GW:','dns':'/DNS:','dns2':'/DNS2:','domain':'/DOMAIN:', + 'log':'/LOG:','mac':'/MAC:','ip':'/IP:','mtu':'/MTU:','tcptimeout':'/TCPTIMEOUT:','udptimeout':'/UDPTIMEOUT:','device':'/DEVICE:', + 'l2tp':'/L2TP:','l2tpraw':'/L2TPRAW:','etherip':'/ETHERIP:','psk':'/PSK:','defaulthub':'/DEFAULTHUB:','adminhub':'/ADMINHUB:', + 'csv':'/CSV'} +response_dic={'miss':'miss parameters.', + 'exist':'The user with the specified name already exists on the Virtual Hub.', + 'success':'The command completed successfully.', + 'not_found':'Object not found.', + 'error':'The command execute failed.' + } +# col_DF=["config_id","addr_pool_id","addr_type","ip_addr","location","mrl_ip",\ +# "link_id","encap_type","direction","outer_sport","outer_dport","outer_sip",\ +# "outer_dip","outer_smac","outer_dmac","inner_smac","inner_dmac",\ +# "is_valid","op_time"] +class Redis: + def __init__(self,host,port): + self.host=host + self.port=port + def connect(self): + try: + pool = redis.ConnectionPool(host=self.host, port=self.port, db=0,decode_responses=True) + r = redis.StrictRedis(connection_pool=pool) + except redis.RedisError as e:# Exception,e:print(str(e)) + print("Error:"+str(e)) + return -1,"Error:"+str(e) + # sys.exit(2) + try: + connect_result=r.ping() + except redis.ConnectionError: + print("Error:can not connect to redis server with host:"+self.host+" and port:"+self.port) + return -1,"Error:can not connect to redis server with host:"+self.host+" and port:"+self.port + # sys.exit(2) + else: + if connect_result==True: + self.r=r + return 0,"success" + else: + print("Error:Ping the Redis server returns not True, check again.") + return -1,"Error:Ping the Redis server returns not True, check again." + # sys.exit(2) +# http:\\localhost:8090\command?cmd_obj=server&cmd=UserCreate&server_pwd=111111&hub_name=NewHub0&hub_pwd=111111&user_name=*&group=none&realname=none¬e=none +# Create your views here. +def command(request): + # if username == "" and password = "" : + server_pwd,host,port=readconfig() + if request.method=='GET': + cmd_obj=request.GET.get('cmd_obj',default='server') + if cmd_obj=='server': + command=request.GET.get('cmd',default=None) + server_ip=request.GET.get('server_ip',default=None) + if(command==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + elif(command=='IpExist'): + candidate_ip=request.GET.get('candidate_ip',default=None) + print(candidate_ip) + if(candidate_ip==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + else: + rtn_code,outs=IpExist(host,port,candidate_ip) + my_dict=dict() + if(rtn_code==0): + my_dict['response']=outs + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + my_dict['error']=outs + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + elif(command=='IpNumGet'): + addr_pool_id=request.GET.get('addr_pool_id',default=None) + if(addr_pool_id==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + else: + rtn_code,outs=IpNumGet(host,port,addr_pool_id) + my_dict=dict() + if(rtn_code!=-1): + my_dict['response']=response_dic['success'] + my_dict['num']=rtn_code + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + my_dict['error']=outs + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + elif(command=='AllIpGet'): + addr_pool_id=request.GET.get('addr_pool_id',default=None) + if(addr_pool_id==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + else: + rtn_code,outs=AllIpGet(host,port,addr_pool_id) + my_dict=dict() + if(rtn_code!=-1): + my_dict['response']=response_dic['success'] + my_dict['candidate_ip']=outs + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + my_dict['error']=outs + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + elif(server_ip==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + else: + server_cmd=command_dic['vpncmd']+' '+server_ip+' '+command_dic['server'] + # if(command=='ServerPasswordSet'): + # server_pwd=request.GET.get('server_pwd',default='111111') + # old_server_pwd=request.GET.get('old_server_pwd',default=None) + # if(old_server_pwd==None): + # command=server_cmd+command+' '+server_pwd + # else: + # command=server_cmd+command+' '+command_dic['password']+old_server_pwd+' '+command_dic['cmd']+' '+command+' '+server_pwd + # elif(command='BridgeCreate'): + # server_pwd=request.GET.get('server_pwd',default='111111') + # hub_name=request.GET.get('hub_name',default='NewHub0') + # device=request.GET.get('device',default=None) + # tap=request.GET.get('tap',default=None) + # command=server_cmd+' '+command_dic['password']+server_pwd+' '+command_dic['cmd']+' '+command+' '+hub_name+' '+command_dic['device']+device + # +' '+command_dic['tap']+tap + # elif(command=='AddIpTap'): + # ip=request.GET.get('ip',default=None) + # dev=request.GET.get('dev',default=None) + # command='ip addr add'+' '+ip+' '+'dev'+' '+'tap_'+dev + # elif(command=='IPsecEnable'): + # l2tp=request.GET.get('l2tp',default=None) + # l2tpraw=request.GET.get('l2tpraw',default=None) + # etherip=request.GET.get('etherip',default=None) + # psk=request.GET.get('psk',default=None) + # defaulthub=request.GET.get('defaulthub',defaul=None) + # command=server_cmd+' '+command_dic['password']+password+' '+command_dic['cmd']+' '+command+' '+command_dic['l2tp']+l2tp+\ + # ' '+command_dic['l2tpraw']+l2tpraw+' '+command_dic['etherip']+etherip+' '+command_dic['psk']+psk+' '+command_dic['defaulthub']+\ + # +defaulthub + # elif(command=='SessionList'): + # adminhub=request.GET.get('adminhub',default=None) + # command=server_cmd+' '+command_dic['password']+password+' '+command_dic['adminhub']+' '+command_dic['password']+password+' '+\ + # command_dic['csv']+' '+command_dic['cmd']+' '+command + server_pwd=request.GET.get('server_pwd',default=server_pwd) + hub_name=request.GET.get('hub_name',default='NewHub0') + hub_pwd=request.GET.get('hub_pwd',default='111111') + hub_cmd=server_cmd+' '+command_dic['password']+server_pwd+' '+command_dic['hub']+hub_name+' '+command_dic['password']+hub_pwd+' '\ + +command_dic['cmd'] + hub_csv_cmd=server_cmd+' '+command_dic['password']+server_pwd+' '+command_dic['hub']+hub_name+' '+command_dic['password']+hub_pwd+' '\ + +command_dic['csv']+' '+command_dic['cmd'] + # if(command=='HubCreate'): + # command=command_dic['vpncmd']+' '+command_dic['server_ip']+' '+command_dic['server']+' '\ + # +command_dic['password']+command_dic['server_pwd']+' '+command['cmd']+' '+cmd+' '+hub_name+' '+password+hub_pwd + # elif(command=='SecureNatEnable'): + # command=hub_cmd+command + # elif(command=='RadiusServerSet'): + # radius_ip=request.GET.get('radius_ip',default='192.168.11.137:1812') + # secret=request.GET.get('secret',default='111111') + # retry_interval=request.GET.get('retry_interval',default='500') + # command=hub_cmd+' '+command+' '+radius_ip+' '+command_dic['secret']+secret+command_dic['retry_interval']+retry_interval + if(command=='UserCreate'): + user_name=request.GET.get('user_name',default=None) + user_pwd=request.GET.get('user_pwd',default=None) + group=request.GET.get('group',default='none') + realname=request.GET.get('realname',default='none') + note=request.GET.get('note',default='none') + if(user_name==None or user_pwd==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + else: + command=hub_cmd+' '+command+' '+user_name+' '+command_dic['group']+group+' '+command_dic['realname']+realname+' '+command_dic['note']+note + outs,rtn_code=mysubprocess(command) + if(rtn_code==0): + command=hub_cmd+' '+'UserPasswordSet'+' '+user_name+' '+command_dic['password']+user_pwd + outs,rtn_code=mysubprocess(command) + if(rtn_code==0): + my_dict=dict() + my_dict['response']=response_dic['success'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + command=command=hub_cmd+' '+'UserDelete'+' '+user_name + mysubprocess(command) + my_dict=dict() + my_dict['error']=response_dic['error'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + else: + my_dict=dict() + my_dict['error']=response_dic['exist'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + # elif(command=='UserRadiusSet'): + # user_name=request.GET.get('user_name',default='\'*\'') + # alias=request.GET.get('alias',default='none') + # command=hub_cmd+' '+command+' '+user_name+' '+user_name+' '+command_dic['alias']+alias + elif(command=='UserPasswordSet'): + user_name=request.GET.get('user_name',default=None) + user_pwd=request.GET.get('user_pwd',default=None) + if(user_name==None or user_pwd==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + else: + command=hub_cmd+' '+command+' '+user_name+' '+command_dic['password']+user_pwd + outs,rtn_code=mysubprocess(command) + if(rtn_code==0): + my_dict=dict() + my_dict['response']=response_dic['success'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + my_dict=dict() + my_dict['error']=response_dic['error'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + elif(command=='UserList'): + command=hub_csv_cmd+' '+command + outs,rtn_code=mysubprocess(command) + if(rtn_code==0): + my_dict=dict() + my_dict['response']=response_dic['success'] + my_list=outs.split('\n') + user_dict=dict() + user_list=list() + for x in range(1,len(my_list)): + user_info=my_list[x].split(',') + if(len(user_info)<10): + continue + transfer_info=my_list[x].split('\"') + user_dict['User_Name']=user_info[0] + user_dict['Num_Logins']=user_info[5] + if(user_info[6].find('None')==-1): + print(user_info[6]) + temp_str=user_info[6].split(' ') + temp_str=temp_str[0]+' '+temp_str[2] + user_dict['Last_Login']=temp_str + else: + user_dict['Last_Login']='None' + if(len(user_info)>10): + user_dict['Transfer_Bytes']=transfer_info[1] + user_dict['Transfer_Packets']=transfer_info[3] + else: + user_dict['Transfer_Bytes']=user_info[8] + user_dict['Transfer_Packets']=user_info[9] + user_list.append(user_dict) + user_dict=dict() + my_dict['userlist']=user_list + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + my_dict=dict() + my_dict['error']=response_dic['error'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + elif(command=='UserDelete'): + user_name=request.GET.get('user_name',default=None) + if(user_name==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + else: + command=hub_cmd+' '+command+' '+user_name + outs,rtn_code=mysubprocess(command) + if(rtn_code==0): + my_dict=dict() + my_dict['response']=response_dic['success'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + my_dict=dict() + my_dict['error']=response_dic['error'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + # elif(command=='IPTable'): + # user_name=request.GET.get('user_name',default=None) + # if(user_name==None): + # myresponse=HttpResponse(json.dumps(response_dic['miss']),content_type='application/json',status=400) + # return myresponse + # else: + # command=hub_cmd+' '+command+' '+user_name + # if(hub_name==None): + # command=server_cmd+' '+command_dic['password']+password+' '+command_dic['adminhub']+' '+command_dic['password']+password+' '+\ + # command_dic['csv']+' '+command_dic['cmd']+' '+command + elif(command=='UserGet'): + user_name=request.GET.get('user_name',default=None) + if(user_name==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + command=hub_csv_cmd+' '+command+' '+user_name + outs,rtn_code=mysubprocess(command) + if(rtn_code==0): + my_dict=dict() + my_dict['response']=response_dic['success'] + my_list=outs.split('\n') + for x in range(1,len(my_list)): + user_info=my_list[x].split(',') + transfer_info=re.split(r'(\"| )',my_list[x]) + transfer_info_short=re.split(r'(,| )',my_list[x]) + if(user_info[0]=='User Name'): + my_dict['User_Name']=user_info[1] + elif(user_info[0].find('Created on')!=-1): + if(user_info[1].find('None')==-1): + temp_str=user_info[1].split(' ') + temp_str=temp_str[0]+' '+temp_str[2] + my_dict['Create_on']=temp_str + else: + my_dict['Create_on']='None' + elif(user_info[0].find('Update on')!=-1): + my_dict['Update_on']=user_info[1] + elif(user_info[0].find('Outgoing Unicast Packets')!=-1): + if(my_list[x].find('\"')==-1): + my_dict['Outgoing_Unicast_Packets']=transfer_info_short[6].replace(',','') + else: + my_dict['Outgoing_Unicast_Packets']=transfer_info[6].replace(',','') + elif(user_info[0].find('Outgoing Unicast Total Size')!=-1): + if(my_list[x].find('\"')==-1): + my_dict['Outgoing_Unicast_Total_Size']=transfer_info_short[8].replace(',','') + else: + my_dict['Outgoing_Unicast_Total_Size']=transfer_info[8].replace(',','') + elif(user_info[0].find('Outgoing Broadcast Packets')!=-1): + print(transfer_info,transfer_info_short) + if(my_list[x].find('\"')==-1): + my_dict['Outgoing_Broadcast_Packets']=transfer_info_short[6].replace(',','') + else: + my_dict['Outgoing_Broadcast_Packets']=transfer_info[6].replace(',','') + elif(user_info[0].find('Outgoing Broadcast Total Size')!=-1): + if(my_list[x].find('\"')==-1): + my_dict['Outgoing_Broadcast_Total_Size']=transfer_info_short[8].replace(',','') + else: + my_dict['Outgoing_Broadcast_Total_Size']=transfer_info[8].replace(',','') + elif(user_info[0].find('Incoming Unicast Packets')!=-1): + if(my_list[x].find('\"')==-1): + my_dict['Incoming_Unicast_Packets']=transfer_info_short[6].replace(',','') + else: + my_dict['Incoming_Unicast_Packets']=transfer_info[6].replace(',','') + elif(user_info[0].find('Incoming Unicast Total Size')!=-1): + if(my_list[x].find('\"')==-1): + my_dict['Incoming_Unicast_Total_Size']=transfer_info_short[8].replace(',','') + else: + my_dict['Incoming_Unicast_Total_Size']=transfer_info[8].replace(',','') + elif(user_info[0].find('Incoming Broadcast Packets')!=-1): + if(my_list[x].find('\"')==-1): + my_dict['Incoming_Broadcast_Packets']=transfer_info_short[6].replace(',','') + else: + my_dict['Incoming_Broadcast_Packets']=transfer_info[6].replace(',','') + elif(user_info[0].find('Incoming Broadcast Total Size')!=-1): + if(my_list[x].find('\"')==-1): + my_dict['Incoming_Broadcast_Total_Size']=transfer_info_short[8].replace(',','') + else: + my_dict['Incoming_Broadcast_Total_Size']=transfer_info[8].replace(',','') + elif(user_info[0].find('Number of Logins')!=-1): + if(my_list[x].find('\"')==-1): + my_dict['Number_of_Logins']=transfer_info_short[6].replace(',','') + else: + my_dict['Number_of_Logins']=transfer_info[6].replace(',','') + if(my_dict.get('Create_on')==None): + my_dict['Create_on']='' + elif(my_dict.get('Update on')==None): + my_dict['Update_on']='' + elif(my_dict.get('Outgoing_Unicast_Packets')==None): + my_dict['Outgoing_Unicast_Packets']='' + elif(my_dict.get('Outgoing_Unicast_Total_Size')==None): + my_dict['Outgoing_Unicast_Total_Size']='' + elif(my_dict.get('Outgoing_Broadcast_Packets')==None): + my_dict['Outgoing_Broadcast_Packets']='' + elif(my_dict.get('Outgoing_Broadcast_Total_Size')==None): + my_dict['Outgoing_Broadcast_Total_Size']='' + elif(my_dict.get('Incoming_Unicast_Packets')==None): + my_dict['Incoming_Unicast_Packets']='' + elif(my_dict.get('Incoming_Unicast_Total_Size')==None): + my_dict['Incoming_Unicast_Total_Size']='' + elif(my_dict.get('Incoming_Broadcast_Packets')==None): + my_dict['Incoming_Broadcast_Packets']='' + elif(my_dict.get('Incoming_Broadcast_Total_Size')==None): + my_dict['Incoming_Broadcast_Total_Size']='' + elif(my_dict.get('Number_of_Logins')==None): + my_dict['Number_of_Logins']='' + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + my_dict=dict() + my_dict['error']=response_dic['error'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + # elif(command=='LogFileList'): + # command=hub_cmd+' '+command + # elif(command=='DownloadLogFile'): + # file_addr=GET.get('user_name',default='./security_log/NewHub0/sec_20181031.log') + # command=hub_cmd+' '+command+' '+file_addr + elif(command=='UserPolicySet'): + user_name=request.GET.get('user_name',default=None) + policy_name=request.GET.get('name',default=None) + value=request.GET.get('value',default=None) + if(user_name==None or policy_name==None or value==None): + my_dict=dict() + my_dict['error']=response_dic['miss'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + command=hub_cmd+' '+command+' '+user_name+' '+command_dic['name']+policy_name+' '+command_dic['value']+value + outs,rtn_code=mysubprocess(command) + if(rtn_code==0): + my_dict=dict() + my_dict['response']=response_dic['success'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json') + return myresponse + else: + my_dict=dict() + my_dict['error']=response_dic['error'] + myresponse=HttpResponse(json.dumps(my_dict),content_type='application/json',status=400) + return myresponse + # elif(command=='AdminOptionSet'): + # opt_set=request.GET.get('name',default='max_bitrates_download') + # value=request.GET.get('value',default='1000000') + # command=hub_cmd+' '+command+' '+opt_set+command_dict['value']+value + # elif(command=='DhcpSet'): + # start_ip=request.GET.get('start_ip',default=None) + # end=request.GET.get('end',default=None) + # mask=request.GET.get('mask',default=None) + # expire=request.GET.get('expire',default=None) + # gw=request.GET.get('gw',default=None) + # dns=request.GET.get('dns',default=None) + # dns2=request.GET.get('dns2',default=None) + # domain=request.GET.get('domain',default=None) + # log=request.GET.get('log',default=None) + # command==hub_cmd+' '+command+' '+command_dic['start']+start_ip+' '+command_dic['mask']+mask+' '+command_dic['expire']+expire\ + # +' '+command_dic['gw']+gw+' '+command_dic['dns']+dns+' '+command_dic['dns2']+dns2+' '+command_dic['domain']+domain+' '+\ + # command_dic['log']+log + # elif(command=='SecureNatHostSet'): + # mac=request.GET.get('mac',default=None) + # ip=request.GET.get('ip',default=None) + # mask=request.GET.get('mask',default=None) + # command=hub_cmd+' '+command+' '+command_dic['mac']+mac+' '+command_dic['ip']+ip+' '+command_dic['mask']+mask + # elif(command=='NatSet'): + # mtu=request.GET.get('mtu',default=None) + # tcptimeout=request.GET.get('tcptimeout',default=None) + # udptimeout=request.GET.get('udptimeout',default=None) + # log=request.GET.get('log',default=None) + # command=hub_cmd+' '+command+' '+command_dic['mtu']+mtu+' '+command_dic['tcptimeout']+tcptimeout+' '+command_dic['udptimeout']+\ + # udptimeout+' '+command_dic['log']+log + # elif(command=='GroupCreate'): + # group=request.GET.get('group',default='none') + # realname=request.GET.get('realname',default='none') + # note=request.GET.get('note',default='none') + # command=hub_cmd+' '+command+' '+group+' '+command_dic['realname']+realname+' '+command_dic['note']+note + # elif(command='UserPasswordSet'): + # user_name=request.GET.get('user_name',default='\'*\'') + # user_pwd=request.GET.get('user_pwd',default=None) + # command=hub_cmd+' '+command+' '+user_name+' '+command_dic['password']+user_pwd + # outs,rtn_code=mysubprocess(command) + # if(rtn_code==0): + # myresponse=HttpResponse(json.dumps(outs),content_type='application/json') + # return myresponse + # else: + # myresponse=HttpResponse(json.dumps(response_dic['miss']),content_type='application/json',status=400) + # return myresponse + # elif cmd_obj=='client': + # command=request.GET.get('cmd') + # client_ip=request.GET.get('client_ip',default='localhost') + # client_cmd=command_dic['vpncmd']+' '+command_dic['client']+client_ip+' '+command_dic['cmd'] + # if(command=='NicCreate'): + # nic_name=request.GET.get('nic_name',default='ethVPN3') + # command=client_cmd+' '+command+' '+nic_name + # elif(command=='AccountCreate'): + # account_name=request.GET.get('account_name',default='AccountL3') + # server_ip=request.GET.get('server_ip',default='192.168.11.137:443') + # hub_name=request.GET.get('hub_name',default='HubRadiusTest') + # user_name=request.GET.get('user_name',default='testing10') + # nic_name=request.GET.get('nic_name',default='ethVPN3') + # command=client_cmd+' '+command+' '+account+' '+command_dic['server']+':'+server_ip+' '+command_dic['hub']+hub_name+' '\ + # +command_dic['username']+user_name+' '+command_dic['nic_name']+nic_name + # elif(command=='AccountPassword'): + # account=request.GET.get('account',default='AccountL3') + # account_pwd=request.GET.get('account_pwd',default='111111') + # account_type=request.GET.get('account_type',default='redius') + # command=client_cmd+' '+command+' '+account+' '+command_dic['password']+account_pwd+command_dic['type']+account_type + # elif(command=='AccountConnect'): + # account=request.GET.get('account',default='AccountL3') + # command=client_cmd+' '+command+' '+account + # elif(command=='AccountStatusGet'): + # account=request.GET.get('account',default='AccountL3') + # command=client_cmd+' '+command+' '+account + # elif(command=='dhclient'): + # nic_name=request.GET.get('account',default='vpn_ethvpn3') + # command='sudo'+' '+command+' '+nic_name + +def mysubprocess(command, timeout1 = 6): + command = shlex.split(command) + try: + ssh_process = subprocess.Popen(command, shell=False, stdout = subprocess.PIPE, stderr = subprocess.PIPE, close_fds=True) + outs, errs = ssh_process.communicate(timeout = timeout1) + except Exception: + return "error",-1 + else: + errs = errs.decode("utf-8") + outs = outs.decode("utf-8") + rtn_code = ssh_process.returncode + if rtn_code!= 0 and errs != '': + print("rtn_code: " + str(rtn_code)) + print("errs: " + errs) + raise Exception("subprocess failed") + return outs,rtn_code + +def readconfig(): + myconfig=configparser.ConfigParser() + myconfig.read("CGI_config.conf") + server_pwd=myconfig.get("server","server_pwd") + host=myconfig.get("redis","host") + port=myconfig.get("redis","port") + return server_pwd,host,port + +def IpExist(host,port,candidate_ip): + P=Redis(host,port) + rtn,outs=P.connect() + my_set=set() + if(rtn!=-1): + scan_CANDIDATE=P.r.scan_iter(match="EFFECTIVE_RULE:IR_CANDIDATE_IP*") + for i in scan_CANDIDATE: + temp_list=P.r.get(i).split("\t") + my_set.add(temp_list[3]) + if candidate_ip in my_set: + return 0,'true' + else: + return 0,'false' + else: + return -1,outs + +def IpNumGet(host,port,addr_pool_id):# IpNumGet(group_id) + P=Redis(host,port) + rtn,outs=P.connect() + my_set=set() + if(rtn!=-1): + scan_CANDIDATE=P.r.scan_iter(match="EFFECTIVE_RULE:IR_CANDIDATE_IP*") + for i in scan_CANDIDATE: + temp_list=P.r.get(i).split("\t") + if(temp_list[1]==addr_pool_id): + my_set.add(temp_list[3]) + return len(my_set),outs + else: + return -1,outs + +def AllIpGet(host,port,addr_pool_id):# AllIpGet(group_id) + P=Redis(host,port) + rtn,outs=P.connect() + my_set=set() + if(rtn!=-1): + scan_CANDIDATE=P.r.scan_iter(match="EFFECTIVE_RULE:IR_CANDIDATE_IP*") + for i in scan_CANDIDATE: + temp_list=P.r.get(i).split("\t") + if(temp_list[1]==addr_pool_id): + my_set.add(temp_list[3]) + return 0,list(my_set) + else: + return -1,outs \ No newline at end of file diff --git a/command/新建文本文档.txt b/command/新建文本文档.txt new file mode 100644 index 0000000..e69de29 diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..1a0df0c Binary files /dev/null and b/db.sqlite3 differ diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..f1b9cbc --- /dev/null +++ b/manage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == '__main__': + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'VPN_CGI.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + 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?" + ) from exc + execute_from_command_line(sys.argv) diff --git a/nohup.out b/nohup.out new file mode 100644 index 0000000..25545f1 --- /dev/null +++ b/nohup.out @@ -0,0 +1,396 @@ +[28/Nov/2018 14:03:22] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +Not Found: /favicon.ico +[28/Nov/2018 14:03:22] "GET /favicon.ico HTTP/1.1" 404 2086 +[28/Nov/2018 14:04:54] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +Not Found: /favicon.ico +[28/Nov/2018 14:04:55] "GET /favicon.ico HTTP/1.1" 404 2086 +[29/Nov/2018 01:20:34] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +Not Found: /favicon.ico +[29/Nov/2018 01:20:34] "GET /favicon.ico HTTP/1.1" 404 2086 +[29/Nov/2018 01:47:47] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +[29/Nov/2018 02:01:03] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +[29/Nov/2018 02:01:04] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +Not Found: /favicon.ico +[29/Nov/2018 02:01:09] "GET /favicon.ico HTTP/1.1" 404 2086 +[29/Nov/2018 02:01:49] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +[29/Nov/2018 02:05:02] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +Bad Request: /command/ +[29/Nov/2018 02:07:35] "GET /command/?cmd=UserList HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 02:07:44] "GET /command/?cmd=Userget HTTP/1.1" 400 29 +[29/Nov/2018 02:07:58] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +Bad Request: /command/ +[29/Nov/2018 02:09:14] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 02:16:18] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting11 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 02:16:22] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 02:17:19] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting11 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 02:17:24] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Not Found: /favicon.ico +[29/Nov/2018 02:25:44] "GET /favicon.ico HTTP/1.1" 404 2086 +Bad Request: /command/ +[29/Nov/2018 02:35:26] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&userName=cgitesting1 HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 02:35:57] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&userName=cgitesting1 HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 02:40:11] "GET /command/?cmd=UserGet&user_name=cgitesting1&server_ip=192.168.11.137 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 02:40:23] "GET /command/?cmd=UserGet&user_name=cgitesting1&server_ip=192.168.11.137 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 02:42:58] "GET /command/?cmd=UserGet&user_name=cgitesting1&server_ip=192.168.11.137 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 02:52:18] "GET /command/?cmd=UserGet&user_name=cgitesting1&server_ip=192.168.11.137 HTTP/1.1" 400 399 +Internal Server Error: /command/ +Traceback (most recent call last): + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner + response = get_response(request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 137, in _get_response + "returned None instead." % (callback.__module__, view_name) +ValueError: The view command.views.command didn't return an HttpResponse object. It returned None instead. +[29/Nov/2018 02:55:58] "GET /command/?cmd=Userget&server_ip=192.168.11.137 HTTP/1.1" 500 55188 +Bad Request: /command/ +[29/Nov/2018 02:56:02] "GET /command/?cmd=Userget HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 02:59:06] "GET /command/?cmd=UserGet&user_name=cgitesting1&server_ip=192.168.11.137 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:04:19] "GET /command/?cmd=Userget HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 03:04:31] "GET /command/?cmd=Userget HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 03:05:30] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:05:36] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:05:41] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:06:06] "GET /command/?cmd=Userget HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 03:07:00] "GET /command/?cmd=UserGet&user_name=cgitesting1&server_ip=192.168.11.137 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:16:15] "GET /command/?cmd=UserGet&user_name=cgitesting1&server_ip=192.168.11.137 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:21:29] "GET /command/?cmd=UserGet&user_name=cgitesting1&server_ip=192.168.11.137 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:39:03] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:39:34] "GET /command/?cmd=AllIpGet HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 03:40:29] "GET /command/?cmd=AllIpGet&group_id=1 HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 03:43:16] "GET /command/?cmd=AllIpGet&group_id=1 HTTP/1.1" 400 29 +Bad Request: /command/ +[29/Nov/2018 03:45:06] "GET /command/?cmd=UserCreate&server_ip=192.161.11.11&user_name=ddmUser&user_name=111111 HTTP/1.1" 400 29 +Internal Server Error: /command/ +Traceback (most recent call last): + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner + response = get_response(request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response + response = self.process_exception_by_middleware(e, request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response + response = wrapped_callback(request, *callback_args, **callback_kwargs) + File "/usr/local/VPN_CGI/command/views.py", line 197, in command + outs,rtn_code=mysubprocess(command) + File "/usr/local/VPN_CGI/command/views.py", line 492, in mysubprocess + outs, errs = ssh_process.communicate(timeout = timeout1) + File "/usr/local/lib/python3.6/subprocess.py", line 843, in communicate + stdout, stderr = self._communicate(input, endtime, timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 1515, in _communicate + self._check_timeout(endtime, orig_timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 871, in _check_timeout + raise TimeoutExpired(self.args, orig_timeout) +subprocess.TimeoutExpired: Command '['vpncmd', '192.161.11.11', '/SERVER', '/PASSWORD:111111', '/HUB:NewHub0', '/PASSWORD:111111', '/CMD', 'UserCreate', 'ddmUser', '/GROUP:none', '/REALNAME:none', '/NOTE:none']' timed out after 6 seconds +[29/Nov/2018 03:45:26] "GET /command/?cmd=UserCreate&server_ip=192.161.11.11&user_name=ddmUser&user_pwd=111111 HTTP/1.1" 500 87319 +Internal Server Error: /command/ +Traceback (most recent call last): + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner + response = get_response(request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response + response = self.process_exception_by_middleware(e, request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response + response = wrapped_callback(request, *callback_args, **callback_kwargs) + File "/usr/local/VPN_CGI/command/views.py", line 197, in command + outs,rtn_code=mysubprocess(command) + File "/usr/local/VPN_CGI/command/views.py", line 492, in mysubprocess + outs, errs = ssh_process.communicate(timeout = timeout1) + File "/usr/local/lib/python3.6/subprocess.py", line 843, in communicate + stdout, stderr = self._communicate(input, endtime, timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 1515, in _communicate + self._check_timeout(endtime, orig_timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 871, in _check_timeout + raise TimeoutExpired(self.args, orig_timeout) +subprocess.TimeoutExpired: Command '['vpncmd', '192.161.11.11', '/SERVER', '/PASSWORD:111111', '/HUB:NewHub0', '/PASSWORD:111111', '/CMD', 'UserCreate', 'ddmUser', '/GROUP:none', '/REALNAME:none', '/NOTE:none']' timed out after 6 seconds +[29/Nov/2018 03:45:50] "GET /command/?cmd=UserCreate&server_ip=192.161.11.11&user_name=ddmUser&user_pwd=111111 HTTP/1.1" 500 87454 +Internal Server Error: /command/ +Traceback (most recent call last): + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner + response = get_response(request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response + response = self.process_exception_by_middleware(e, request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response + response = wrapped_callback(request, *callback_args, **callback_kwargs) + File "/usr/local/VPN_CGI/command/views.py", line 197, in command + outs,rtn_code=mysubprocess(command) + File "/usr/local/VPN_CGI/command/views.py", line 492, in mysubprocess + outs, errs = ssh_process.communicate(timeout = timeout1) + File "/usr/local/lib/python3.6/subprocess.py", line 843, in communicate + stdout, stderr = self._communicate(input, endtime, timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 1515, in _communicate + self._check_timeout(endtime, orig_timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 871, in _check_timeout + raise TimeoutExpired(self.args, orig_timeout) +subprocess.TimeoutExpired: Command '['vpncmd', '192.161.11.11', '/SERVER', '/PASSWORD:111111', '/HUB:NewHub0', '/PASSWORD:111111', '/CMD', 'UserCreate', 'ddmUser', '/GROUP:none', '/REALNAME:none', '/NOTE:none']' timed out after 6 seconds +[29/Nov/2018 03:46:41] "GET /command/?cmd=UserCreate&server_ip=192.161.11.11&user_name=ddmUser&user_pwd=111111 HTTP/1.1" 500 87454 +Internal Server Error: /command/ +Traceback (most recent call last): + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner + response = get_response(request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response + response = self.process_exception_by_middleware(e, request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response + response = wrapped_callback(request, *callback_args, **callback_kwargs) + File "/usr/local/VPN_CGI/command/views.py", line 197, in command + outs,rtn_code=mysubprocess(command) + File "/usr/local/VPN_CGI/command/views.py", line 492, in mysubprocess + outs, errs = ssh_process.communicate(timeout = timeout1) + File "/usr/local/lib/python3.6/subprocess.py", line 843, in communicate + stdout, stderr = self._communicate(input, endtime, timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 1515, in _communicate + self._check_timeout(endtime, orig_timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 871, in _check_timeout + raise TimeoutExpired(self.args, orig_timeout) +subprocess.TimeoutExpired: Command '['vpncmd', '192.161.11.11', '/SERVER', '/PASSWORD:111111', '/HUB:NewHub0', '/PASSWORD:111111', '/CMD', 'UserCreate', 'ddmUser', '/GROUP:none', '/REALNAME:none', '/NOTE:none']' timed out after 6 seconds +[29/Nov/2018 03:46:50] "GET /command/?cmd=UserCreate&server_ip=192.161.11.11&user_name=ddmUser&user_pwd=111111 HTTP/1.1" 500 87320 +Bad Request: /command/ +[29/Nov/2018 03:47:43] "GET /command/?cmd=UserCreate&server_ip=192.168.11.11&user_name=ddmUser&user_pwd=111111 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:48:02] "GET /command/?cmd=UserCreate&server_ip=192.168.11.11&user_name=ddmUserTest&user_pwd=111111 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:48:24] "GET /command/?cmd=UserCreate&server_ip=192.168.11.1&user_name=ddmUserTest&user_pwd=111111 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:48:51] "GET /command/?cmd=UserCreate&server_ip=192.168.11.2&user_name=ddmUserTest1&user_pwd=111111 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:49:58] "GET /command/?cmd=UserCreate&server_ip=192.168.11.2&user_name=ddmUserTest1&user_pwd=111111 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:50:12] "GET /command/?cmd=UserCreate&server_ip=192.168.11.120&user_name=ddmUserTest2&user_pwd=111111 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:50:34] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:50:38] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Bad Request: /command/ +[29/Nov/2018 03:51:19] "GET /command/?cmd=UserGet&server_ip=192.168.11.120&user_name=ddmUserTest2 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 03:52:25] "GET /command/?cmd=UserList&server_ip=192.168.11.120 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 03:52:53] "GET /command/?cmd=UserList&server_ip=192.168.11.120 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 03:53:14] "GET /command/?cmd=UserCreate&server_ip=192.168.11.120&user_name=ddmUserTest2&user_pwd=111111 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:53:41] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +[29/Nov/2018 03:54:14] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 328 +Internal Server Error: /command/ +Traceback (most recent call last): + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner + response = get_response(request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response + response = self.process_exception_by_middleware(e, request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response + response = wrapped_callback(request, *callback_args, **callback_kwargs) + File "/usr/local/VPN_CGI/command/views.py", line 245, in command + outs,rtn_code=mysubprocess(command) + File "/usr/local/VPN_CGI/command/views.py", line 492, in mysubprocess + outs, errs = ssh_process.communicate(timeout = timeout1) + File "/usr/local/lib/python3.6/subprocess.py", line 843, in communicate + stdout, stderr = self._communicate(input, endtime, timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 1515, in _communicate + self._check_timeout(endtime, orig_timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 871, in _check_timeout + raise TimeoutExpired(self.args, orig_timeout) +subprocess.TimeoutExpired: Command '['vpncmd', '192.168.11.111', '/SERVER', '/PASSWORD:111111', '/HUB:NewHub0', '/PASSWORD:111111', '/CSV', '/CMD', 'UserList']' timed out after 6 seconds +[29/Nov/2018 03:54:49] "GET /command/?cmd=UserList&server_ip=192.168.11.111 HTTP/1.1" 500 84226 +Internal Server Error: /command/ +Traceback (most recent call last): + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner + response = get_response(request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response + response = self.process_exception_by_middleware(e, request) + File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response + response = wrapped_callback(request, *callback_args, **callback_kwargs) + File "/usr/local/VPN_CGI/command/views.py", line 245, in command + outs,rtn_code=mysubprocess(command) + File "/usr/local/VPN_CGI/command/views.py", line 492, in mysubprocess + outs, errs = ssh_process.communicate(timeout = timeout1) + File "/usr/local/lib/python3.6/subprocess.py", line 843, in communicate + stdout, stderr = self._communicate(input, endtime, timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 1515, in _communicate + self._check_timeout(endtime, orig_timeout) + File "/usr/local/lib/python3.6/subprocess.py", line 871, in _check_timeout + raise TimeoutExpired(self.args, orig_timeout) +subprocess.TimeoutExpired: Command '['vpncmd', '192.168.11.111', '/SERVER', '/PASSWORD:111111', '/HUB:NewHub0', '/PASSWORD:111111', '/CSV', '/CMD', 'UserList']' timed out after 6 seconds +[29/Nov/2018 03:55:10] "GET /command/?cmd=UserList&server_ip=192.168.11.111 HTTP/1.1" 500 84363 +Bad Request: /command/ +[29/Nov/2018 03:56:01] "GET /command/?cmd=UserCreate&server_ip=192.168.11.133&user_name=cgitesting2&user_pwd=123456 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:56:23] "GET /command/?cmd=UserCreate&server_ip=192.168.11.120&user_name=ddmUserTest2&user_pwd=111111 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 03:56:37] "GET /command/?cmd=UserCreate&server_ip=192.168.11.13&user_name=test1&user_pwd=123456 HTTP/1.1" 400 80 +[29/Nov/2018 03:57:09] "GET /command/?cmd=UserCreate&server_ip=192.168.11.137&user_name=ddmUserTest2&user_pwd=111111 HTTP/1.1" 200 51 +[29/Nov/2018 03:57:35] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 448 +[29/Nov/2018 04:00:09] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 448 +Bad Request: /command/ +[29/Nov/2018 04:03:08] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=cgitesting1 HTTP/1.1" 400 399 +Performing system checks... + +System check identified no issues (0 silenced). +November 28, 2018 - 14:03:10 +Django version 2.1.2, using settings 'VPN_CGI.settings' +Starting development server at http://0.0.0.0:8090/ +Quit the server with CONTROL-C. +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +2018-11-13 (Tue) 09:05:09 +['Outgoing', ' ', 'Broadcast', ' ', 'Packets,0', ' ', 'packets'] ['Outgoing', ' ', 'Broadcast', ' ', 'Packets', ',', '0', ' ', 'packets'] +[29/Nov/2018 10:15:06] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=hy122 HTTP/1.1" 200 435 +[29/Nov/2018 10:15:09] "GET /command/?cmd=IpExist&candidate_ip=192.168.11.60 HTTP/1.1" 200 20 +[29/Nov/2018 10:15:12] "GET /command/?cmd=IpNumGet&addr_pool_id=1 HTTP/1.1" 200 61 +[29/Nov/2018 10:15:48] "GET /command/?cmd=IpNumGet&addr_pool_id=1 HTTP/1.1" 200 61 +[29/Nov/2018 10:15:51] "GET /command/?cmd=AllIpGet&addr_pool_id=1 HTTP/1.1" 200 86 +[29/Nov/2018 10:15:54] "GET /command/?cmd=UserPasswordSet&server_ip=192.168.11.137&user_name=hy122&user_pwd=111111 HTTP/1.1" 200 51 +[29/Nov/2018 10:15:56] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 548 +Bad Request: /command/ +[29/Nov/2018 10:17:26] "GET /command/?cmd=UserDelete&user_name=cs1&server_ip=10.12.1.4 HTTP/1.1" 400 40 +[29/Nov/2018 10:17:26] "GET /command/?cmd=UserDelete&user_name=vpnuser4&server_ip=192.168.11.137 HTTP/1.1" 200 51 +Bad Request: /command/ +[29/Nov/2018 10:17:32] "GET /command/?cmd=UserDelete&user_name=vpnuser4&server_ip=10.12.1.4 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:17:38] "GET /command/?cmd=UserDelete&user_name=vpnuser4&server_ip=10.12.1.3 HTTP/1.1" 400 40 +[29/Nov/2018 10:17:39] "GET /command/?cmd=UserDelete&user_name=hy122&server_ip=192.168.11.137 HTTP/1.1" 200 51 +Bad Request: /command/ +[29/Nov/2018 10:17:39] "GET /command/?cmd=UserDelete&user_name=vpnuser3&server_ip=192.168.11.137 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:17:39] "GET /command/?cmd=UserDelete&user_name=vpnuser2&server_ip=192.168.11.137 HTTP/1.1" 400 40 +[29/Nov/2018 10:17:40] "GET /command/?cmd=UserDelete&user_name=HY&server_ip=192.168.11.137 HTTP/1.1" 200 51 +Bad Request: /command/ +[29/Nov/2018 10:17:46] "GET /command/?cmd=UserDelete&user_name=vpnuser1&server_ip=10.12.1.4 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:17:51] "GET /command/?cmd=UserDelete&user_name=testUser2&server_ip=0.0.0.112 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:17:56] "GET /command/?cmd=UserDelete&user_name=testUser2&server_ip=0.0.0.9 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:02] "GET /command/?cmd=UserDelete&user_name=testUser2&server_ip=0.0.0.3 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:08] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=10.12.1.4 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:14] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=10.12.1.3 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:20] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=10.12.1.2 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:26] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=10.12.1.1 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:32] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=192.18.10.22 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:37] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=0.0.0.112 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:43] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=0.0.0.9 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:48] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=0.0.0.6 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:53] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=0.0.0.3 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:18:59] "GET /command/?cmd=UserDelete&user_name=testUser&server_ip=0.0.0.1 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:04] "GET /command/?cmd=UserDelete&user_name=dilidili&server_ip=0.0.0.6 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:09] "GET /command/?cmd=UserDelete&user_name=dilidili&server_ip=0.0.0.1 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:15] "GET /command/?cmd=UserDelete&user_name=testadduser&server_ip=192.18.10.22 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:21] "GET /command/?cmd=UserDelete&user_name=testadduser&server_ip=0.0.0.112 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:26] "GET /command/?cmd=UserDelete&user_name=baidu11&server_ip=0.0.0.6 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:31] "GET /command/?cmd=UserDelete&user_name=baidu11&server_ip=0.0.0.1 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:37] "GET /command/?cmd=UserDelete&user_name=bilibili&server_ip=0.0.0.8 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:42] "GET /command/?cmd=UserDelete&user_name=bilibili&server_ip=0.0.0.3 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:48] "GET /command/?cmd=UserDelete&user_name=bilibili&server_ip=0.0.0.1 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:53] "GET /command/?cmd=UserDelete&user_name=ceshi&server_ip=0.0.0.3 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:19:59] "GET /command/?cmd=UserDelete&user_name=admin&server_ip=0.0.0.3 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:20:04] "GET /command/?cmd=UserDelete&user_name=admin&server_ip=0.0.0.1 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:20:10] "GET /command/?cmd=UserDelete&user_name=test&server_ip=192.18.10.22 HTTP/1.1" 400 40 +Bad Request: /command/ +[29/Nov/2018 10:34:21] "GET /command/?cmd=UserCreate&user_name=hy1&server_ip=10.12.1.4&user_pwd=123456 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 10:34:59] "GET /command/?cmd=UserCreate&user_name=hy1&server_ip=10.12.1.3&user_pwd=123456 HTTP/1.1" 400 80 +[29/Nov/2018 10:46:01] "GET /command/?cmd=IpExist&candidate_ip=192.168.11.60 HTTP/1.1" 200 20 +[29/Nov/2018 10:46:03] "GET /command/?cmd=IpNumGet&addr_pool_id=1 HTTP/1.1" 200 61 +[29/Nov/2018 10:46:06] "GET /command/?cmd=AllIpGet&addr_pool_id=1 HTTP/1.1" 200 86 +Bad Request: /command/ +[29/Nov/2018 10:46:09] "GET /command/?cmd=UserPasswordSet&server_ip=192.168.11.137&user_name=hy122&user_pwd=111111 HTTP/1.1" 400 40 +[29/Nov/2018 10:46:22] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 209 +Bad Request: /command/ +[29/Nov/2018 10:46:45] "GET /command/?cmd=UserGet&server_ip=192.168.11.137&user_name=hy122 HTTP/1.1" 400 40 +[29/Nov/2018 10:50:34] "GET /command/?cmd=AllIpGet&addr_pool_id=1 HTTP/1.1" 200 86 +[29/Nov/2018 10:50:36] "GET /command/?cmd=AllIpGet&addr_pool_id=2 HTTP/1.1" 200 71 +[29/Nov/2018 10:50:39] "GET /command/?cmd=AllIpGet&addr_pool_id=1 HTTP/1.1" 200 86 +[29/Nov/2018 10:50:42] "GET /command/?cmd=IpNumGet&addr_pool_id=1 HTTP/1.1" 200 61 +[29/Nov/2018 10:51:43] "GET /command/?cmd=IpNumGet&addr_pool_id=2 HTTP/1.1" 200 61 +[29/Nov/2018 10:51:47] "GET /command/?cmd=IpNumGet&addr_pool_id=1 HTTP/1.1" 200 61 +[29/Nov/2018 10:58:43] "GET /command/?cmd=UserCreate&user_name=hy01&server_ip=192.168.11.137&user_pwd=123456 HTTP/1.1" 200 51 +[29/Nov/2018 11:15:00] "GET /command/?cmd=UserCreate&user_name=hy11&server_ip=192.168.11.137&user_pwd=123456 HTTP/1.1" 200 51 +Bad Request: /command/ +[29/Nov/2018 11:19:27] "GET /command/?cmd=UserCreate&user_name=hy11&server_ip=192.168.11.137&user_pwd=123456 HTTP/1.1" 400 80 +[29/Nov/2018 11:32:05] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 433 +Bad Request: /command/ +[29/Nov/2018 11:41:32] "GET /command/?cmd=UserCreate&user_name=ces1&server_ip=10.12.1.4&user_pwd=123456 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 11:45:15] "GET /command/?cmd=UserCreate&user_name=testii&server_ip=10.12.1.4&user_pwd=123456 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 11:48:55] "GET /command/?cmd=UserCreate&user_name=testtt&server_ip=10.12.1.4&user_pwd=123456 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 11:49:28] "GET /command/?cmd=UserCreate&user_name=testtt&server_ip=10.12.1.3&user_pwd=123456 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 11:50:26] "GET /command/?cmd=UserCreate&user_name=HY01&server_ip=192.168.11.137&user_pwd=123456 HTTP/1.1" 400 80 +Bad Request: /command/ +[29/Nov/2018 11:50:36] "GET /command/?cmd=UserCreate&user_name=HY01&server_ip=10.12.1.4&user_pwd=123456 HTTP/1.1" 400 80 +[29/Nov/2018 11:51:04] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 433 +[29/Nov/2018 11:51:46] "GET /command/?cmd=UserCreate&user_name=HY02&server_ip=192.168.11.137&user_pwd=123456 HTTP/1.1" 200 51 +Bad Request: /command/ +[29/Nov/2018 11:52:30] "GET /command/?cmd=UserCreate&user_name=HY02&server_ip=10.12.1.4&user_pwd=123456 HTTP/1.1" 400 80 +[29/Nov/2018 11:53:25] "GET /command/?cmd=UserList&server_ip=192.168.11.137 HTTP/1.1" 200 545 +[29/Nov/2018 11:53:31] "GET /command/?cmd=UserGet&user_name=HY02&server_ip=192.168.11.137 HTTP/1.1" 200 434 diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..2115c62 --- /dev/null +++ b/setup.sh @@ -0,0 +1,4 @@ +#!/bin/sh +while [[ "1" = "1" ]]; do + python3 manage.py runserver 0:8090 +done