コード例 #1
0
def main():
    query_message = ZeroAccessUtil.buildMessage()

    SEPARATOR = '/'
    if sys.platform == 'win32':
        SEPARATOR = "\\"

    message = ZeroAccessUtil.buildMessage()
    print message.encode("hex")

    nonQueryedNodes = mul.Queue(5000)

    zeroaccess_bootstrap_seeds_path = "Data"+SEPARATOR+"zeroaccess_node.dat"
    zeroaccess_nodes = ZeroAccessUtil.read_zeroaccess_data_from_file(zeroaccess_bootstrap_seeds_path)

    pile = eventlet.GreenPile()
    for x in zeroaccess_nodes[:10]:
        pile.spawn(query, x,message)

    # note that the pile acts as a collection of return values from the functions
    # if any exceptions are raised by the function they'll get raised here
    key = [ord('2'),ord('p'),ord('t'),ord('f')]
    for node, result in zip(zeroaccess_nodes[:10], pile):
        if(result == ''):
            print 'no response from '+ socket.inet_ntoa(struct.pack('I',node.get_ip()))
            continue
        print 'received'
        original_message = ZeroAccessUtil.xorMessage(result[0],key)
        crc32,retL_command,b_flag,ip_count = struct.unpack('IIII',original_message[:16])
        print socket.inet_ntoa(struct.pack('I',node.get_ip()))+' --> ip count:  '+str(ip_count)
コード例 #2
0
def main():
    query_message = ZeroAccessUtil.buildMessage()

    SEPARATOR = '/'
    if sys.platform == 'win32':
        SEPARATOR = "\\"

    message = ZeroAccessUtil.buildMessage()
    print message.encode("hex")

    nonQueryedNodes = mul.Queue(5000)

    zeroaccess_bootstrap_seeds_path = "Data" + SEPARATOR + "zeroaccess_node.dat"
    zeroaccess_nodes = ZeroAccessUtil.read_zeroaccess_data_from_file(
        zeroaccess_bootstrap_seeds_path)

    pile = eventlet.GreenPile()
    for x in zeroaccess_nodes[:10]:
        pile.spawn(query, x, message)

    # note that the pile acts as a collection of return values from the functions
    # if any exceptions are raised by the function they'll get raised here
    key = [ord('2'), ord('p'), ord('t'), ord('f')]
    for node, result in zip(zeroaccess_nodes[:10], pile):
        if (result == ''):
            print 'no response from ' + socket.inet_ntoa(
                struct.pack('I', node.get_ip()))
            continue
        print 'received'
        original_message = ZeroAccessUtil.xorMessage(result[0], key)
        crc32, retL_command, b_flag, ip_count = struct.unpack(
            'IIII', original_message[:16])
        print socket.inet_ntoa(struct.pack(
            'I', node.get_ip())) + ' --> ip count:  ' + str(ip_count)