yolothreat / utilitybelt

A Python library for being a CND Batman....
MIT License
35 stars 12 forks source link

adds function to get geolocation from domain names using round robin dns #58

Open blackfist opened 9 years ago

blackfist commented 9 years ago

This came up for discussion in our python code review club meeting earlier this week. The domain_to_geo function passes the domain directly to pygeoip which returns a location. However if the domain being searched uses round-robin DNS for some reason then the domain may resolve to multiple IP addresses which could be in several places.

This PR adds a function called domain_to_mgeo which will get all the ip addresses that the domain resolves to and then get location info for each of them, returning a list of dictionaries. In order to honor the promises made by previous functions, the existing domain_to_geo function continues to work the way it did before but it does raise a warning if a domain resolves to multiple ip addresses.

krmaxwell commented 9 years ago

Once #59 is merged into master, you can merge that into here (or just do that from your own branch) so we can get happy :white_check_mark:

blackfist commented 9 years ago

you mean we need to add a test to test_domain_to_geo where we pass something like heroku.com so that it tests the conditional? Or do we need to write the test so that it checks if a warning is raised? Because that second one seems more difficult.

krmaxwell commented 9 years ago

Oops, missed your question here. The first one - it'll test the conditional and raise the warning and that'll be good.

sroberts commented 8 years ago

This shows as good to go, is it?