コード例 #1
0
def get_config():
    global task_id
    global task_name
    global uuid
    global platform

    with open(config.CONFIG_FILE, 'r') as f:
        task = base64.b64decode(f.read()).decode('utf-8').split(';')
    print(task)
    task_id = task[0]
    uuid = task[4]
    task_name = task[1]
    platform = task[2]
    with open(config.TARGET_LIST, 'w') as dns_f:
        dns_f.write(task[3])
    if os.path.getsize(config.TARGET_LIST) <= 0:
        e = 'No target IP.'
        log.get_conf_fail()
        log.write_error_to_appstatus(e, 3)
コード例 #2
0
    if not os.path.exists(constans.RLT):
        os.makedirs(constans.RLT)
    ipList = []
    resultList = []
    # pool = Pool(16)
    log.get_conf()
    mid = ()
    # 判断网络
    is_connect.Update()
    try:
        mid = setConfig()
        log.get_conf_success()
    except Exception as conf_e:
        print(conf_e)
        traceback.print_exc()
        log.get_conf_fail()
        log.write_error_to_appstatus(str(conf_e), -1)

    ip_set = mid[3]
    # print len(ip_set)
    if len(ip_set) != 0 and len(ip_set) != 1:
        if ip_set.find(',') != -1:
            ipList = ip_set.split(',')
        elif ip_set.find('-') != -1:
            ipStr = ip_set.split('-')
            ipInt1 = socket.ntohl(struct.unpack("I", socket.inet_aton(str(ipStr[0])))[0])
            ipInt2 = socket.ntohl(struct.unpack("I", socket.inet_aton(str(ipStr[1])))[0])
            for i in xrange(ipInt1, ipInt2 + 1):
                ipList.append(socket.inet_ntoa(struct.pack('I', socket.htonl(i))))
        else:
            ipList.append(ip_set)