[ create a new paste ] login | about

Link: http://codepad.org/6M2KhlKR    [ raw code | fork ]

Python, pasted on Feb 20:
import hmac
import hashlib
import urllib
import urllib2

AppKey = 'xxfvFQcOzpTBvwuwPMwwzLZxiCSaGb'
HMKey = 'DgQ3aNpoluV1cl3GFJAqitBg5xKiXZ'

def authenticate():
    CT = '1234567890'
    message = AppKey + CT
    HB = hmac.new(HMKey, message, hashlib.sha256).hexdigest()
    url = 'https://api.2ch.net/v1/auth/'
    values = {'ID' : '', 'PW' : '', 'KY' : AppKey, 'CT' : CT, 'HB' : HB }
    headers = { 'User-Agent' : '', 'X-2ch-UA': 'JaneStyle/3.80'}
    data = urllib.urlencode(values)
    req = urllib2.Request(url, data, headers)
    response = urllib2.urlopen(req)
    sid = response.read()
    sid = sid.split(':')[1]
    return sid

def getDAT(serverName, boardName, threadId, sid):
    message = "/v1/" + serverName + "/" + boardName + "/" + threadId + sid + AppKey
    hobo = hmac.new(HMKey, message, hashlib.sha256).hexdigest()
    url = 'https://api.2ch.net/v1/' + serverName + "/" + boardName + "/" + threadId
    values = { 'sid' : sid, 'hobo' : hobo, 'appkey': AppKey }
    headers = { 'User-Agent' : 'Mozilla/3.0 (compatible; JaneStyle/3.80..)'}
    data = urllib.urlencode(values)
    req = urllib2.Request(url, data, headers)
    response = urllib2.urlopen(req)
    return response.read() 
    
sid = authenticate()
dat = getDAT('anago', 'software', '1424327586', sid)
print dat


Create a new paste based on this one


Comments: