def identifyip(msg, dic): listitem = iptask.getObject() ary = set() # 可以输入多个ip,用,分割的 msg = msg.split(',') import re # ip段用-表示 regix="(\d+\.\d+\.\d+\.\d+)\-(\d+\.\d+\.\d+\.\d+)" for i in msg: m1 = re.search(regix, i) print m1,i,'this is taskscontrol::identifyip()' if m1: iprange = m1.group().split('-') print "taskscontrol::identifyip()", iprange, i startip = iprange[0] stopip = iprange[1] listitem.add_work([(startip, stopip, dic)]) else: regixx = "(\d+\.\d+\.\d+\.\d+)" m2 = re.search(regixx, i) if m2: ary.add(m2.group()) else: # web页面地址,eg:www.baidu.com ary.add(i) for i in ary: listitem.add_work([(i, i, dic)]) return listitem
def identifyip(msg,dic): listitem = iptask.getObject() ary=set() msg=msg.split(',') import re regix="(\d+\.\d+\.\d+\.\d+)\-(\d+\.\d+\.\d+\.\d+)" for i in msg: m1 = re.search(regix, i) if m1: iprange=m1.group().split('-') startip=iprange[0] stopip = iprange[1] listitem.add_work([(startip, stopip, dic)]) else: regix = "(\d+\.\d+\.\d+\.\d+)" m1 = re.search(regix, i) if m1: ary.add(m1.group()) # else: # ary.add(i) for i in ary: listitem.add_work([(i, i, dic)])
def identifyip(msg, dic): listitem = iptask.getObject() ary = set() msg = msg.split(',') import re regix = "(\d+\.\d+\.\d+\.\d+)\-(\d+\.\d+\.\d+\.\d+)" for i in msg: m1 = re.search(regix, i) print m1, i, 'this is 237' if m1: iprange = m1.group().split('-') print iprange, i startip = iprange[0] stopip = iprange[1] listitem.add_work([(startip, stopip, dic)]) else: regixx = "(\d+\.\d+\.\d+\.\d+)" m2 = re.search(regixx, i) if m2: ary.add(m2.group()) else: ary.add(i) for i in ary: listitem.add_work([(i, i, dic)])
def normaltask(): info = {} info['isjob'] = '0' info['command'] = 'work' listitem = iptask.getObject() listitem.add_work([('1.1.1.1', '254.254.254.254', info)]) pass
def normaltask(): info = {} info['isjob'] = '0' info['command'] = 'work' listitem=iptask.getObject() listitem.add_work([('1.1.1.1','254.254.254.254',info)]) pass
def listiptask(): listitem = iptask.getObject() listitem.add_work([('172.20.13.11', '172.20.13.12')]) print '自定义任务已经启动'
def listiptask(): listitem=iptask.getObject() listitem.add_work([('172.20.13.11','172.20.13.12')]) print '自定义任务已经启动'