예제 #1
0
def updatejob(request,state=''):
    if request.method=='POST':
        islogin = request.COOKIES.get('islogin',False)
        jobid= request.POST.get('taskid','')
        username = request.COOKIES.get('username','') 
        role = request.COOKIES.get('role','1')
        response_data = {}  
        response_data['result'] = '0' 
        if role=='1':
            tempresult=jobcontrol.jobupdate(jobstatus=state,username=username,taskid=jobid)
#             print 'this is user'
        else:
            tempresult=jobcontrol.jobupdate(jobstatus=state,taskid=jobid)
        if tempresult==True:
            if state=='2':
                jobs,count,pagecount=jobcontrol.jobshow(taskid=jobid)
                if count>0:
                    tasktotally=taskcontrol.getObject()
                    if jobs[0].getForcesearch==1:


                        tasktotally.add_work(jobs)
                    else:

                        tasktotally.add_work(jobs)
                        
            response_data['result'] = '1'
        return response_data
예제 #2
0
def updatejob(request,state=''):
    if request.method=='POST':
        islogin = request.COOKIES.get('islogin',False)
        jobid= request.POST.get('taskid','')
        username = request.COOKIES.get('username','') 
        role = request.COOKIES.get('role','1')
        response_data = {}  
        response_data['result'] = '0' 
        if role=='1':
            tempresult=jobcontrol.jobupdate(jobstatus=state,username=username,taskid=jobid)
#             print 'this is user'
        else:
            tempresult=jobcontrol.jobupdate(jobstatus=state,taskid=jobid)
        if tempresult==True:
            if state=='2':
                jobs,count,pagecount=jobcontrol.jobshow(taskid=jobid)
                if count>0:
                    tasktotally=taskcontrol.getObject()
                    if jobs[0].getForcesearch==1:


                        tasktotally.add_work(jobs)
                    else:

                        tasktotally.add_work(jobs)
                        
            response_data['result'] = '1'
        return response_data
예제 #3
0
def updatejob(request, state=''):
    print(
        "==========================================================================\n======================job state:%s request.method:%s======================\n==========================================================================\n"
        % (state, request.method))
    if request.method == 'POST':  #POST
        islogin = request.COOKIES.get('islogin', False)
        jobid = request.POST.get('taskid', '')
        # jobid = request.POST.get('taskid','1410a6d6-90ac-11e8-af6f-74e50ba386da')
        username = request.COOKIES.get('username', '')
        role = request.COOKIES.get('role', '1')
        response_data = {}
        response_data['result'] = '0'

        ctx = {}
        ctx['islogin'] = islogin
        ctx['jobid'] = jobid
        ctx['username'] = username
        ctx['role'] = role
        ctx['state'] = state
        # return render(request, 'nmaptoolview/post.html', ctx)

        if role == '1':  # normal user
            tempresult = jobcontrol.jobupdate(jobstatus=state,
                                              username=username,
                                              taskid=jobid)
        else:
            tempresult = jobcontrol.jobupdate(jobstatus=state, taskid=jobid)

        if tempresult == True:
            if state == '2':
                jobs, count, pagecount = jobcontrol.jobshow(taskid=jobid)

                if count > 0:
                    tasktotally = taskcontrol.getObject(
                    )  # return nmaptask(sniffertask.snifferTask(1))
                    if jobs[0].getForcesearch == 1:
                        tasktotally.add_work(jobs)
                    else:
                        tasktotally.add_work(jobs)
            response_data['result'] = '1'
        return response_data