django : about subnet address range query - django

Hello all,
I am working with mysql & django.
I need some time to query of IP address range.
example: 10.25.239.0/26
but, I don't have any idea.
Could you help me?

There are a number of libraries for dealing with IP addresses. We used CIDR Block Converter with a few tweaks. There's also Python ip-tools and several others.

Related

Unable to ping domain set up in Route 53

I have multiple GoDaddy domains that point to AWS DNS Servers, which in turn point to a load balancer and thence to (at the moment) an instance. All but one of these work fine and one steadfastly refuses to work, even after deleting and recreating (multiple times).
Using the SDK I have tried to find a significant difference between Zones / Resource Record Sets and have not come up with anything that would explain it. DNSSTuff has not yielded any clues (nor have a couple of other online tools).
An example of a working domain is care.work, and the failing one is plaitapp.org.
Thanks in advance.
It just appears to have been amazingly slow propogation for one domain, while all the others were almost instant.

How to find historical geolocation for an IP address, perhaps using maxmind?

I was wondering if there is any way to find historical geolocation IP information? Everything I've been able to find discusses current data, but I've been unable to find any way to query a service or DB to, for example, look for information on an IP from a few years ago.
I found this article titled 'How to perform historical IP geolocation lookups' and it does mention maxmind as a potential tool for availability of historical versions but it doesn't mention how to access this data.
Looking through the maxmind api docs I can't seem to find any way to query by date either.
How could one go about finding the location of an IP at a given time in the past? (Extreme accuracy not necessary, an example would be Find the country of this IP address in 2012)
Perhaps there is an easier solution, but it seems that you can download quite a few (not all) old versions of the MaxMind database via the Wayback Machine. For example, this shows the snapshots they have of the binary database. For the CSV files, you'd need to look up the snapshots for specific filenames, and manually change the filenames to the desired 1st-of-month date. For example, here's one.
That said, these posts seem to suggest that IP ranges aren't reassigned to different geographies very often--might not be necessary to worry about getting old versions of the database:
https://serverfault.com/questions/286025/historical-ip-geo-location
https://serverfault.com/questions/59167/how-often-do-ip-blocks-get-reassigned-to-different-regions

Geolocate IP address with GeoLite2 database

I have a list of IP addresses (IPv4 in the form 122.XXX.XXX.XXX) which I want to be assigned to a pair of latitude and longitude coordinates; I would be happy also with a approximate location. I downloaded the free GeoLite2 database (here) but I don't understand how should I proceed, since the IP information in the database is stored as IPv6 (on which I have no experience).
Is there any way to proceed? Should I use drop everything after ::ffff: and then match the rest of the string with my IPv4? Or should I also drop part of my IPv4, which I want to geolocate?
The GeoLite2 database is in hybrid notation to be forwards compatible. While dropping everything after ::ffff: would work, I would recommend the opposite, convert the IPs you get into hybrid notation and then match. (Just add ::ffff: to the front). This should help if you ever have to start supporting IPv6.

how to get country name and/or code by IP address?

Sorry for so noobish question but how can I do it with C++? I need to get country names and their 2-letter or 3-letter ISO codes (or whatever it's called) using a given IP address. Is there any way to do this easily?
The only two ways I found are to use GeoIP C library or to download a free database but is there something more dynamic? I mean, is there a free web-service with up-to-date db I can utilize for my purpose using curl or something?
Thanks in advance.
MaxMind.com exposes a set of web services for geolocation. They're not free, but cheap per lookup.
One of my clients uses their city-level lookup service, with each result cached for a reasonable period (from memory, 2 or 3 weeks), since IP address blocks don't change location that often.
The application also counts the number of actual lookups to send an admin notification when the number remaining in the subscription gets low, so it can be topped up manually.
I also use the downloadable database in several applications, with a scheduled update process to keep it up to date.
http://www.hostip.info provides an API.

Should I use a user's IP Address in the Cookie's hash?

Is using a User's IP addr as part of a Cookie's hashed value that I store in the database a bad idea? I read somewhere that since most user's have dynamic IP addresses that it was bad practice to use this as part of the hash. If so what kind of user data should I pull in the hash? Or do I really need to?
Thanks.
While dynamic IP addresses (using DHCP) are an issue, they're not likely to change in small timeframes. The real problem arises from the fact that some users are behind proxies that make requests from different IP addresses all the time.
It might make sense in some Intranet environments, but I believe for a public Internet facing Web site, it's an absolute no-no.
Bad idea. There are a number of large ISPs (AOL worldwide & Virgin cable in the UK among others) that route all their users through a (relatively) small number of proxy servers, but the actual server they use, can and does change between almost every request.
If you do want to uniquely identify particular (non-logged-in) users, without requiring a back-end store, some kind of GUID may be useful.