Created
September 12, 2020 18:29
-
-
Save heyibrahimkhan/74a75236b61b391367a0ffa950f39632 to your computer and use it in GitHub Desktop.
Crawl EC2 Instance Metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from pprint import pprint | |
| def r_get(url): | |
| res = requests.get(url) | |
| print(url) | |
| print(res.text) | |
| if res.status_code == 404: | |
| return | |
| else: | |
| for uri in res.text.split('\n'): | |
| r_get('{0}/{1}'.format(url, uri)) | |
| init_url = 'http://169.254.169.254' | |
| r_get(init_url) | |
| # res = requests.get(init_url) | |
| # print(res.text) | |
| # print(res.text.split('\n')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment