Beispiel #1
0
    def __init__(self,
                 ip='',
                 port='',
                 timesearch='',
                 state='',
                 name='',
                 product='',
                 version='',
                 script='',
                 detail='',
                 head='',
                 city='',
                 hackinfo='',
                 disclosure=''):
        '''
        Constructor
        '''
        self.ip = ip
        self.port = port
        self.version = version
        self.state = state
        self.name = name
        if timesearch != '':
            self.timesearch = timesearch
        else:
            self.timesearch = webtool.getlocaltime()

        self.product = product
        self.script = script
        self.detail = detail
        self.head = head
        self.city = city
        self.hackinfo = hackinfo
        self.disclosure = disclosure
Beispiel #2
0
    def __init__(self,jobname='',jobaddress='',priority='1',starttime='',username='',jobport='',jobstatus='1',jobid='',result='',endtime='',createtime='',argument='',forcesearch='',isjob='1'):
        '''
        Constructor
        '''
#         jobstatus=1 //未启动
#         jobstatus=2 //排队中
#         jobstatus=3 //正在进行
#         jobstatus=4 //挂起
#         jobstatus=5 //已完成
#         jobstatus=6 //已终止
        self.jobname=jobname
        self.jobaddress=jobaddress
        self.priority=priority
        self.starttime=starttime
        self.username=username
        self.isjob=isjob
        if forcesearch!='':
            self.forcesearch=forcesearch
            
        else:
            self.forcesearch='0'
        if createtime!='':
            self.createtime=createtime
        else:
            self.createtime=webtool.getlocaltime()
        if jobid!='':
            self.jobid=jobid
        else:
            self.jobid=uuid.uuid1()
        self.jobport=jobport
        self.jobstatus=jobstatus
        self.result=result
        self.endtime=endtime
        self.argument=argument
Beispiel #3
0
    def __init__(self,
                 ip='',
                 vendor='',
                 osfamily='',
                 osgen='',
                 accurate='',
                 state='',
                 hostname='unknow',
                 updatetime='',
                 city=''):
        '''
        Constructor
        '''

        self.ip = ip
        self.vendor = vendor
        self.osgen = osgen
        self.osfamily = osfamily
        self.accurate = accurate
        if updatetime != '':
            self.updatetime = updatetime
        else:
            self.updatetime = webtool.getlocaltime()

        self.state = state
        self.hostname = hostname
        self.city = city
Beispiel #4
0
    def __init__(self,
                 tasksname='',
                 taskaddress='',
                 priority='1',
                 starttime='',
                 username='',
                 tasksport='',
                 taskstatus='1',
                 tasksid='',
                 result='',
                 endtime='',
                 createtime='',
                 argument='',
                 forcesearch='',
                 isjob='1',
                 num='',
                 completenum=''):
        '''
        Constructor
        '''
        #         taskstatus = 1 //未启动
        #         taskstatus = 2 //排队中
        #         taskstatus = 3 //正在进行
        #         taskstatus = 4 //挂起
        #         taskstatus = 5 //已完成
        #         taskstatus = 6 //已终止
        #         mode = 1//正常状态
        #         mode = 0//异常状态
        self.tasksname = tasksname
        self.taskaddress = taskaddress
        self.priority = priority
        self.starttime = starttime
        self.username = username
        self.completenum = completenum
        self.num = num
        self.isjob = isjob
        self.mode = 1

        if forcesearch != '':
            self.forcesearch = forcesearch
        else:
            self.forcesearch = '0'
        if createtime != '':
            self.createtime = createtime
        else:
            self.createtime = webtool.getlocaltime()
        if tasksid != '':
            self.tasksid = tasksid
        else:
            self.tasksid = uuid.uuid1()

        self.tasksport = tasksport
        self.taskstatus = taskstatus
        self.result = result
        self.endtime = endtime
        self.argument = argument
Beispiel #5
0
    def __init__(self,
                 ip='',
                 port='',
                 timesearch='',
                 state='',
                 name='',
                 product='',
                 version='',
                 script='',
                 detail='',
                 head='',
                 city='',
                 hackinfo='',
                 hackresults=None,
                 disclosure=None,
                 geoinfo=None,
                 webtitle='',
                 webkeywords=''):
        '''
            Constructor
        '''
        self.ip = ip
        self.port = port
        self.version = version
        self.state = state
        self.name = name
        if timesearch != '':
            self.timesearch = timesearch
        else:
            self.timesearch = webtool.getlocaltime()

        self.product = product
        self.script = script
        self.detail = detail
        self.head = head
        self.city = city
        self.hackinfo = hackinfo
        self.hackresults = hackresults
        self.disclosure = disclosure
        self.geoinfo = geoinfo
        self.webkeywords = webkeywords
        self.webtitle = webtitle

        if self.geoinfo is None:
            self.geoinfo = Location(ip=str(self.ip)).getData()
        else:
            try:
                data = eval(geoinfo)
                self.geoinfo = data
                if self.geoinfo.get('geoip', None) is None:
                    self.geoinfo = Location(ip=str(self.ip)).getData()
            except Exception, e:
                self.geoinfo = Location(ip=str(self.ip)).getData()
