Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Calculate the IP address as a long integer

:param ip: IP address as a dotted-quad string
:return: Long value of the IP address

        def ip2long(ip):
    """Calculate the IP address as a long integer

    :param ip: IP address as a dotted-quad string
    :return: Long value of the IP address
    """
    return struct.unpack('!L', socket.inet_aton(ip))[0]
        


src/l/a/Lair-Drones-HEAD/lairdrone/nessus.py   Lair-Drones(Download)
            if tag.attrib['name'] == 'host-ip':
                host_dict['string_addr'] = tag.text
                host_dict['long_addr'] = helper.ip2long(tag.text)
 
            # MAC address tag
        if not host_dict['string_addr']:
            host_dict['string_addr'] = temp_ip
            host_dict['long_addr'] = helper.ip2long(temp_ip)
 
        # Add all encountered ports to the host

src/l/a/Lair-Drones-HEAD/lairdrone/nmap.py   Lair-Drones(Download)
            if addr.attrib['addrtype'] == 'ipv4':
                host_dict['string_addr'] = addr.attrib['addr']
                host_dict['long_addr'] = helper.ip2long(addr.attrib['addr'])
            elif addr.attrib['addrtype'] == 'mac':
                host_dict['mac_addr'] = addr.attrib['addr']

src/l/a/Lair-Drones-HEAD/lairdrone/nexpose.py   Lair-Drones(Download)
        # Set IP address
        host_dict['string_addr'] = node.attrib['address']
        host_dict['long_addr'] = helper.ip2long(node.attrib['address'])
 
        # Set the OS fingerprint