-
Notifications
You must be signed in to change notification settings - Fork 157
[old] Trial & error
○ id is the FULLNAME of the Thing (Link)
○ dir in [-1,0,1]
○ r is subreddit name
○ vh? vote hash
○ uh? user hash
// Cookie=reddit_first=%7B%22organic_pos%22%3A%201%2C%20%22firsttime%22%3A%20%22first%22%7D; last_thing=; talklittle_reddit_counts=; talklittle_last_thing=; talklittle_recentclicks2=t3_96jf1%2Ct3_96pf4%2Ct3_96o76%2Ct3_96nm6%2Ct3_96l6g%2Ct3_7y43n%2Ct3_96f84%2Ct3_8wirs%2Ct3_8ecqd%2Ct3_96f84%2Ct3_8ecqd%2Ct3_96m5x%2Ct3_96o1p%2Ct3_96iwc%2Ct3_96dek%2Ct3_96dgw%2Ct3_96iok%2Ct3_96g6t%2Ct3_96cko%2Ct3_96dg0%2Ct3_96dpa%2Ct3_96gc9%2Ct3_96cdt%2Ct3_96eq9%2Ct3_96daz%2Ct3_95y8r%2Ct3_9682f%2Ct3_962ee%2Ct3_963xl%2Ct3_95vil%2Ct3_967b9%2Ct3_95zwm%2Ct3_96066%2Ct3_9614s%2Ct3_960jn%2Ct3_96140%2Ct3_961xe%2Ct3_95y1a%2Ct3_95zs4%2Ct3_96317%2Ct3_95uv7%2Ct3_963bj%2Ct3_965v7%2Ct3_961k1%2Ct3_962se%2Ct3_961k1%2Ct3_95uyy%2Ct3_95tn0%2Ct3_95uu1%2Ct3_95o82%2Ct3_95sgg%2Ct3_95sxx%2Ct3_95h0l%2Ct3_95kfa%2Ct3_7smc4%2Ct3_8w7js%2Ct3_8zayp%2Ct3_95h98%2Ct3_95il8%2Ct3_95krq%2Ct3_95g3n%2Ct3_95ino%2Ct3_7l0fx%2Ct3_8yvu7%2Ct3_956pf%2Ct3_95bf3%2Ct3_959u9%2Ct3_95c6d%2Ct3_959m8%2Ct3_8wirs%2Ct3_959y2%2Ct3_954yd%2Ct3_9579o%2Ct3_94z4i%2Ct3_94vyc%2Ct3_94zhk%2Ct3_94z5w%2Ct3_95462%2Ct3_9528k%2Ct3_94txt%2Ct3_94yh0%2Ct3_950um%2Ct3_94vzs%2Ct3_94v02%2Ct3_94pf2%2Ct3_94txl%2Ct3_94qj9%2Ct3_94qzm%2Ct3_94so6%2Ct3_94s5p%2Ct3_94ow8%2Ct3_94tww%2Ct3_94q6b%2Ct394qr0; recentclicks2=t3_96lrd%2C; talklittle_test_recentclicks2=t3_96pf4%2Ct3_96nfp%2Ct3_96r6k%2Ct3_96i6j%2Ct3_96otl%2Ct3_96nnt%2Ct3_96ppa%2Ct3_96nvv%2C; talklittle_test_reddit_counts=; talklittle_test_last_thing=;
// redditsession=5488034%2C2009-08-01T22%3A52%3A43%2Cf6ddf116ab7bc6b53021fa94e1b070eaccbb80d9
• How to handle Cookies, vh=vote hash, uh=user hash? It seems just attaching the CookieStore doesn’t work
○ Hmm, looks like validator.py does nothing for now. Maybe all I have to do is attach vh and uh?
§ Then how come when you tamper with the POST in http, it breaks? oh well maybe the API version is different/unfinished?
414class VModhash(Validator):
415 default_param = ‘uh’
416 def run(self, uh):
417 pass
418
419class VVotehash(Validator):
420 def run(self, vh, thing_name):
421 return True
Pasted from <http://code.reddit.com/browser/r2/r2/controllers/validator/validator.py>
def RedditController.pre(self):
[SNIP]
467 # populate c.cookies unless we’re on the unsafe media_domain
468 c.cookies = Cookies()
469 if request.host != g.media_domain or g.media_domain == g.domain:
470 try:
471 for k,v in request.cookies.iteritems():
472 # we can unquote even if it’s not quoted
473 c.cookies[k] = Cookie(value=unquote(v), dirty=False)
474 except CookieError:
475 #pylons or one of the associated retarded libraries
476 #can’t handle broken cookies
477 request.environ[‘HTTP_COOKIE’] = ‘’
478
479 c.response_wrappers = []
480 c.errors = ErrorSet()
481 c.firsttime = firsttime()
482 (c.user, maybe_admin) = \
483 valid_cookie(c.cookies[g.login_cookie].value
484 if g.login_cookie in c.cookies
485 else ’’)
486
487 if c.user:
488 c.user_is_loggedin = True
489 else:
490 c.user = UnloggedUser(get_browser_langs())
491 c.user._load()
[SNIP]
Pasted from <http://code.reddit.com/browser/r2/r2/controllers/reddit_base.py>
Doesn’t work (telnet www.reddit.com 80):
POST /api/vote HTTP/1.1
Host: www.reddit.com
Cookie: reddit_session=5998378%2C2009-08-02T15%3A19%3A29%2C5e4384b76f96425eeaa1be6d209d10f59002295f; Domain=reddit.com; Path=/
Cookie: reddit_first=%7B%22firsttime%22%3A%20%22first%22%7D; Domain=reddit.com; expires=Thu, 31 Dec 2037 23:59:59 GMT; Path=/
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 125
id=t1_c0bmiqy&dir=1&vh=383e17a140121d69c19eeee213a383dd0e80eb9c&r=TRUST&uh=2w55hveq8hbf249c9fe784b3308273ee4cfa9d0353e6814b0a