Beispiel #6
0
    def __init__(self,
                 ip='',
                 vendor='',
                 osfamily='',
                 osgen='',
                 accurate='',
                 state='',
                 hostname='unknow',
                 updatetime='',
                 city='',
                 isp='',
                 county='',
                 country='',
                 area='',
                 region='',
                 location=None):
        '''
        Constructor
        '''
        self.ip = ip
        self.vendor = vendor
        self.osgen = osgen
        self.osfamily = osfamily
        self.accurate = accurate

        if updatetime != '':
            self.updatetime = updatetime
        else:
            self.updatetime = webtool.getlocaltime()

        self.state = state
        self.hostname = hostname
        self.city = city
        self.isp = isp
        self.county = county
        self.country = country
        self.area = area
        self.region = region
        self.location = location

        # print "before init location...", location
        if self.location is None:
            self.location = Location(ip=str(self.ip)).getData()
        else:
            try:
                data = eval(location)
                self.location = data
                if self.location.get('geoip', None) is None:
                    self.location = Location(ip=str(self.ip)).getData()
            except Exception, e:
                self.location = Location(ip=str(self.ip)).getData()
Beispiel #7
0
def updatejob(request, state=''):
    print ("===============================================================================\n======================tasks 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','')
        username = request.COOKIES.get('username','')
        role = request.COOKIES.get('role','1')
    	starttime = webtool.getlocaltime()
        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, 'nmptoolview/post.html', ctx)

        # 开始操作tasksdata表,执行对应的状态操作
        if state == '3':
            tempresult = taskscontrol.jobupdate(jobstatus=state, username=username, taskid=jobid, starttime=starttime, completenum='0')
        # elif  state=='4':
        #     pass
        else:
            if role=='1':	# normal user
                tempresult = taskscontrol.jobupdate(jobstatus=state,username=username,taskid=jobid)
            else:
                tempresult = taskscontrol.jobupdate(jobstatus=state,taskid=jobid)
        if tempresult == True:
            tasks, count, pagecount = taskscontrol.taskshow(username=username, page='0',taskid=jobid)
            table = localconfig.taskstable
            print ('\n%s更新成功, 总数为:%s页数为:%d'%(table, count, pagecount))

            if count > 0:
#		execute multi thread sniffertask
                tasktotally = taskcontrol.getObject()
                task = tasks[0] # a Job object
                # 更新job(taskdata表)
                if state == '3':
                    jobcontrol.jobupdate(jobstatus='2', groupid=jobid)
                    # 和createjob中的用法一致, 区别在于command是create还是work
                    taskscontrol.startjob(task)
                    # tasktotally.add_work(tasks)
                else:
                    jobcontrol.jobupdate(jobstatus=state, groupid=jobid)
                # page=page+1
            response_data['result'] = '1'
        return response_data
Beispiel #8
0
    def __init__(self,
                 jobname='',
                 jobaddress='',
                 priority='1',
                 starttime='',
                 username='',
                 jobport='',
                 jobstatus='1',
                 jobid='',
                 result='',
                 endtime='',
                 createtime='',
                 argument='',
                 forcesearch='',
                 isjob='1'):
        '''
        Constructor
        '''
        #         jobstatus=1 //未启动
        #         jobstatus=2 //排队中
        #         jobstatus=3 //正在进行
        #         jobstatus=4 //挂起
        #         jobstatus=5 //已完成
        #         jobstatus=6 //已终止
        self.jobname = jobname
        self.jobaddress = jobaddress
        self.priority = priority
        self.starttime = starttime
        self.username = username
        self.isjob = isjob
        if forcesearch != '':
            self.forcesearch = forcesearch

        else:
            self.forcesearch = '0'
        if createtime != '':
            self.createtime = createtime
        else:
            self.createtime = webtool.getlocaltime()
        if jobid != '':
            self.jobid = jobid
        else:
            self.jobid = uuid.uuid1()
        self.jobport = jobport
        self.jobstatus = jobstatus
        self.result = result
        self.endtime = endtime
        self.argument = argument
