2015年5月2日 星期六

《星光少女》iOS 版本運作


大女愛上《星光少女》,知道出了 iOS 版遊戲,當然第一時間下載。爸爸當然變成她的練功工具。除了為她的角色儲經驗值、一首一首歌解鎖之外,我也順道了解一下它的運作。

跟很多的遊戲一樣,《星光少女》不連上網是無法進行。我好奇連線時有甚麼的東西在處理,於是拿《Charles》記錄當中的通訊。發現開始時會通知服務器進行 login 步驟;在開始遊戲前會通知服務器進行 ingamefriend 步驟;在開始遊戲時是 startgame;在遊戲完結時是 endgame。這樣做能有效監管遊戲的運作,減少玩家出千的機會。還有其他個別情況的 getgifts、receivegifts、petequip、cardevolve...等。它們的內容都是相同的結構。一個資料及一個驗證碼:
{"data":"eyJzdGFydGdhbWUiOnsic3RhdHVzIjoxLCJnYW1ldWlkIjoiNTU
0MzkzNmFmODAxNDI0ZTdkOGI0Yzk3Iiwic3luYyI6MC4wMiwic3BlY2lhbG5
vdGUiOnsiZHJvcFJhdGUiOjQsIm1heCI6NSwiZXZlbnRpZCI6IkVWRU5UXzI
    ::    ::    ::    ::    ::    ::    ::    ::    ::
uZXRcL1BUUlwvYXNzZXRcL3VwZGF0ZVwvIn0sIm5ld0NhcmRzIjpbIjhfNl8
yIiwiOV82XzIiLCIxMF82XzIiLCI4XzdfMSIsIjlfN18xIiwiMTBfN18xIl0
sIm5vdGljZSI6bnVsbCwiYXR0ZW5kIjpudWxsfX0=","chkSum":"03e4f99
f1802300824f0b6ed97465685"}
很多時這類資料都以 Base64 來加密,所以我嘗試利用 https://www.base64decode.org/ 來解密:
{
    "startgame":{
        "status":1,
        "gameuid":"5543936af801424e7d8b4c97",
        "sync":0.02,
        "specialnote":{
            "dropRate":4,
            "max":5,
            "eventid":"EVENT_20150425",
            "boost":1
        },
        "status_desc":null
    },
    "init":{
        "profile":{
            "comment":"\u3088\u308d\u3057\u304f\u306d\u266a",
            "nick":"Sita",
            "rank":11,
            "card":{
                "level":4,
                "card_id":"1_2_1",
                "pet_id":null,
                "playCnt":0,
                "att_score":{
                    "1ST":{
                        "LOVELY":2610
                    },
                    "2ND":{
                        "ETHNIC":1507
                    },
                    "3RD":{
                        "COOL":1200
                    }
                },
                "transcendance":0
            },
            "lastPlayTS":1430488784,
            "lastPlayDate":"2015-05-01 22:59:44",
            "collections":{
                "1":1
            },
            "playCnt":17
        },
        "account":{
            "email":"sita@chan.com",
            "sso":true
        },
        "stamina":{
            "max":35,
            "current":29,
            "nextUpdateDate":1430492370,
            "lastUpdateDate":1430492010,
            "maxDate":1430494170
        },
        "deck":{
            "cardDeck":{
                "current":6,
                "max":40
            },
            "petDeck":{
                "current":11,
                "max":20
            },
            "friendDeck":{
                "current":0,
                "max":13
            }
        },
        "nickTag":1006,
        "booster":{
            "booster":null,
            "expiredTS":null
        },
        "stage":{
            "cleared":[
                "PTR001",
                "PTR002",
                "PTR004",
                "PTR003",
                "PTR007",
                "PTR005",
                "PTR008",
                "PTR006",
                "PTR009",
                "PTR010",
                "PTR011",
                "PTR012"
            ],
            "paid":[
                "PTR151",
                "PTR152",
                "PTR153",
                "PTR130",
                "PTR131",
                "PTR132"
            ]
        },
        "stat":{
            "level":11,
            "exp":1995,
            "tutorial":-1,
            "life":12
        },
        "specialNote":{
            "eventItem":71,
            "eventPoint":0,
            "nextRewardPoint":10
        },
        "main_unit":"1ST",
        "unit":{
            "1ST":{
                "name":"\u30e6\u30cb\u30c3\u30c81",
                "card_uid_list":{
                    "1ST":"55436498f9014219598b4bb0",
                    "2ND":null,
                    "3RD":null
                }
            },
            "2ND":{
                "name":"\u30e6\u30cb\u30c3\u30c82",
                "card_uid_list":{
                    "1ST":null,
                    "2ND":null,
                    "3RD":null
                }
            },
            "3RD":{
                "name":"\u30e6\u30cb\u30c3\u30c83",
                "card_uid_list":{
                    "1ST":null,
                    "2ND":null,
                    "3RD":null
                }
            }
        },
        "purchased_music":[
            "PAID_SONG_10",
            "PAID_SONG_3"
        ],
        "addedDeck":{
            "cardDeck":0,
            "petDeck":0,
            "friendDeck":0
        },
        "goods":{
            "friend_point":705,
            "booster":{
                "Stone_Boost_1":0,
                "Stone_Boost_2":0,
                "Coin_Boost_1":0,
                "Coin_Boost_2":0,
                "CardExp_Boost_1":2,
                "CardExp_Boost_2":0,
                "UserExp_Boost_1":1,
                "UserExp_Boost_2":0,
                "Allinone_1":0,
                "Allinone_2":0
            },
            "coin":16609,
            "gem":5,
            "bonus":0,
            "stone":{
                "LOVELY":{
                    "SMALL":17,
                    "MEDIUM":2,
                    "LARGE":0
                },
                "POP":{
                    "SMALL":30,
                    "MEDIUM":0,
                    "LARGE":0
                },
                "COOL":{
                    "SMALL":6,
                    "MEDIUM":0,
                    "LARGE":0
                },
                "FEMININ":{
                    "SMALL":16,
                    "MEDIUM":0,
                    "LARGE":0
                },
                "ETHNIC":{
                    "SMALL":16,
                    "MEDIUM":0,
                    "LARGE":0
                },
                "SEXY":{
                    "SMALL":16,
                    "MEDIUM":0,
                    "LARGE":0
                },
                "STAR":{
                    "SMALL":0,
                    "MEDIUM":0,
                    "LARGE":0
                }
            },
            "ticket":{
                "normal":0,
                "pr":0,
                "sr":0
            }
        },
        "cnt":{
            "feedback":0,
            "gift":0,
            "message":0,
            "friend":{
                "cnt":0,
                "req":1
            }
        },
        "serverTS":1430492010,
        "resourceVer":{
            "resource":{
                "type":"resource",
                "ios":{
                    "card":[
                        {
                            "url":"1426094173\/card\/ios\/card_aira.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_ann.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_bell.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_ito.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_mion.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_naru.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1429558702\/card\/ios\/card_others.assetBundle",
                            "ver":4,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_otoha.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_rinne.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_rizumu.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/card\/ios\/card_wakana.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426690286\/card\/ios\/card_update_1.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426758995\/card\/ios\/card_update_2.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1427901046\/card\/ios\/update_0401.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1429558702\/card\/ios\/card_others_2.assetBundle",
                            "ver":2,
                            "t":false
                        },
                        {
                            "url":"1428567871\/card\/ios\/update_0407.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1429170877\/card\/ios\/update_0415.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1429558702\/card\/ios\/update_0420.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1429558702\/card\/ios\/card_others_3.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1430380704\/card\/ios\/update_0429.assetBundle",
                            "ver":1,
                            "t":false
                        }
                    ],
                    "cutscene":[
                        {
                            "url":"1428583242\/cutscene\/ios\/cutscene.assetBundle",
                            "ver":3,
                            "t":true
                        }
                    ],
                    "gamemode":[
                        {
                            "url":"1429869929\/gamemode\/ios\/gamemode.assetBundle",
                            "ver":8,
                            "t":true
                        },
                        {
                            "url":"1426910745\/gamemode\/ios\/particle.assetBundle",
                            "ver":4,
                            "t":true
                        }
                    ],
                    "pet":[
                        {
                            "url":"1426094173\/pet\/ios\/pets.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/pet\/ios\/pets_aurora.assetBundle",
                            "ver":1,
                            "t":false
                        }
                    ],
                    "song":[
                        {
                            "url":"1426094173\/song\/ios\/track_0.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/song\/ios\/track_120.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/song\/ios\/track_150.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/song\/ios\/track_30.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/song\/ios\/track_60.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/song\/ios\/track_90.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1426094173\/song\/ios\/track_others.assetBundle",
                            "ver":1,
                            "t":false
                        },
                        {
                            "url":"1427460413\/song\/ios\/update_0327.assetBundle",
                            "ver":1,
                            "t":false
                        }
                    ],
                    "uniteff":[
                        {
                            "url":"1426094173\/uniteff\/ios\/unit_1.assetBundle",
                            "ver":1,
                            "t":true
                        },
                        {
                            "url":"1426094173\/uniteff\/ios\/unit_2.assetBundle",
                            "ver":1,
                            "t":true
                        },
                        {
                            "url":"1426094173\/uniteff\/ios\/unit_3.assetBundle",
                            "ver":1,
                            "t":true
                        },
                        {
                            "url":"1426094173\/uniteff\/ios\/unit_4.assetBundle",
                            "ver":1,
                            "t":true
                        },
                        {
                            "url":"1426094173\/uniteff\/ios\/unit_5.assetBundle",
                            "ver":1,
                            "t":true
                        },
                        {
                            "url":"1426909951\/uniteff\/ios\/unit_6.assetBundle",
                            "ver":2,
                            "t":true
                        },
                        {
                            "url":"1427901046\/uniteff\/ios\/unit_7.assetBundle",
                            "ver":1,
                            "t":true
                        },
                        {
                            "url":"1427985659\/uniteff\/ios\/card_unit_1.assetBundle",
                            "ver":1,
                            "t":true
                        }
                    ]
                }
            },
            "app_url":{
                "os":{
                    "android":"https:\/\/play.google.com\/store\/apps\/details?id=com.dooub.ptrshake",
                    "ios":"https:\/\/itunes.apple.com\/jp\/app\/id956716079"
                },
                "type":"app_url"
            },
            "version":{
                "os":{
                    "android":"1.2.0",
                    "ios":"1.1.16"
                },
                "type":"version"
            },
            "resource_version":{
                "type":"resource_version",
                "ios":{
                    "song":415,
                    "pet":52,
                    "card":45
                },
                "android":{
                    "song":414,
                    "pet":52,
                    "card":45
                }
            },
            "event":null,
            "coupon_off":{
                "type":"coupon_off",
                "ver":"1.1.20"
            },
            "notice_version":{
                "type":"notice_version",
                "ios":42,
                "android":41,
                "andorid":4
            },
            "special_note":{
                "eventid":"EVENT_20150425",
                "startTS":1429948800,
                "endTS":1431183599,
                "banner":"banner\/pl_event_banner_b20150424_final.png",
                "banner_link":"http:\/\/admin.ptrshake.gooub.com\/web\/eventInfo.do",
                "banner_s":"banner\/pl_event_banner_s20150424_final.png",
                "schedule":null,
                "note_img":"banner\/img_sn_icon_style.png",
                "eventpoint_img":"banner\/img_sn_text_style.png",
                "viewTS":1431356399
            },
            "cdn":"http:\/\/dzrdvwk3byl4f.cloudfront.net\/PTR\/",
            "asset_cdn":"http:\/\/dzrdvwk3byl4f.cloudfront.net\/PTR\/asset\/update\/"
        },
        "newCards":[
            "8_6_2",
            "9_6_2",
            "10_6_2",
            "8_7_1",
            "9_7_1",
            "10_7_1"
        ],
        "notice":null,
        "attend":null
    }
}
成功解開非常詳細的內容。至於後方的驗證碼,是用來確保前方資料沒有被改動過。分別試過將前方數值加起來,及把後方數值以 Base64 解碼,都無法找到驗證碼的運算方式。要是能解開的話,相信能利用 MITMProxy 及 Python 進行即時內容修改。

沒有留言: