|
本帖最后由 小范q 于 2018-9-2 02:18 编辑
PS:APP 提供来源
app 下载 地址:
http://sj.qq.com/myapp/detail.htm?apkName=com.douban.frodo
app 提供来源:
https://bbs.125.la/forum.php?mod=viewthread&tid=14224798&highlight=APP
第一步 抓登陆抓包:
- POST /service/auth2/token HTTP/1.1
- User-Agent: api-client/1 com.douban.frodo/6.1.0(139) Android/19 product/hammerhead vendor/LGE model/Nexus 5 rom/android network/wifi
- Content-Type: application/x-www-form-urlencoded
- Host: frodo.douban.com
- Connection: Keep-Alive
- Accept-Encoding: gzip
- Content-Length: 392
- client_id=0dad551ec0f84ed02907ff5c42e8ec70&client_secret=9e8bb54dc3288cdf&redirect_uri=frodo%3A%2F%2Fapp%2Foauth%2Fcallback%2F&disable_account_create=false&grant_type=password&username=13812345678&password=1234560&channel=Yingyongbao_Market&os_rom=android&apikey=0dad551ec0f84ed02907ff5c42e8ec70&udid=596aec52fe72086faa056c1ac42a72ecd5d783d9&_sig=EQ2z1upchKZqXmbwsf1yQlrMx3o%3D&_ts=1535823784
复制代码
第二步 分析加密主要参数:
client_id | 0dad551ec0f84ed02907ff5c42e8ec70 | client_secret | 9e8bb54dc3288cdf | redirect_uri | frodo://app/oauth/callback/ | disable_account_create | false | grant_type | password | username | 13812345678 | password | 1234560 | channel | Yingyongbao_Market | os_rom | android | apikey | 0dad551ec0f84ed02907ff5c42e8ec70 | udid | 596aec52fe72086faa056c1ac42a72ecd5d783d9 | _sig | EQ2z1upchKZqXmbwsf1yQlrMx3o= | _ts | 1535823784 |
第三步 反编译逆向找到其主要算法
- @JavascriptInterface public String decoratorUrl(String arg5) {
- try {
- Uri v0_1 = Uri.parse(arg5);
- if(!TextUtils.equals(v0_1.getHost(), "frodo.douban.com") && !TextUtils.equals(v0_1.getHost(), "api.douban.com") && !TextUtils.equals(v0_1.getHost(), "read.douban.com")) {
- return arg5;
- }
- Uri$Builder v0_2 = Uri.parse(arg5).buildUpon().appendQueryParameter("udid", FrodoUtils.a()).appendQueryParameter("rom", Utils.g()).appendQueryParameter("apikey", FrodoUtils.b()).appendQueryParameter("s", "rexxar_new");
- if(AppContext.b() != null) {
- v0_2.appendQueryParameter("channel", AppContext.b().market);
- }
- Pair v1 = ApiSignatureHelper.a(arg5, "GET", null);
- if(v1 != null) {
- v0_2.appendQueryParameter("_sig", v1.first);
- v0_2.appendQueryParameter("_ts", v1.second);
- }
- arg5 = v0_2.build().toString();
- }
- catch(Exception v0) {
- v0.printStackTrace();
- }
- return arg5;
- ------------------------------------------------------------------------------------------------------------------
- public static Pair a(String arg5, String arg6, String arg7) {
- Pair v1 = null;
- if(TextUtils.isEmpty(((CharSequence)arg5))) {
- return v1;
- }
- String v0 = FrodoApi.a().e.b;
- if(TextUtils.isEmpty(((CharSequence)v0))) {
- return v1;
- }
- StringBuilder v2 = new StringBuilder();
- v2.append(arg6);
- arg5 = HttpUrl.parse(arg5).encodedPath();
- if(arg5 == null) {
- return v1;
- }
- arg5 = Uri.decode(arg5);
- if(arg5 == null) {
- return v1;
- }
- if(arg5.endsWith("/")) {
- arg5 = arg5.substring(0, arg5.length() - 1);
- }
- v2.append("&");
- v2.append(Uri.encode(arg5));
- if(!TextUtils.isEmpty(((CharSequence)arg7))) {
- v2.append("&");
- v2.append(arg7);
- }
- long v5 = System.currentTimeMillis() / 1000;
- v2.append("&");
- v2.append(v5);
- return new Pair(HMACHash1.a(v0, v2.toString()), String.valueOf(v5));
- }
- ------------------------------------------------------------------------------------------------------------------
- public class HMACHash1 {
- public static final String a(String arg2, String arg3) {
- try {
- SecretKeySpec v0 = new SecretKeySpec(arg2.getBytes(), "HmacSHA1");
- Mac v2_1 = Mac.getInstance("HmacSHA1");
- v2_1.init(((Key)v0));
- return Base64.encodeToString(v2_1.doFinal(arg3.getBytes()), 2);
- }
- catch(Exception v2) {
- v2.printStackTrace();
- return null;
- }
- }
- }
复制代码
第四步 算法总结
_sign = HmacSHA1(v1 ,v2);
其中 v1 = "9e8bb54dc3288cdf"; (key)
v2 = "POST&%2Fservice%2Fauth2%2Ftoken&" + 取现行10位时间戳();
--------------------------------------------------------------
附录一组原始数据
v1 = "9e8bb54dc3288cdf"
v1 = "POST&%2Fservice%2Fauth2%2Ftoken&1535823848"
sign = "bX22/PeX4rpTUGNrlyH3EN2CXZU="
第五步 算法移植
见附件哈
算法js.rar
(3.02 KB, 下载次数: 148)
|
评分
-
查看全部评分
|