Beispiel #9
0
    def __init__(self,ip='',port='',timesearch='',state='',name='',product='',version='',script='',detail=''):
        '''
        Constructor
        '''
        self.ip=ip
        self.port=port
        self.version=version
        self.state=state
        self.name=name
        if timesearch!='':
            self.timesearch=timesearch
        else:
            self.timesearch=webtool.getlocaltime()

        self.product=product
        self.script=script
        self.detail=detail
Beispiel #10
0
    def __init__(self,ip='',vendor='',osfamily='',osgen='',accurate='',state='',hostname='unknow',updatetime=''):
        '''
        Constructor
        '''

        self.ip=ip
        self.vendor=vendor
        self.osgen=osgen
        self.osfamily=osfamily
        self.accurate=accurate
        if updatetime!='':
            self.updatetime=updatetime
        else:
            self.updatetime=webtool.getlocaltime()
   
        self.state=state
        self.hostname=hostname
Beispiel #11
0
    def __init__(self,ip='',port='',timesearch='',state='',name='',product='',version='',script='',detail='',head='',city='',hackinfo='',disclosure=''):
        '''
        Constructor
        '''
        self.ip=ip
        self.port=port
        self.version=version
        self.state=state
        self.name=name
        if timesearch!='':
            self.timesearch=timesearch
        else:
            self.timesearch=webtool.getlocaltime()

        self.product=product
        self.script=script
        self.detail=detail
        self.head=head
        self.city=city
        self.hackinfo=hackinfo
        self.disclosure=disclosure
Beispiel #12
0
    def __init__(self,tasksname='',taskaddress='',priority='1',starttime='',username='',tasksport='',taskstatus='1',tasksid='',result='',endtime='',createtime='',argument='',forcesearch='',isjob='1',num='',completenum=''):
        '''
        Constructor
        '''
#         taskstatus=1 //未启动
#         taskstatus=2 //排队中
#         taskstatus=3 //正在进行
#         taskstatus=4 //挂起
#         taskstatus=5 //已完成
#         taskstatus=6 //已终止
#         mode=1//正常状态
#         mode=0//异常状态
        self.tasksname=tasksname
        self.taskaddress=taskaddress
        self.priority=priority
        self.starttime=starttime
        self.username=username
        self.completenum=completenum
        self.num=num
        self.isjob=isjob
        self.mode=1
        if forcesearch!='':
            self.forcesearch=forcesearch

        else:
            self.forcesearch='0'
        if createtime!='':
            self.createtime=createtime
        else:
            self.createtime=webtool.getlocaltime()
        if tasksid!='':
            self.tasksid=tasksid
        else:
            self.tasksid=uuid.uuid1()
        self.tasksport=tasksport
        self.taskstatus=taskstatus
        self.result=result
        self.endtime=endtime
        self.argument=argument
Beispiel #13
0
    def __init__(self,ip='',port='',timesearch='',state='',name='',product='',version='',script='',detail='',head='',city='',hackinfo='',disclosure='',keywords=None,webtitle='',webkeywords=''):
        '''
        Constructor
        '''
        self.ip=ip
        self.port=port
        self.version=version
        self.state=state
        self.name=name
        if timesearch!='':
            self.timesearch=timesearch
        else:
            self.timesearch=webtool.getlocaltime()

        self.product=product
        self.script=script
        self.detail=detail
        self.head=head
        self.city=city
        self.hackinfo=hackinfo
        self.disclosure=disclosure
        self.keywords=keywords
        self.webkeywords = webkeywords
        self.webtitle = webtitle

        if self.keywords is None:
            self.keywords=Location(ip=str(self.ip)).getData()
        else:
            try:

                data=eval(keywords)
                self.keywords=data
                if self.keywords.get('geoip',None) is None:
                    self.keywords = Location(ip=str(self.ip)).getData()
            except Exception,e:

                self.keywords = Location(ip=str(self.ip)).getData()
Beispiel #14
0
    def __init__(self,ip='',vendor='',osfamily='',osgen='',accurate='',state='',hostname='unknow',updatetime='',city='',isp='',county='',country='',region='',location=None):
        '''
        Constructor
        '''

        self.ip=ip
        self.vendor=vendor
        self.osgen=osgen
        self.osfamily=osfamily
        self.accurate=accurate
        if updatetime!='':
            self.updatetime=updatetime
        else:
            self.updatetime=webtool.getlocaltime()
   
        self.state=state
        self.hostname=hostname
        self.city=city
        self.isp=isp
        self.county=county
        self.country=country
        self.region=region

        self.location = location
        if self.location is None:
            self.location = Location(ip=str(self.ip)).getData()
        else:
            try:

                data = eval(location)
                self.location = data
                if self.location.get('geoip', None) is None:
                    self.location = Location(ip=str(self.ip)).getData()
            except Exception, e:

                self.location = Location(ip=str(self.ip)).getData()