geo newbie
- Write-up Author: bruce30262
Description
Talentyange gives lots of tedious apks and you know how bad he is now. Let's try some interesting geography knowledge.
nc 202.112.26.111 29995 / nc 202.112.28.118 29995
Solution
For level0, just download a .json file (level0.json) from internet and use it as the alpha2 code database. Just extract the country name and send the corresponding alpha2 code.
For level1, I use the google API:
http://maps.googleapis.com/maps/api/geocode/json
extract the location from server and pass it as the "address" parameter, the API will respond with a json format response. Parse the json and get the correct country name. Notice that sometimes google API sometime respond a wrong country(mostly it respond US instead of the correct country), so we will need to handle some special cases(hard-code the correct answer).
For level2, I just hard-code all the answer in the script.
File Links
level0.json
https://drive.google.com/file/d/0B2bWJ2sAPCV3T1Y0d1kyNHFRNEk/view?usp=sharing
geo.py
https://drive.google.com/file/d/0B2bWJ2sAPCV3OFlfcExQRWdnWDQ/view?usp=sharing