Skip to content

Instantly share code, notes, and snippets.



Created Sep 13, 2015
What would you like to do?
Sony Entertainment Network spam stopper
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import urllib
import urllib2
import datetime
import sys
import time
from HTMLParser import HTMLParser
# create a subclass and override the handler methods
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
attrs_dict = dict(attrs)
if tag == "input" and attrs_dict.get('name', '') == "blah_token":
setattr(self, "value", attrs_dict.get("value"))
def handle_endtag(self, tag):
def handle_data(self, data):
values = {
'' : 'blah_token',
'blah_token': '',
'verifyType': 'dob',
'account.dob': '1',
'account.mob': '1',
'account.yob': '1980',
# IMPORTANT: paste the URL received in the change password e-mail in the url variable, the url looks something like this:
#!input.action?token=***some token here***&request_locale=pt_BR&service-entity=np
url = '*** PASTE URL HERE ***'
url_post = ""
s = requests.session()
r = s.get(url)
date = datetime.datetime(1960, 1, 1, 1, 1, 1)
today =
while date < today:
date += datetime.timedelta(days=1)
# find token
parser = MyHTMLParser()
if not hasattr(parser, "value"):
print "!!!!! FOUND %s" % date.isoformat()
val = getattr(parser, "value")
print "blah_token = %r" % val
values['blah_token'] = val
values['account.dob'] = str(
values['account.mob'] = str(date.month)
values['account.yob'] = str(date.year)
r =, values)
# IMPORTANT: The message is in portuguese, you will need to change this message to match your language
if u'A data de nascimento inserida é inválida. Verifique a data e tente novamente.' in r.text:
print "birthday is not %s" % date.isoformat()
print "!!!!! FOUND %s" % date.isoformat()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.