注意
此教程为原创教程,未经允许,禁止转载。
此教程使用Python实现,其他语言也大同小异。
更新中...
前言
据上次玩球球大作战已经有几个月了,最近看到它又出了个龙蛋获取分享链接,又想试着分析一下。
刚开始看到这个,还挺复杂了,什么混淆啊,捉迷藏啊。
分析过程
当我拿到我的分享链接:
一看就知道是个短网址,真实URL需要访问过才看得到。
这个就是我访问后的到的URL
我通过谷歌浏览器的开发者工具看到:
这个应该是获取龙蛋的请求,可是我应该到哪里去找id呢?
如果需要给出用户信息的话,应该是url中的b参数了。
学过信息安全这门课,这个b的值应该是base64编码过的。
在这个页面中的index.js也给出了答案:
atob不是base64解码的吗?
你要问我是怎么看到的?我将它的一个数组输出了:
数组元素有135个,这里我列出我认为必要重要的:
他们(开发人员)为什么要这么做,为了不让我们通过关键字查找来破解提取出id。
可是id等信息已经放到了url上了。
aWQ9OTkxNjE4NDUmQWNjb3VudD0lRTYlODglOTElRTYlODElOEIlRTUlQkQlQkMlRTYlODElOEImMD10ZW1wJkxldmVsPTYmU2NvcmVzPTEmSWNvbj00JlBhc3NJY29uPSZ0eXBlPTM=
我将此字符串用base64解码得到:
id=99161845&Account=%E6%88%91%E6%81%8B%E5%BD%BC%E6%81%8B&0=temp&Level=6&Scores=1&Icon=4&PassIcon=&type=3
我的id已经看到了。
然后就可以用
来获取龙蛋了。当你把type=3,改成type=1就是获取棒棒糖的,很简单吧。
这里给出我用Python写的代码,如果要实现每天自动点击的话,可以设置定时任务。当然也不要忘了使用代理ip来请求。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-06-13 09:55:17
# @Author : sungod (hvner@vip.qq.com)
# @Link : http://www.xtype.cn/
# @Version : $Id$
import urllib
import urllib2
import base64
import re
# 龙蛋 http://t.cn/RSBFXMR
# http://cn.battleofballs.com/share?type=3&id=99161845
# 棒棒糖 http://t.cn/RJPARSV
# http://cn.battleofballs.com/share?type=1&id=99161845
api = 'http://cn.battleofballs.com/share?{}'
# 获取龙蛋分享链接的ID
def getIdByLdUrl(url):
if url is None:
print 'url is Empty.'
raise NameError
try:
resp = urllib2.urlopen(url)
except Exception:
print 'network is Error.'
return None
print resp.url
base64info = re.match(r'^http://.*\?b=(.*)$', resp.url)
if base64info is None:
print 'the server tactics is exchange.'
return None
url, = base64info.groups()
t = base64.b64decode(url)
print t
info = t.split('&')
return info[0].split('=')[1]
# 获取棒棒糖分享链接的ID
def getIdByBtUrl(url):
if url is None:
print 'url is Empty.'
raise NameError
try:
resp = urllib2.urlopen(url)
except Exception:
print 'network is Error.'
return None
print resp.url
info = re.match(r'^http://.*\?id=(\d*)&.*$', resp.url)
if info is None:
print 'the server tactics is exchange.'
return None
id, = info.groups()
return id
# 获取棒棒糖或者龙蛋
def get(id, type=1):
'''
id: balss id
type: value 1 bangbangt, value 2 longdan
'''
param = {'id': id, 'type': type}
_api = api.format(urllib.urlencode(param))
try:
resp = urllib2.urlopen(_api)
except Exception:
print 'server Error.'
return False
if resp.read() == 'ok':
return True
return False
if __name__ == '__main__':
print get(99161845, 1)