Created
October 13, 2017 05:37
-
-
Save sente/52aa383c485f8dc817c0d321dda21c65 to your computer and use it in GitHub Desktop.
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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"import json\n", | |
"import hashlib\n", | |
"import mechanize\n", | |
"\n", | |
"email = 'stuart.powers@gmail.com'\n", | |
"password = 'towntown'\n", | |
"\n", | |
"# load www.foodler.com\n", | |
"b = mechanize.Browser()\n", | |
"b.open('http://www.foodler.com/')\n", | |
"\n", | |
"\n", | |
"# select the first form, fill in the username / password\n", | |
"b.select_form(nr=0)\n", | |
"b.form['email']=email\n", | |
"b.form['password'] = password\n", | |
"\n", | |
"# submit the form....\n", | |
"res = b.submit()\n", | |
"\n", | |
"# now that we're authenticated... make a request to /user/levelUpConnect.do...\n", | |
"res = b.open('/user/LevelUpConnect.do?email=random_email_whatever@gmail.com')\n", | |
"text = res.read()" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"print text" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"{\n", | |
" \"U:311895868\": {\n", | |
" \"firstName\": \"Stuart\",\n", | |
" \"lastName\": \"Powers\",\n", | |
" \"password\": \"4e:10189e8a4e04737e2325fb768f3813ef\",\n", | |
" \"email\": \"stuart.powers@gmail.com\",\n", | |
" \"phone\": \"(978) 866-1005\",\n", | |
" \"bestBetsCount\": 6,\n", | |
" \"lastSearch\": \"A:311895869\",\n", | |
" \"postRestRatings\": \"NEVER\",\n", | |
" \"postItemRatings\": \"NEVER\",\n", | |
" \"addresses\": [\"A:311895869\"],\n", | |
" \"cards\": [],\n", | |
" \"devices\": [],\n", | |
" \"appRatingPrompt\": false,\n", | |
" \"gold\": {\n", | |
" \"brief\": \"Not yet!\",\n", | |
" \"earned\": false,\n", | |
" \"explanation\": \"Earn 1250 more points in March to qualify.\",\n", | |
" \"benefits\": false\n", | |
" },\n", | |
" \"orders\": {\"active\": []}\n", | |
" },\n", | |
" \"LevelUpConnect\": {\n", | |
" \"connected\": false,\n", | |
" \"status\": \"success\"\n", | |
" }\n", | |
"}\n" | |
] | |
} | |
], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"data = json.loads(text)\n", | |
"salt_and_md5 = data['U:311895868']['password']\n", | |
"print salt_and_md5" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"4e:10189e8a4e04737e2325fb768f3813ef\n" | |
] | |
} | |
], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"salt = salt_and_md5[0:2]\n", | |
"md5string = salt_and_md5[3:]\n", | |
"\n", | |
"print salt\n", | |
"print md5string" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"4e\n", | |
"10189e8a4e04737e2325fb768f3813ef\n" | |
] | |
} | |
], | |
"prompt_number": 5 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"# our password is \"school\", as defined above\n", | |
"our_md5 = hashlib.md5(salt + password).hexdigest()\n", | |
"print our_md5" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"10189e8a4e04737e2325fb768f3813ef\n" | |
] | |
} | |
], | |
"prompt_number": 6 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"if md5string == our_md5:\n", | |
" print \"%s == %s\" % (md5string, our_md5)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"10189e8a4e04737e2325fb768f3813ef == 10189e8a4e04737e2325fb768f3813ef\n" | |
] | |
} | |
], | |
"prompt_number": 7 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [] | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment