def post_create(request): username = request.session['username'] user_id = user.getuserid(username) if request.method == 'POST': post_url = request.POST.get('post_url') post_cookie = request.POST.get('post_cookie') post_head = request.POST.get('post_head') post_thread = request.POST.get('post_thread') post_data = request.POST.get('post_data') if len(post_thread) == 0: post_thread = 0 try: # 从表单获取数据插入HttpSend表 HttpSend.objects.create(send_url=post_url, headers=post_head, cookie=post_cookie, send_type='POST', thread_num=post_thread, data=post_data, user_id=user_id) return HttpResponseRedirect('/http/post/list/') # 插入成功跳转列表页 except Exception, e: # 此处需要添加日志 # 插入失败,刷新页面 return HttpResponse(e)
def interface_list(request): username = request.session['username'] user_id = getuserid(username) if user_id: http_list = list( InterfaceInfo.objects.filter(user_id=user_id).values( "url_info", "timeout", "return_value", "status", "id")) return render_to_response('interface/interface_list.html', { 'http_list': http_list, 'username': username })
def get_list(request): username = request.session['username'] user_id = user.getuserid(username) if user_id: get_list = list( HttpSend.objects.filter(user_id=user_id, send_type="GET").values( "send_url", "thread_num", "headers", "cookie", "status", "id")) return render_to_response('http_tool/get_list.html', { 'get_list': get_list, 'username': username })
def project_list(request): username = request.session['username'] user_id = user.getuserid(username) if user_id: project_list = list( ProjectInfo.objects.filter(user_id=user_id).values( "project_name", "start_time", "smock_time", "online_time", "participant", "project_manager", "current_phase")) return render_to_response('project_control/project_process_list.html', { 'project_list': project_list, 'username': username })
def encry_base64(request): username = request.session['username'] user_id = user.getuserid(username) if request.method == 'POST' : base64_status = request.POST.get('base64') base64_decode = request.POST.get('base64_decode') url_decode = request.POST.get('url_decode') json_decode = request.POST.get('json_decode') encry_before = request.POST.get('encry_before') if base64_status == 'on' : encry_end = encryption.to_base64(encry_before) elif base64_decode == 'on': encry_end = encryption.from_base64(encry_before) elif url_decode == 'on' : encry_end = encryption.unquote(encry_before) else: return render_to_response('http_tool/encry_base64.html',{'username': username,'errormsg':'请选择一个转换类型'}) return render_to_response('http_tool/encry_base64.html', {'username': username,'encry_end':encry_end}) return render_to_response('http_tool/encry_base64.html')
def interface_create(request): username = request.session.get('username') user_id = getuserid(username) if request.method == 'POST': interface_name = request.POST.get('url_name') return_value = request.POST.get('return_value') timeout = request.POST.get('timeout') if timeout == None: timeout = 0 host = request.get_host() url_info = "http://" + host + "/interface/return/" + username + "/" + interface_name try: InterfaceInfo.objects.create(url_info=url_info, status=1, return_value=return_value, user_id=user_id, timeout=timeout) return HttpResponseRedirect('/interface/list/') except Exception, e: #此处需要n记录日志 render_to_response('interface/interface_create.html', {'username': username})
def project_create(request): username = request.session['username'] user_id = user.getuserid(username) if request.method == 'POST': project_name = request.POST.get('project_name') start_time = tools.time_conctrol(request.POST.get('start_time')) smock_time = tools.time_conctrol(request.POST.get('smock_time')) online_time = tools.time_conctrol(request.POST.get('online_time')) participant = request.POST.get('participant') project_manager = request.POST.get('project_manager') try: #从表单获取数据插入ProjectInfo表 ProjectInfo.objects.create(project_name=project_name, start_time=start_time, smock_time=smock_time, online_time=online_time, participant=participant, user_id=user_id, project_manager=project_manager) return HttpResponseRedirect('/project/list/') #插入成功跳转列表页 except Exception, e: #此处需要添加日志 #插入失败,刷新页面 return HttpResponse(e)