首页
社区
课程
招聘
[旧帖] [讨论]Symbian S60 3rd 经典"孤岛悲歌"中文版游戏 IDA5.2 未完成的分析 0.00雪花
发表于: 2008-9-14 16:46 5736

[旧帖] [讨论]Symbian S60 3rd 经典"孤岛悲歌"中文版游戏 IDA5.2 未完成的分析 0.00雪花

2008-9-14 16:46
5736
【讨论】Symbian S60 3rd 经典"孤岛悲歌"中文版游戏 IDA5.2 未完成的分析

因为小弟在看雪学到很多,这次是首次发帖。希望大家支持^_^

此次选择"孤岛悲歌"游戏,因为自己喜欢,而且有很多人喜欢,但无奈只能买正版,而且苦等几月,也不见破解版本或注册机出现.也不知是国内高手看不上这个软件还是有其它原因. 苦苦等待未果,只能从学习开始试图找到算法.

分析内容:静态分析 Symbian S60 3rd 软件
软件名称:"孤岛悲歌"中文版 文件名:LI_3RD_CN.rar
分析时间:2008.8-2008.9
工具:WinRAR_3.71 ; SISWare_4.7 ; IDA_5.2 ; S60_V3手机一台

可能软件中对抓图软件有屏蔽,无法进行抓图,只能进行注册界面介绍:
1 - 进入主菜单后,一个动态背景,猜测是一个GIF动画,画面中间依次向下有

┌────────────────┐
│                                │
│                                │
│           [新的开始]           │
│                                │
│           [读取存档]           │
│                                │
│           [游戏设置]           │
│                                │
│           [游戏帮助]           │
│                                │
│           [开发团队]           │
│                                │
│           [正版激活]           │
│                                │
│           [访问官网]           │
│                                │
│           [退出游戏]           │
│                                │
│                                │
│                                │
└────────────────┘

2 - 进入[正版激活]界面,出现一个黄色背景,输入8位数字后,自动进行激活校验。

┌────────────────┐
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│      请输入8位数字激活码,     │
│      激活所有游戏场景。        │
│                                │
│      ┌────────┐      │
│      │                │      │
│      └────────┘      │
│                                │
│    重输               取消     │
│                                │
│                                │
│                                │
│                                │
└────────────────┘

2.1 - 当输入错误,出现一个黄色背景,提示输入错误。

┌────────────────┐
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│ 注册码输入错误,请核对后重新输 │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                          返回  │
│                                │
└────────────────┘

2.2 - 当输入正确,出现一个黄色背景,提示激活成功。

┌────────────────┐
│                                │
│                                │
│                                │
│           激活成功!           │
│                                │
│    所有游戏场景激活!          │
│    祝您游戏愉快!              │
│    感谢您购买"移动梦工厂"的    │
│    游戏!欢迎访问我们的网站:  │
│                                │
│                                │
│    http://www.simlife.com      │
│                                │
│                                │
│                                │
│                                │
│                                │
│                                │
│                          返回  │
│                                │
└────────────────┘

过程:
1 - 使用 WinRAR_3.71 将 LI_3RD_CN.rar 解压
       分解为: island.sis文件 和 simlife目录

simlife目录
├─script
│  ├─1
│  ├─10
│  ├─11
│  ├─12
│  ├─13
│  ├─14
│  ├─15
│  ├─16
│  ├─17
│  ├─18
│  ├─2
│  ├─3
│  ├─4
│  ├─5
│  ├─6
│  ├─7
│  ├─8
│  └─9
├─sd2
├─sound
├─texture
│  ├─change
│  ├─help
│  ├─interf
│  ├─load
│  ├─map
│  ├─player
│  ├─scene
│  ├─sd2
│  └─ui
├─uisd2
└─video
    ├─176x208
    └─240x320

2 - 使用 SISWare_4.7 将 island.sis文件 解压

island.sis文件
├─private
│  └─10003a3f
│      └─import
│          └─apps
├─resource
│  └─apps
├─sys
│  └─bin
│          IsLand_3rd.exe           <-主要文件
│          SimDeviceEngineDll.dll   <-主要文件
│          SimMediaEngineDll.dll    <-主要文件
└─system
    └─apps
        └─island
            └─loadsave
                    .
                    .
                 此处省略
                    .
                    .
                    tmp.id    <-注册保存文件

3 - 因为购买了注册号,所以经过对比注册前后的所有文件,发现仅有tmp.id文件被修改,而且将注册前的tmp.id替换掉注册后的tmp.id,软件重新提示未注册。

    此过程发现 tmp.id 中除保存注册信息外,应该另外保存有其它信息,若软件删除该文件,软件不会自动重建,将发生错误退出。

        tmp.id 共有3种文件内容:
           1. 首次安装的初始tmp.id文件内容,共 22 字节:  (*文件原始内容,肯定与IMSI号码无关*)
               seg000:00000000  EA 00 9D A0 40 F3 1A 49  CF 6E 73 BF 40 F8 76 BF
               seg000:00000010  00 00 C9 9B EF 61

           2. 软件启动一次后的tmp.id文件内容,共 25 字节:(*估计内容与IMSI号码有关,不同机器将出现不同的文件内容*)
               seg000:00000000  E7 00 9D A0 40 F2 E8 7F  88 82 E5 DD 27 E8 5C 21
               seg000:00000010  F8 76 BF 94 00 C9 37 EF  5E

           3. 软件注册后的tmp.id文件内容,共 33 字节:    (*内容肯定与IMSI号码有关*)
               seg000:00000000  DF 00 4D CC 50 D0 CF CC  D0 CB 9F C0 FE 84 B0 86
               seg000:00000010  82 E5 DD 27 68 EF 58 21  F8 76 BF 94 00 21 F1 ED
               seg000:00000020  B2

4 - 开始分析 3 个主要文件:

4.1 - 首先根据 IMEI 进行分析
    (*参考网上对 S60_3rd 系统帖子,为了获得 IMEI 需要调用 CTelephony::GetSubscriberId() / CTelephony::GetPhoneId() / CTelephony::Version() /  CTelephony::TPhoneIdV1() 等函数*)

    所以我们需要在 3 个主要文件里寻找这些函数.

    使用 IDA_5.2 依次分析, 发现在 SimMediaEngineDll.dll 中包含有 CTelephony::GetPhoneId() 和 CTelephony::TPhoneIdV1() 函数.

.idata:00032FF0 ; ===========================================================================
.idata:00032FF0
.idata:00032FF0 ; Segment type: Externs
.idata:00032FF0                 IMPORT __imp_pow        ; CODE XREF: powj
.idata:00032FF0                                         ; DATA XREF: .text:off_24CD4o
.idata:00032FF4                 IMPORT __imp_fopen      ; CODE XREF: fopenj
.idata:00032FF4                                         ; DATA XREF: .text:off_24D34o
.idata:00032FF8                 IMPORT __imp_fwrite     ; CODE XREF: fwritej
.idata:00032FF8                                         ; DATA XREF: .text:off_24D4Co
.idata:00032FFC                 IMPORT __imp_fclose     ; CODE XREF: fclosej
.idata:00032FFC                                         ; DATA XREF: .text:off_24DE4o
.idata:00033000                 IMPORT __imp_strlen     ; CODE XREF: strlenj
.idata:00033000                                         ; DATA XREF: .text:off_24F54o
.idata:00033004                 IMPORT __imp_malloc     ; CODE XREF: mallocj
.idata:00033004                                         ; DATA XREF: .text:off_24FA4o
.idata:00033008                 IMPORT __imp_free       ; CODE XREF: freej
.idata:00033008                                         ; DATA XREF: .text:off_25004o
.idata:0003300C                 IMPORT __imp_sprintf    ; CODE XREF: sprintfj
.idata:0003300C                                         ; DATA XREF: .text:off_2501Co
.idata:00033010                 IMPORT __imp_uncompress ; CODE XREF: uncompressj
.idata:00033010                                         ; DATA XREF: .text:off_24F74o
.idata:00033014 ; __declspec(dllimport) CTelephony::CancelAsync(CTelephony::TCancellationRequest)const
.idata:00033014                 IMPORT __imp__ZNK10CTelephony11CancelAsyncENS_20TCancellationRequestE
.idata:00033014                                         ; CODE XREF: CTelephony::CancelAsync(CTelephony::TCancellationRequest)j
.idata:00033014                                         ; DATA XREF: .text:off_24DB4o
.idata:00033018 ; __declspec(dllimport) CTelephony::GetPhoneId(TRequestStatus &, TDes8 &)const
.idata:00033018                 IMPORT __imp__ZNK10CTelephony10GetPhoneIdER14TRequestStatusR5TDes8
.idata:00033018                                         ; CODE XREF: CTelephony::GetPhoneId(TRequestStatus &,TDes8 &)j    〈-这里第 11 个函数,CTelephony::GetPhoneId()
.idata:00033018                                         ; DATA XREF: .text:off_24E24o
.idata:0003301C ; __declspec(dllimport) CTelephony::TPhoneIdV1::TPhoneIdV1(void)
.idata:0003301C                 IMPORT __imp__ZN10CTelephony10TPhoneIdV1C1Ev
.idata:0003301C                                         ; CODE XREF: CTelephony::TPhoneIdV1::TPhoneIdV1(void)j    〈-这里第 12 个函数,CTelephony::TPhoneIdV1()
.idata:0003301C                                         ; DATA XREF: .text:off_24F0Co
.idata:00033020 ; __declspec(dllimport) CTelephony::NewL(void)
.idata:00033020                 IMPORT __imp__ZN10CTelephony4NewLEv
.idata:00033020                                         ; CODE XREF: CTelephony::NewL(void)j
.idata:00033020                                         ; DATA XREF: .text:off_2502Co

    如果是动态调用的话,就需要找到 RLibrary::Lookup(int) 函数,(int)表示的函数序号。

    使用 IDA_5.2 分析 IsLand_3rd.exe,找到 2 处 RLibrary::Lookup(int) 函数,在子函数 sub_3E3A8 和 sub_5C338 中。

    追踪 sub_3E3A8 和 sub_5C338 子函数,发现调用很单一:

┌────────────────────┐
│.text:00059B44       BL     sub_59204 ; │
└────────────────────┘
                    │
                    │
                    ↓
                 sub_59204
                    │
                    │
                    ↓
                 sub_5AEF0
                  │  │
              ┌─┘  └─┐
              │          ↓
              │      sub_5C338    <-存在 Lookup(int) 函数
              │
              │
              ↓
          sub_6AA30
              │
              │
              ↓
          sub_3E3A8    <-存在 Lookup(int) 函数

    追踪.text:00059B44 附近代码:

....省略内容
.text:00059B04                 SUBS    R3, R0, #0
.text:00059B08                 STREQ   R3, [R11,#-0x23C]
.text:00059B0C                 BEQ     loc_59C64
.text:00059B10                 MOV     R3, #1
.text:00059B14                 STR     R3, [R11,#-0x23C]
.text:00059B18                 BL      hal_1
.text:00059B1C                 LDR     R3, [R11,#-0x23C]
.text:00059B20                 CMP     R3, #0
.text:00059B24                 BEQ     loc_59C64
.text:00059B28                 MOV     R2, #1
.text:00059B2C                 STR     R2, [R6,#0x228]
.text:00059B30                 MOV     R3, #0
.text:00059B34                 STR     R3, [R11,#-0x23C]
.text:00059B38                 BL      _ZN4User16MarkCleanupStackEv ; User::MarkCleanupStack(void)
.text:00059B3C                 MOV     R4, R0
.text:00059B40                 MOV     R0, R6
.text:00059B44                 BL      sub_59204       <-此处调用sub_59204函数
.text:00059B48 ; ---------------------------------------------------------------------------
.text:00059B48                 MOV     R0, R4
.text:00059B4C                 BL      _ZN4User18UnMarkCleanupStackEP12TTrapHandler ; User::UnMarkCleanupStack(TTrapHandler *)
.text:00059B50
.text:00059B50 loc_59B50                               ; CODE XREF: .text:00059CBCj
.text:00059B50                                         ; .text:00059CF0j
.text:00059B50                 LDR     R0, [R11,#-0x23C]
.text:00059B54                 CMP     R0, #0
.text:00059B58                 BNE     loc_59C9C
.text:00059B5C                 LDR     R1, [R6,#0x22C]
....省略内容

     将 sub_59204 / sub_5AEF0 / sub_6AA30 / sub_3E3A8 / sub_5C338 函数内容附上:

.text:00059204 ; =============== S U B R O U T I N E =======================================
.text:00059204
.text:00059204 ; Attributes: noreturn bp-based frame
.text:00059204
.text:00059204 sub_59204                               ; CODE XREF: .text:00059B44p
.text:00059204
.text:00059204 var_24          = -0x24
.text:00059204 var_20          = -0x20
.text:00059204 oldR4           = -0x18
.text:00059204 oldR5           = -0x14
.text:00059204 oldR6           = -0x10
.text:00059204 oldR11          = -0xC
.text:00059204 oldSP           = -8
.text:00059204 oldLR           = -4
.text:00059204
.text:00059204                 MOV     R12, SP
.text:00059208                 STMFD   SP!, {R4-R6,R11,R12,LR,PC}
.text:0005920C                 SUB     R11, R12, #4
.text:00059210                 MOV     R5, R0
.text:00059214                 MOV     R0, #0x18
.text:00059218                 SUB     R6, R11, #0x2C
.text:0005921C                 SUB     SP, SP, #0x14
.text:00059220                 BL      _ZN4User7AllocZLEi ; User::AllocZL(int)
.text:00059224                 MOV     R4, R0
.text:00059228                 BL      __aeabi_fcmpge
.text:0005922C                 MOV     R0, R4
.text:00059230                 STR     R4, [R5,#0x108]
.text:00059234                 BL      _ZN10CFbsBitmap5ResetEv ; CFbsBitmap::Reset(void)
.text:00059238                 MOV     R2, #7
.text:0005923C                 ADD     R1, R5, #0x180
.text:00059240                 LDR     R0, [R5,#0x108]
.text:00059244                 BL      _ZN10CFbsBitmap6CreateERK5TSize12TDisplayMode ; CFbsBitmap::Create(TSize  const&,TDisplayMode)
.text:00059248                 LDR     R3, [R5,#0x240]
.text:0005924C                 MOV     R2, #0
.text:00059250                 CMP     R3, #1
.text:00059254                 MOV     R0, #0x18
.text:00059258                 STR     R2, [R5,#0x14C]
.text:0005925C                 BGT     loc_592E8
.text:00059260
.text:00059260 loc_59260                               ; CODE XREF: sub_59204+128j
.text:00059260                 MOV     R0, #0x28
.text:00059264                 BL      _ZN4User6AllocLEi ; User::AllocL(int)
.text:00059268                 LDR     R1, [R5,#0x108]
.text:0005926C                 MOV     R4, R0
.text:00059270                 BL      CONE_56_0
.text:00059274                 ADD     R0, R5, #0x10C
.text:00059278                 MOV     R1, #5
.text:0005927C                 STR     R4, [R5,#0x140]
.text:00059280                 BL      _ZN9TRawEvent3SetENS_5TTypeE ; TRawEvent::Set(TRawEvent::TType)
.text:00059284                 LDR     R2, [R5,#0x104]
.text:00059288                 MOV     R3, R5
.text:0005928C                 ADD     R1, R5, #8
.text:00059290                 LDR     R0, [R5,#0x108]
.text:00059294                 BL      sub_5AEF0       <-此处调用sub_5AEF0函数
.text:00059298 ; ---------------------------------------------------------------------------
.text:00059298                 MOV     R3, #1
.text:0005929C                 MOV     R12, R0
.text:000592A0                 STR     R3, [R0,#0xC]
.text:000592A4                 LDR     R1, =(aNoEnoughMemo_0+0x40) ; 内存不足提示
.text:000592A8                 MOV     R0, R6
.text:000592AC                 STRB    R3, [R12,#0x808]
.text:000592B0                 STR     R3, [R5,#0x148]
.text:000592B4                 STR     R12, [R5,#0x200]
.text:000592B8                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:000592BC                 LDR     R1, [R5,#0x144]
.text:000592C0                 MOV     R2, #0xFF000000
.text:000592C4                 MOV     R0, R6
.text:000592C8                 BL      _ZN12RHTTPSession5OpenLEv ; RHTTPSession::OpenL(void)
.text:000592CC                 LDR     R3, [R5,#0x200]
.text:000592D0                 STR     R0, [R5,#0x220]
.text:000592D4                 LDR     R0, [R3,#0x12C]
.text:000592D8                 BL      sub_6BB6C
.text:000592DC ; ---------------------------------------------------------------------------
.text:000592DC                 STR     R0, [R5,#0x138]
.text:000592E0                 SUB     SP, R11, #0x18
.text:000592E4                 LDMFD   SP, {R4-R6,R11,SP,PC}
.text:000592E8 ; ---------------------------------------------------------------------------
.text:000592E8
.text:000592E8 loc_592E8                               ; CODE XREF: sub_59204+58j
.text:000592E8                 BL      _ZN4User7AllocZLEi ; User::AllocZL(int)
.text:000592EC                 MOV     R4, R0
.text:000592F0                 BL      __aeabi_fcmpge
.text:000592F4                 MOV     R0, R4
.text:000592F8                 STR     R4, [R5,#0x14C]
.text:000592FC                 BL      _ZN10CFbsBitmap5ResetEv ; CFbsBitmap::Reset(void)
.text:00059300                 LDR     R2, [R5,#0x240]
.text:00059304                 ADD     R1, R5, #0x180
.text:00059308                 LDMIA   R1, {R1,R3}
.text:0005930C                 MUL     R12, R2, R1
.text:00059310                 MUL     R4, R2, R3
.text:00059314                 SUB     R1, R11, #0x24
.text:00059318                 MOV     R2, #7
.text:0005931C                 LDR     R0, [R5,#0x14C]
.text:00059320                 STR     R12, [R11,#var_24]
.text:00059324                 STR     R4, [R11,#var_20]
.text:00059328                 BL      _ZN10CFbsBitmap6CreateERK5TSize12TDisplayMode ; CFbsBitmap::Create(TSize  const&,TDisplayMode)
.text:0005932C                 B       loc_59260
.text:0005932C ; End of function sub_59204

.text:0005AEF0 ; =============== S U B R O U T I N E =======================================
.text:0005AEF0
.text:0005AEF0 ; Attributes: noreturn bp-based frame
.text:0005AEF0
.text:0005AEF0 sub_5AEF0                               ; CODE XREF: sub_59204+90p
.text:0005AEF0
.text:0005AEF0 var_30          = -0x30
.text:0005AEF0 oldR5           = -0x20
.text:0005AEF0 oldR6           = -0x1C
.text:0005AEF0 oldR7           = -0x18
.text:0005AEF0 oldR8           = -0x14
.text:0005AEF0 oldR9           = -0x10
.text:0005AEF0 oldR11          = -0xC
.text:0005AEF0 oldSP           = -8
.text:0005AEF0 oldLR           = -4
.text:0005AEF0
.text:0005AEF0                 MOV     R12, SP
.text:0005AEF4                 STMFD   SP!, {R5-R9,R11,R12,LR,PC}
.text:0005AEF8                 SUB     R11, R12, #4
.text:0005AEFC                 MOV     R9, R0
.text:0005AF00                 MOVL    R0, 0x3A48
.text:0005AF08                 MOV     R6, R1
.text:0005AF0C                 MOV     R7, R2
.text:0005AF10                 MOV     R8, R3
.text:0005AF14                 SUB     SP, SP, #0xC
.text:0005AF18                 BL      _ZN4User7AllocZLEi ; User::AllocZL(int)
.text:0005AF1C                 MOV     R1, R9
.text:0005AF20                 MOV     R5, R0
.text:0005AF24                 MOV     R2, R6
.text:0005AF28                 MOV     R3, R7
.text:0005AF2C                 STR     R8, [SP,#0x30+var_30]
.text:0005AF30                 BL      sub_5B280
.text:0005AF34 ; ---------------------------------------------------------------------------
.text:0005AF34                 MOV     R0, R5
.text:0005AF38                 BL      _ZN12CleanupStack5PushLEP5CBase ; CleanupStack::PushL(CBase *)
.text:0005AF3C                 MOV     R0, R5
.text:0005AF40                 BL      sub_5BFC4
.text:0005AF44 ; ---------------------------------------------------------------------------
.text:0005AF44                 MOV     R0, R5
.text:0005AF48                 BL      sub_5C338       <-此处调用sub_5C338函数
.text:0005AF4C                 MOV     R0, R5
.text:0005AF50                 BL      sub_5C540
.text:0005AF54 ; ---------------------------------------------------------------------------
.text:0005AF54                 MOV     R0, R5
.text:0005AF58                 BL      sub_6AA30       <-此处调用sub_6AA30函数
.text:0005AF5C ; ---------------------------------------------------------------------------
.text:0005AF5C                 BL      _ZN12CleanupStack3PopEv ; CleanupStack::Pop(void)
.text:0005AF60                 MOV     R0, R5
.text:0005AF64                 SUB     SP, R11, #0x20
.text:0005AF68                 LDMFD   SP, {R5-R9,R11,SP,PC}
.text:0005AF68 ; End of function sub_5AEF0

.text:0006AA30 ; =============== S U B R O U T I N E =======================================
.text:0006AA30
.text:0006AA30 ; Attributes: noreturn bp-based frame
.text:0006AA30
.text:0006AA30 sub_6AA30                               ; CODE XREF: sub_5AEF0+68p
.text:0006AA30
.text:0006AA30 oldR4           = -0x18
.text:0006AA30 oldR5           = -0x14
.text:0006AA30 oldR6           = -0x10
.text:0006AA30 oldR11          = -0xC
.text:0006AA30 oldSP           = -8
.text:0006AA30 oldLR           = -4
.text:0006AA30
.text:0006AA30                 MOV     R12, SP
.text:0006AA34                 STMFD   SP!, {R4-R6,R11,R12,LR,PC}
.text:0006AA38                 SUB     R11, R12, #4
.text:0006AA3C                 MOV     R5, R0
.text:0006AA40                 MOV     R0, #0x600
.text:0006AA44                 MOVL    R6, 0x1D0C
.text:0006AA4C                 SUB     SP, SP, #4
.text:0006AA50                 BL      _ZN4User6AllocLEi ; User::AllocL(int)
.text:0006AA54                 MOV     R4, R0
.text:0006AA58                 BL      sub_2BC78
.text:0006AA5C ; ---------------------------------------------------------------------------
.text:0006AA5C                 LDR     R3, [R5,#0x14]
.text:0006AA60                 LDR     R12, [R5,#0x128]
.text:0006AA64                 LDR     R2, [R5,#0x2A0]
.text:0006AA68                 LDR     R1, [R5,#0x124]
.text:0006AA6C                 LDR     LR, [R5,#0x134]
.text:0006AA70                 STR     R3, [R4,#0x18]
.text:0006AA74                 MOV     R0, R4
.text:0006AA78                 STR     R12, [R4,#0x44]
.text:0006AA7C                 STR     R2, [R4,#0x1C]
.text:0006AA80                 STR     R1, [R4,#0x40]
.text:0006AA84                 STR     LR, [R4,#0x3C]
.text:0006AA88                 STR     R4, [R5,R6]
.text:0006AA8C                 STR     R5, [R4,#0x38]
.text:0006AA90                 BL      sub_3E3A8       <-此处调用sub_3E3A8函数,对动态链接库进行操作
.text:0006AA94 ; ---------------------------------------------------------------------------
.text:0006AA94                 LDR     R0, [R5,R6]
.text:0006AA98                 BL      sub_3E580
.text:0006AA9C ; ---------------------------------------------------------------------------
.text:0006AA9C                 LDR     R0, [R5,R6]
.text:0006AAA0                 BL      sub_3E900
.text:0006AAA4 ; ---------------------------------------------------------------------------
.text:0006AAA4                 LDR     R0, [R5,R6]
.text:0006AAA8                 BL      sub_3EA90
.text:0006AAAC ; ---------------------------------------------------------------------------
.text:0006AAAC                 LDR     R0, [R5,R6]
.text:0006AAB0                 BL      sub_3EFD8
.text:0006AAB4 ; ---------------------------------------------------------------------------
.text:0006AAB4                 ADD     R1, R5, #0x1D40
.text:0006AAB8                 ADD     R1, R1, #0x38
.text:0006AABC                 LDR     R0, [R5,#0x124]
.text:0006AAC0                 BL      sub_6E2BC       ; 调用了操作文件函数,操作了tmd.id
.text:0006AAC4                 MOVL    R3, 0x1DDC
.text:0006AACC                 LDR     R12, [R5,R3]
.text:0006AAD0                 CMP     R12, #0
.text:0006AAD4                 BNE     loc_6AAFC
.text:0006AAD8                 LDR     R1, [R5,R6]
.text:0006AADC                 LDR     R2, [R1,#0x594]
.text:0006AAE0                 MOV     R3, #1
.text:0006AAE4                 LDR     R0, [R2,#0x1C]
.text:0006AAE8                 STRB    R3, [R1,#0x1DC]
.text:0006AAEC                 SUB     R3, R3, #4
.text:0006AAF0                 STR     R12, [R0,#0x220]
.text:0006AAF4                 STR     R3, [R0,#0x214]
.text:0006AAF8                 LDMED   SP, {R4-R6,R11,SP,PC}
.text:0006AAFC ; ---------------------------------------------------------------------------
.text:0006AAFC
.text:0006AAFC loc_6AAFC                               ; CODE XREF: sub_6AA30+A4j
.text:0006AAFC                 LDR     R2, [R5,R6]
.text:0006AB00                 LDR     R3, [R2,#0x594]
.text:0006AB04                 LDR     R1, [R3,#0x1C]
.text:0006AB08                 MOVL    R3, 0xFFFFFFFE
.text:0006AB0C                 STR     R3, [R1,#0x214]
.text:0006AB10                 ADD     R3, R3, #3
.text:0006AB14                 MOV     R0, R2
.text:0006AB18                 LDR     R1, [R2,#0x2C]
.text:0006AB1C                 STRB    R3, [R2,#0x1DC]
.text:0006AB20                 BL      sub_3F014
.text:0006AB24 ; ---------------------------------------------------------------------------
.text:0006AB24                 LDR     R2, [R5,R6]
.text:0006AB28                 MOV     R3, #0
.text:0006AB2C                 STR     R3, [R2,#0x2C]
.text:0006AB30                 LDMED   SP, {R4-R6,R11,SP,PC}
.text:0006AB30 ; End of function sub_6AA30

.text:0003E3A8 ; =============== S U B R O U T I N E =======================================
.text:0003E3A8
.text:0003E3A8 ; Attributes: noreturn bp-based frame
.text:0003E3A8
.text:0003E3A8 sub_3E3A8                               ; CODE XREF: sub_6AA30+60p
.text:0003E3A8
.text:0003E3A8 oldR4           = -0x20
.text:0003E3A8 oldR5           = -0x1C
.text:0003E3A8 oldR7           = -0x18
.text:0003E3A8 oldR8           = -0x14
.text:0003E3A8 oldR10          = -0x10
.text:0003E3A8 oldR11          = -0xC
.text:0003E3A8 oldSP           = -8
.text:0003E3A8 oldLR           = -4
.text:0003E3A8
.text:0003E3A8                 MOV     R12, SP
.text:0003E3AC                 STMFD   SP!, {R4,R5,R7,R8,R10-R12,LR,PC}
.text:0003E3B0                 SUB     R11, R12, #4
.text:0003E3B4                 MOV     R7, R0
.text:0003E3B8                 ADD     R0, R0, #0x5C0
.text:0003E3BC                 MOVL    R1, 0xFFFFFFFF
.text:0003E3C0                 ADD     R0, R0, #8
.text:0003E3C4                 ADD     R5, R7, #0x5C0
.text:0003E3C8                 ADD     R5, R5, #0xC
.text:0003E3CC                 SUB     R8, R11, #0xD4
.text:0003E3D0                 SUB     R10, R11, #0xCC
.text:0003E3D4                 SUB     SP, SP, #0xB4
.text:0003E3D8                 BL      _ZN3RFs7ConnectEi ; RFs::Connect(int)
.text:0003E3DC                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0003E3E0                 MOV     R0, #0x208
.text:0003E3E4                 BL      _ZN4User6AllocLEi ; User::AllocL(int)
.text:0003E3E8                 MOV     R4, R0
.text:0003E3EC                 BL      sub_8E20
.text:0003E3F0 ; ---------------------------------------------------------------------------
.text:0003E3F0                 MOV     R0, R4
.text:0003E3F4                 BL      _ZN6TDes164ZeroEv ; TDes16::Zero(void)
.text:0003E3F8                 LDR     R0, =dword_91268
.text:0003E3FC                 BL      nullsub_18
.text:0003E400                 MOV     R2, R0
.text:0003E404                 MOV     R1, R2
.text:0003E408                 MOV     R0, R4
.text:0003E40C                 BL      _ZN6TDes164CopyERK7TDesC16 ; TDes16::Copy(TDesC16  const&)
.text:0003E410                 LDR     R3, [R7,#0x38]
.text:0003E414                 LDR     R1, [R3,#0x12C]
.text:0003E418                 LDR     R2, [R1,#0xD8]
.text:0003E41C                 STR     R2, [R7,#0x5BC]
.text:0003E420                 LDR     R3, [R7,#0x10]
.text:0003E424                 LDR     R0, =dword_91260
.text:0003E428                 LDR     R2, [R1,#0xDC]
.text:0003E42C                 STR     R1, [R3,#0x3C]
.text:0003E430                 STR     R2, [R7,#0x5C0]
.text:0003E434                 BL      nullsub_10
.text:0003E438                 MOV     R1, R4
.text:0003E43C                 MOV     R2, R0
.text:0003E440                 MOV     R0, R5
.text:0003E444                 BL      _ZN8RLibrary4LoadERK7TDesC16S2_ ; RLibrary::Load(TDesC16  const&,TDesC16  const&)
.text:0003E448                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0003E44C                 MOV     R1, #1
.text:0003E450                 MOV     R0, R5
.text:0003E454                 BL      _ZNK8RLibrary6LookupEi ; RLibrary::Lookup(int)    〈-这里动态调用函数,RLibrary::Lookup(int)
.text:0003E458                 BLX     R0
.text:0003E45C                 LDR     R1, =aUiFont_sbm
.text:0003E460                 STR     R0, [R7,#0x5C4]
.text:0003E464                 MOV     R0, R8
.text:0003E468                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0003E46C                 MOV     R1, R8
.text:0003E470                 MOV     R0, R10
.text:0003E474                 BL      sub_1C568
.text:0003E478 ; ---------------------------------------------------------------------------
.text:0003E478                 MOV     R1, R10
.text:0003E47C                 LDR     R0, [R7,#0x44]
.text:0003E480                 BL      sub_21624
.text:0003E484                 LDR     R1, =aUiDaoju_sbm
.text:0003E488                 STR     R0, [R7,#0x20]
.text:0003E48C                 MOV     R0, R8
.text:0003E490                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0003E494                 MOV     R1, R8
.text:0003E498                 MOV     R0, R10
.text:0003E49C                 BL      sub_1C568
.text:0003E4A0 ; ---------------------------------------------------------------------------
.text:0003E4A0                 MOV     R1, R10
.text:0003E4A4                 LDR     R0, [R7,#0x44]
.text:0003E4A8                 BL      sub_21624
.text:0003E4AC                 LDR     R1, =aUiS60_sbm
.text:0003E4B0                 STR     R0, [R7,#0x24]
.text:0003E4B4                 MOV     R0, R8
.text:0003E4B8                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0003E4BC                 MOV     R1, R8
.text:0003E4C0                 MOV     R0, R10
.text:0003E4C4                 BL      sub_1C568
.text:0003E4C8 ; ---------------------------------------------------------------------------
.text:0003E4C8                 MOV     R1, R10
.text:0003E4CC                 LDR     R0, [R7,#0x44]
.text:0003E4D0                 BL      sub_21624
.text:0003E4D4                 LDR     R1, =aUiMz_sbm
.text:0003E4D8                 STR     R0, [R7,#0x28]
.text:0003E4DC                 MOV     R0, R8
.text:0003E4E0                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0003E4E4                 MOV     R1, R8
.text:0003E4E8                 MOV     R0, R10
.text:0003E4EC                 BL      sub_1C568
.text:0003E4F0 ; ---------------------------------------------------------------------------
.text:0003E4F0                 MOV     R1, R10
.text:0003E4F4                 LDR     R0, [R7,#0x44]
.text:0003E4F8                 BL      sub_21624
.text:0003E4FC                 LDR     R1, =aUiSm_sbm
.text:0003E500                 STR     R0, [R7,#0x2C]
.text:0003E504                 MOV     R0, R8
.text:0003E508                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0003E50C                 MOV     R1, R8
.text:0003E510                 MOV     R0, R10
.text:0003E514                 BL      sub_1C568
.text:0003E518 ; ---------------------------------------------------------------------------
.text:0003E518                 MOV     R1, R10
.text:0003E51C                 LDR     R0, [R7,#0x44]
.text:0003E520                 BL      sub_21624
.text:0003E524                 LDR     R1, =aUiSkip_sbm
.text:0003E528                 STR     R0, [R7,#0x30]
.text:0003E52C                 MOV     R0, R8
.text:0003E530                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0003E534                 MOV     R1, R8
.text:0003E538                 MOV     R0, R10
.text:0003E53C                 BL      sub_1C568
.text:0003E540 ; ---------------------------------------------------------------------------
.text:0003E540                 MOV     R1, R10
.text:0003E544                 LDR     R0, [R7,#0x44]
.text:0003E548                 BL      sub_21624
.text:0003E54C                 STR     R0, [R7,#0x34]
.text:0003E550                 MOV     R0, R4
.text:0003E554                 BL      eikdlg_3
.text:0003E558                 SUB     SP, R11, #0x20
.text:0003E55C                 LDMFD   SP, {R4,R5,R7,R8,R10,R11,SP,PC}
.text:0003E55C ; End of function sub_3E3A8

.text:0005C338 ; =============== S U B R O U T I N E =======================================
.text:0005C338
.text:0005C338 ; Attributes: bp-based frame
.text:0005C338
.text:0005C338 sub_5C338                               ; CODE XREF: sub_5AEF0+58p
.text:0005C338
.text:0005C338 oldR4           = -0x28
.text:0005C338 oldR5           = -0x24
.text:0005C338 oldR6           = -0x20
.text:0005C338 oldR7           = -0x1C
.text:0005C338 oldR8           = -0x18
.text:0005C338 oldR9           = -0x14
.text:0005C338 oldR10          = -0x10
.text:0005C338 oldR11          = -0xC
.text:0005C338 oldSP           = -8
.text:0005C338 oldLR           = -4
.text:0005C338
.text:0005C338                 MOV     R12, SP
.text:0005C33C                 STMFD   SP!, {R4-R12,LR,PC}
.text:0005C340                 SUB     R11, R12, #4
.text:0005C344                 ADD     R7, R0, #0x180
.text:0005C348                 MOV     R8, R0
.text:0005C34C                 MOVL    R1, 0xFFFFFFFF
.text:0005C350                 MOV     R0, R7
.text:0005C354                 MOVL    R5, 0x1DE0
.text:0005C35C                 ADD     R6, R8, #0x184
.text:0005C360                 MOV     R9, #0
.text:0005C364                 ADD     R10, R8, #0x1D00
.text:0005C368                 SUB     SP, SP, #0x1C
.text:0005C36C                 BL      _ZN3RFs7ConnectEi ; RFs::Connect(int)
.text:0005C370                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0005C374                 MOV     R0, #0x208
.text:0005C378                 BL      _ZN4User6AllocLEi ; User::AllocL(int)
.text:0005C37C                 MOV     R1, #0x100
.text:0005C380                 MOV     R4, R0
.text:0005C384                 BL      _ZN10TBufBase16C2Ei ; TBufBase16::TBufBase16(int)
.text:0005C388                 MOV     R0, R4
.text:0005C38C                 STR     R4, [R8,R5]
.text:0005C390                 BL      _ZN6TDes164ZeroEv ; TDes16::Zero(void)
.text:0005C394                 LDR     R0, =dword_93748    〈-SimMediaEngineDll.dll字符串
.text:0005C398                 BL      nullsub_39
.text:0005C39C                 MOV     R1, R0
.text:0005C3A0                 LDR     R0, [R8,R5]
.text:0005C3A4                 BL      _ZN6TDes164CopyERK7TDesC16 ; TDes16::Copy(TDesC16  const&)
.text:0005C3A8                 LDR     R2, =dword_93740
.text:0005C3AC                 LDR     R1, [R8,R5]
.text:0005C3B0                 MOV     R0, R6
.text:0005C3B4                 BL      _ZN8RLibrary4LoadERK7TDesC16S2_ ; RLibrary::Load(TDesC16  const&,TDesC16  const&)
.text:0005C3B8                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0005C3BC                 MOV     R1, #1
.text:0005C3C0                 MOV     R0, R6
.text:0005C3C4                 BL      _ZNK8RLibrary6LookupEi ; RLibrary::Lookup(int)    〈-这里动态调用函数,RLibrary::Lookup(int)
.text:0005C3C8                 BLX     R0
.text:0005C3CC                 MOVL    R4, 0x2044
.text:0005C3D4                 LDR     R3, [R0]
.text:0005C3D8                 LDR     R1, [R8,R4]
.text:0005C3DC                 STR     R0, [R8,#0x178]
.text:0005C3E0                 MOV     LR, PC
.text:0005C3E4                 LDR     PC, [R3,#8]
.text:0005C3E8                 LDR     R2, [R8,#0x178]
.text:0005C3EC                 MOV     R1, R9
.text:0005C3F0                 MOV     R0, R2
.text:0005C3F4                 LDR     R3, [R2]
.text:0005C3F8                 MOV     LR, PC
.text:0005C3FC                 LDR     PC, [R3,#0x4C]
.text:0005C400                 SUB     R6, R11, #0x34
.text:0005C404                 LDR     R1, [R8,R4]
.text:0005C408                 LDR     R0, [R8,R5]
.text:0005C40C                 STR     R9, [R8,#0x7F4]
.text:0005C410                 ADD     R10, R10, #0x18
.text:0005C414                 SUB     R4, R4, #0x344
.text:0005C418                 ADD     R4, R4, #0x10
.text:0005C41C                 STR     R9, [R8,#0x7F8]
.text:0005C420                 STRB    R9, [R8,#0x800]
.text:0005C424                 BL      _ZN6TDes164CopyERK7TDesC16 ; TDes16::Copy(TDesC16  const&)
.text:0005C428                 LDR     R1, =aAsc_spk
.text:0005C42C                 MOV     R0, R6
.text:0005C430                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0005C434                 MOV     R1, R6
.text:0005C438                 LDR     R0, [R8,R5]
.text:0005C43C                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0005C440                 MOV     R1, R7
.text:0005C444                 LDR     R2, [R8,R5]
.text:0005C448                 MOV     R0, R10
.text:0005C44C                 MOV     R3, R9
.text:0005C450                 BL      _ZN5RFile4OpenER3RFsRK7TDesC16j ; RFile::Open(RFs &,TDesC16  const&,uint)
.text:0005C454                 CMP     R0, R9
.text:0005C458                 STR     R0, [R8,R4]
.text:0005C45C                 BEQ     loc_5C490
.text:0005C460                 LDR     R2, [R8,#0x178]
.text:0005C464                 MOV     R1, R9
.text:0005C468                 MOV     R0, R2
.text:0005C46C                 LDR     R3, [R2]
.text:0005C470                 MOV     LR, PC
.text:0005C474                 LDR     PC, [R3,#0xCC]
.text:0005C478
.text:0005C478 loc_5C478                               ; CODE XREF: sub_5C338+1F8j
.text:0005C478                 MOVL    R3, 0x1DE0
.text:0005C480                 LDR     R0, [R8,R3]
.text:0005C484                 BL      eikdlg_3
.text:0005C488                 SUB     SP, R11, #0x28
.text:0005C48C                 LDMFD   SP, {R4-R11,SP,PC}
.text:0005C490 ; ---------------------------------------------------------------------------
.text:0005C490
.text:0005C490 loc_5C490                               ; CODE XREF: sub_5C338+124j
.text:0005C490                 MOV     R3, #0x1D00
.text:0005C494                 ADD     R4, R8, R3
.text:0005C498                 ADD     R4, R4, #0x14
.text:0005C49C                 ADD     R3, R3, #0x14
.text:0005C4A0                 STR     R0, [R8,R3]
.text:0005C4A4                 MOV     R1, R4
.text:0005C4A8                 MOV     R0, R10
.text:0005C4AC                 BL      _ZNK5RFile4SizeERi ; RFile::Size(int &)
.text:0005C4B0                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0005C4B4                 LDR     R0, [R4]
.text:0005C4B8                 BL      _ZN4User6AllocLEi ; User::AllocL(int)
.text:0005C4BC                 SUB     R5, R11, #0x44
.text:0005C4C0                 LDR     R2, [R4]
.text:0005C4C4                 MOV     R6, R0
.text:0005C4C8                 MOV     R1, R0
.text:0005C4CC                 MOV     R0, R5
.text:0005C4D0                 BL      _ZN5TPtr8C1EPhi ; TPtr8::TPtr8(uchar *,int)
.text:0005C4D4                 MOV     R1, R5
.text:0005C4D8                 MOV     R0, R10
.text:0005C4DC                 BL      _ZNK5RFile4ReadER5TDes8 ; RFile::Read(TDes8 &)
.text:0005C4E0                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0005C4E4                 LDR     R3, [R8,#0x178]
.text:0005C4E8                 LDR     R2, [R4]
.text:0005C4EC                 MOV     R0, R3
.text:0005C4F0                 LDR     R12, [R3]
.text:0005C4F4                 MOV     R1, R6
.text:0005C4F8                 MOV     LR, PC
.text:0005C4FC                 LDR     PC, [R12,#0xD0]
.text:0005C500                 CMP     R6, #0
.text:0005C504                 BEQ     loc_5C510
.text:0005C508                 MOV     R0, R6
.text:0005C50C                 BL      hal_1
.text:0005C510
.text:0005C510 loc_5C510                               ; CODE XREF: sub_5C338+1CCj
.text:0005C510                 MOV     R0, R10
.text:0005C514                 BL      _ZN5RFile5CloseEv ; RFile::Close(void)
.text:0005C518                 LDR     R3, [R8,#0x178]
.text:0005C51C                 MOV     R1, #1
.text:0005C520                 MOV     R0, R3
.text:0005C524                 LDR     R2, [R3]
.text:0005C528                 MOV     LR, PC
.text:0005C52C                 LDR     PC, [R2,#0xCC]
.text:0005C530                 B       loc_5C478
.text:0005C530 ; End of function sub_5C338

    因为调用 CTelephony::GetPhoneId() 和 CTelephony::TPhoneIdV1() 函数的代码很单一,估计函数功能:

┌────────────────────┐
│.text:00059B44       BL     sub_59204 ; │
└────────────────────┘
                    │
                    │
                    ↓
                 sub_59204    <-估计是开辟空间,加载文件
                    │
                    │
                    ↓
                 sub_5AEF0    <-估计是指定的DLL文件并分配需要运行的子函数
                  │  │
              ┌─┘  └─┐
              │          ↓
              │      sub_5C338    <-动态调用指定的DLL中的第N个函数,并操作 tmd.id 内容,估计会包括注册信息
              │
              │
              ↓
          sub_6AA30    <-调用 sub_6E2BC 去操作 tmd.id 内容,估计会包括注册信息
              │
              │
              ↓
          sub_3E3A8    <-动态调用指定的DLL中的第N个函数,将结果返回

    现在有2 处 RLibrary::Lookup(int) 函数, 一个包含在 sub_3E3A8 中, 一个包含在 sub_5C338 中, 对于获得 IMEI 整个程序只能最终通过调用 sub_5AEF0 来判断是调用哪个子函数.

    根据获得 IMEI 部分得知, sub_5AEF0 是一个需要关键分析函数.

4.2 - 根据操作 tmd.id 文件进行分析

    使用 IDA_5.2 分析 IsLand_3rd.exe,找到 3 处 有关 tmd.id 文件操作,在 非子函数 和 子函数 sub_6E194 和 sub_6E2BC 中。

┌─────────────────────────┐
│.text:0006E02C      LDR     R1, =aLoadsaveTmp__0; │    <-存在 tmd.id 文件操作
└─────────────────────────┘

┌────────────────────┐
│.text:00059B44       BL     sub_59204 ; │
└────────────────────┘
                    │
                    │
                    ↓
                 sub_59204
                    │
                    │
                    ↓
                 sub_5AEF0
                    │
                    │
                    ↓
                 sub_6AA30
                  │  │
                  │  └─┐
                  │      ↓
                  │   sub_6EA90
                  │      │
                  │  ┌─┘
                  ↓  ↓
                 sub_6E2BC    <-存在 tmd.id 文件操作
                  │  ↑
              ┌─┘  └─┬────────┐
              ↓          │                │
          sub_6E194       │                │    <-存在 tmd.id 文件操作
              ↑          │                │
              │          │                │
              │          │                │
      ┌───┤          │                │
      │      │          │                │
      │  sub_6DF98       │                │
      │      ↑          │                │
      │      │          │                │
      │      │          │                │
      │      │          │             sub_6982C
      │      │          │               ↑
      │      │          │          ┌──┼──┬───┐
      │      │          │          │    │    │      │
      │      │          │       sub_1B4DC│    │      │
      │      │          │          ↑    │    │      │
      │      │          │          │    │ sub_1BADC  │
      │      │          │          │    │    ↑      │
      │      │       sub_6DFD4      │    │    │      │
      │      │          ↑          │    │    │      │
      └───┴─────┼─────┴──┴──┘      │
                          │                              │
                       sub_14C7C                          │
                          ↑                              │
                          └─────┬─────────┘
                                   sub_68E3C
                                      ↑
                    ┌────────┴────────────┐
                    │                                          │
┌────────────────────┐┌────────────────────┐
│.text:0006A8E8       BL     sub_68E3C ; ││.text:00069B04       BL     sub_68E3C ; │
└────────────────────┘└────────────────────┘

      非子函数代码内容
.text:0006DFF8 ; ---------------------------------------------------------------------------
.text:0006DFF8                 MOV     R12, SP
.text:0006DFFC                 STMFD   SP!, {R4-R8,R10-R12,LR,PC}
.text:0006E000                 SUB     R11, R12, #4
.text:0006E004                 MOV     R5, R0
.text:0006E008                 SUB     R4, R11, #0x2C
.text:0006E00C                 SUB     R7, R11, #0xB0
.text:0006E010                 SUB     R8, R11, #0x34
.text:0006E014                 SUB     SP, SP, #0x90
.text:0006E018                 LDR     R0, [R0,#0xC]
.text:0006E01C                 BL      _ZN6TDes164ZeroEv ; TDes16::Zero(void)
.text:0006E020                 LDR     R0, [R5,#0xC]
.text:0006E024                 ADD     R1, R5, #0x10
.text:0006E028                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0006E02C                 LDR     R1, =aLoadsaveTmp__0    <-此处有对tmp.id文件的操作
.text:0006E030                 MOV     R0, R4
.text:0006E034                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0006E038                 MOV     R1, R4
.text:0006E03C                 LDR     R0, [R5,#0xC]
.text:0006E040                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0006E044                 MOV     R4, #0
.text:0006E048                 MOVL    R1, 0xFFFFFFFF
.text:0006E04C                 MOV     R0, R7
.text:0006E050                 STR     R4, [R11,#-0xB0]
.text:0006E054                 STR     R4, [R11,#-0x34]
.text:0006E058                 STR     R4, [R11,#-0x30]
.text:0006E05C                 BL      _ZN3RFs7ConnectEi ; RFs::Connect(int)
.text:0006E060                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0006E064                 MOV     R0, R8
.text:0006E068                 MOV     R1, R7
.text:0006E06C                 LDR     R2, [R5,#0xC]
.text:0006E070                 MOV     R3, #0x200
.text:0006E074                 BL      _ZN5RFile4OpenER3RFsRK7TDesC16j ; RFile::Open(RFs &,TDesC16  const&,uint)    <-打开文件
.text:0006E078                 CMN     R0, #1
.text:0006E07C                 BEQ     loc_6E098
.text:0006E080
.text:0006E080 loc_6E080                               ; CODE XREF: .text:0006E18Cj
.text:0006E080                 MOV     R0, R8
.text:0006E084                 BL      _ZN5RFile5CloseEv ; RFile::Close(void)    <-关闭文件
.text:0006E088                 MOV     R0, R7
.text:0006E08C                 BL      _ZN22MCoeForegroundObserver33MCoeForegroundObserver_Reserved_2Ev ; MCoeForegroundObserver::MCoeForegroundObserver_Reserved_2(void)
.text:0006E090                 SUB     SP, R11, #0x24
.text:0006E094                 LDMFD   SP, {R4-R8,R10,R11,SP,PC}
.text:0006E098 ; ---------------------------------------------------------------------------
.text:0006E098
.text:0006E098 loc_6E098                               ; CODE XREF: .text:0006E07Cj
.text:0006E098                 MOV     R3, #0x200
.text:0006E09C                 LDR     R2, [R5,#0xC]
.text:0006E0A0                 MOV     R1, R7
.text:0006E0A4                 MOV     R0, R8
.text:0006E0A8                 SUB     R10, R11, #0x9C
.text:0006E0AC                 BL      _ZN5RFile6CreateER3RFsRK7TDesC16j ; RFile::Create(RFs &,TDesC16  const&,uint)    <-创建文件,但是因为删除该文件程序退出,可能这段代码无用
.text:0006E0B0                 MOV     R1, R4
.text:0006E0B4                 MOV     R2, #0x68
.text:0006E0B8                 MOV     R0, R10
.text:0006E0BC                 BL      memset
.text:0006E0C0                 MOVL    R1, loc_1869C
.text:0006E0C8                 ADD     R1, R1, #3
.text:0006E0CC                 SUB     R2, R11, #0x84
.text:0006E0D0                 MOV     R3, #0xE
.text:0006E0D4
.text:0006E0D4 loc_6E0D4                               ; CODE XREF: .text:0006E0DCj
.text:0006E0D4                 SUBS    R3, R3, #1
.text:0006E0D8                 STR     R1, [R2,#4]!
.text:0006E0DC                 BPL     loc_6E0D4
.text:0006E0E0                 MOV     R5, #0x2800
.text:0006E0E4                 MOV     R4, #0
.text:0006E0E8                 MOV     R3, #0x32
.text:0006E0EC                 MOV     R0, R5
.text:0006E0F0                 STR     R3, [R11,#-0x40]
.text:0006E0F4                 STR     R3, [R11,#-0x3C]
.text:0006E0F8                 STR     R4, [R11,#-0x88]
.text:0006E0FC                 STR     R4, [R11,#-0x84]
.text:0006E100                 STR     R4, [R11,#-0x8C]
.text:0006E104                 STR     R4, [R11,#-0x44]
.text:0006E108                 STR     R4, [R11,#-0x38]
.text:0006E10C                 BL      _ZN4User6AllocLEi ; User::AllocL(int)
.text:0006E110                 MOV     R2, R10
.text:0006E114                 MOV     R3, #0x68
.text:0006E118                 SUB     R1, R11, #0xB4
.text:0006E11C                 MOV     R6, R0
.text:0006E120                 STR     R5, [R11,#-0xB4]
.text:0006E124                 BL      _ZN11RConnection5StartER14TRequestStatus ; RConnection::Start(TRequestStatus &)
.text:0006E128                 LDRB    R3, [R11,#-0xB4]
.text:0006E12C                 STRB    R3, [R6]
.text:0006E130                 LDRB    R3, [R11,#-0xB3]
.text:0006E134                 STRB    R3, [R6,#1]
.text:0006E138                 LDR     R2, [R11,#-0xB4]
.text:0006E13C                 B       loc_6E154
.text:0006E140 ; ---------------------------------------------------------------------------
.text:0006E140
.text:0006E140 loc_6E140                               ; CODE XREF: .text:0006E158j
.text:0006E140                 LDRB    R3, [R4,R6]
.text:0006E144                 RSB     R3, R3, #0
.text:0006E148                 STRB    R3, [R4,R6]
.text:0006E14C                 LDR     R2, [R11,#-0xB4]
.text:0006E150                 ADD     R4, R4, #1
.text:0006E154
.text:0006E154 loc_6E154                               ; CODE XREF: .text:0006E13Cj
.text:0006E154                 CMP     R4, R2
.text:0006E158                 BCC     loc_6E140
.text:0006E15C                 SUB     R4, R11, #0xAC
.text:0006E160                 MOV     R3, R2
.text:0006E164                 MOV     R1, R6
.text:0006E168                 MOV     R0, R4
.text:0006E16C                 BL      _ZN5TPtr8C1EPhii ; TPtr8::TPtr8(uchar *,int,int)
.text:0006E170                 MOV     R1, R4
.text:0006E174                 LDR     R2, [R11,#-0xB4]
.text:0006E178                 MOV     R0, R8
.text:0006E17C                 BL      _ZN5RFile5WriteERK6TDesC8i ; RFile::Write(TDesC8  const&,int)    <-写文件
.text:0006E180                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0006E184                 MOV     R0, R6
.text:0006E188                 BL      hal_1
.text:0006E18C                 B       loc_6E080
.text:0006E18C ; ---------------------------------------------------------------------------
.text:0006E190 off_6E190       DCD aLoadsaveTmp__0     ; DATA XREF: .text:0006E02Cr
.text:0006E190                                         ; "loadsave\\tmp.id"

.text:0006E194 ; =============== S U B R O U T I N E =======================================
.text:0006E194
.text:0006E194 ; Attributes: bp-based frame
.text:0006E194
.text:0006E194 sub_6E194                               ; CODE XREF: sub_14C7C+468p
.text:0006E194                                         ; sub_14C7C+5ECp ...
.text:0006E194
.text:0006E194 var_54          = -0x54
.text:0006E194 var_50          = -0x50
.text:0006E194 var_3C          = -0x3C
.text:0006E194 var_38          = -0x38
.text:0006E194 oldR4           = -0x28
.text:0006E194 oldR5           = -0x24
.text:0006E194 oldR6           = -0x20
.text:0006E194 oldR7           = -0x1C
.text:0006E194 oldR8           = -0x18
.text:0006E194 oldR9           = -0x14
.text:0006E194 oldR10          = -0x10
.text:0006E194 oldR11          = -0xC
.text:0006E194 oldSP           = -8
.text:0006E194 oldLR           = -4
.text:0006E194
.text:0006E194                 MOV     R12, SP
.text:0006E198                 STMFD   SP!, {R4-R12,LR,PC}
.text:0006E19C                 SUB     R11, R12, #4
.text:0006E1A0                 MOV     R5, R0
.text:0006E1A4                 MOV     R8, R1
.text:0006E1A8                 SUB     R6, R11, #0x34
.text:0006E1AC                 SUB     R10, R11, #0x50
.text:0006E1B0                 SUB     R4, R11, #0x3C
.text:0006E1B4                 MOV     R7, #0x2800
.text:0006E1B8                 SUB     R9, R11, #0x4C
.text:0006E1BC                 SUB     SP, SP, #0x2C
.text:0006E1C0                 LDR     R0, [R0,#0xC]
.text:0006E1C4                 BL      _ZN6TDes164ZeroEv ; TDes16::Zero(void)
.text:0006E1C8                 LDR     R0, [R5,#0xC]
.text:0006E1CC                 ADD     R1, R5, #0x10
.text:0006E1D0                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0006E1D4                 LDR     R1, =aLoadsaveTmp__0    <-此处有对tmp.id文件的操作
.text:0006E1D8                 MOV     R0, R6
.text:0006E1DC                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0006E1E0                 MOV     R1, R6
.text:0006E1E4                 LDR     R0, [R5,#0xC]
.text:0006E1E8                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0006E1EC                 MOV     R6, #0
.text:0006E1F0                 MOVL    R1, 0xFFFFFFFF
.text:0006E1F4                 MOV     R0, R10
.text:0006E1F8                 STR     R6, [R11,#var_50]
.text:0006E1FC                 STR     R6, [R11,#var_3C]
.text:0006E200                 STR     R6, [R11,#var_38]
.text:0006E204                 BL      _ZN3RFs7ConnectEi ; RFs::Connect(int)
.text:0006E208                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0006E20C                 LDR     R2, [R5,#0xC]
.text:0006E210                 MOV     R1, R10
.text:0006E214                 MOV     R3, #0x200
.text:0006E218                 MOV     R0, R4
.text:0006E21C                 BL      _ZN5RFile4OpenER3RFsRK7TDesC16j ; RFile::Open(RFs &,TDesC16  const&,uint)    <-打开文件
.text:0006E220                 MOV     R0, R7
.text:0006E224                 BL      _ZN4User6AllocLEi ; User::AllocL(int)    <-动态开辟空间
.text:0006E228                 MOV     R2, R8
.text:0006E22C                 SUB     R1, R11, #0x54
.text:0006E230                 MOV     R3, #0x68
.text:0006E234                 MOV     R5, R0
.text:0006E238                 STR     R7, [R11,#var_54]
.text:0006E23C                 BL      _ZN11RConnection5StartER14TRequestStatus ; RConnection::Start(TRequestStatus &)
.text:0006E240                 LDRB    R3, [R11,#var_54]
.text:0006E244                 STRB    R3, [R5]
.text:0006E248                 MOV     R0, R9
.text:0006E24C                 MOV     R1, R5
.text:0006E250                 LDRB    R3, [R11,#var_54+1]
.text:0006E254                 STRB    R3, [R5,#1]
.text:0006E258                 LDR     R2, [R11,#var_54]
.text:0006E25C                 MOV     R3, R2
.text:0006E260                 BL      _ZN5TPtr8C1EPhii ; TPtr8::TPtr8(uchar *,int,int)
.text:0006E264                 LDR     R2, [R11,#var_54]
.text:0006E268                 B       loc_6E280
.text:0006E26C ; ---------------------------------------------------------------------------
.text:0006E26C
.text:0006E26C loc_6E26C                               ; CODE XREF: sub_6E194+F0j
.text:0006E26C                 LDRB    R3, [R6,R5]
.text:0006E270                 RSB     R3, R3, #0
.text:0006E274                 STRB    R3, [R6,R5]
.text:0006E278                 LDR     R2, [R11,#var_54]
.text:0006E27C                 ADD     R6, R6, #1
.text:0006E280
.text:0006E280 loc_6E280                               ; CODE XREF: sub_6E194+D4j
.text:0006E280                 CMP     R6, R2
.text:0006E284                 BCC     loc_6E26C
.text:0006E288                 MOV     R1, R9
.text:0006E28C                 MOV     R0, R4
.text:0006E290                 BL      _ZN5RFile5WriteERK6TDesC8i ; RFile::Write(TDesC8  const&,int)    <-写文件
.text:0006E294                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0006E298                 MOV     R0, R5
.text:0006E29C                 BL      hal_1
.text:0006E2A0                 MOV     R0, R4
.text:0006E2A4                 BL      _ZN5RFile5CloseEv ; RFile::Close(void)    <-关闭文件
.text:0006E2A8                 MOV     R0, R10
.text:0006E2AC                 BL      _ZN22MCoeForegroundObserver33MCoeForegroundObserver_Reserved_2Ev ; MCoeForegroundObserver::MCoeForegroundObserver_Reserved_2(void)
.text:0006E2B0                 SUB     SP, R11, #0x28
.text:0006E2B4                 LDMFD   SP, {R4-R11,SP,PC}
.text:0006E2B4 ; End of function sub_6E194

.text:0006E2BC ; =============== S U B R O U T I N E =======================================
.text:0006E2BC
.text:0006E2BC ; Attributes: bp-based frame
.text:0006E2BC
.text:0006E2BC sub_6E2BC                               ; CODE XREF: sub_14C7C+218p
.text:0006E2BC                                         ; sub_14C7C+458p ...
.text:0006E2BC
.text:0006E2BC var_58          = -0x58
.text:0006E2BC var_54          = -0x54
.text:0006E2BC var_50          = -0x50
.text:0006E2BC var_3C          = -0x3C
.text:0006E2BC var_38          = -0x38
.text:0006E2BC oldR4           = -0x28
.text:0006E2BC oldR5           = -0x24
.text:0006E2BC oldR6           = -0x20
.text:0006E2BC oldR7           = -0x1C
.text:0006E2BC oldR8           = -0x18
.text:0006E2BC oldR9           = -0x14
.text:0006E2BC oldR10          = -0x10
.text:0006E2BC oldR11          = -0xC
.text:0006E2BC oldSP           = -8
.text:0006E2BC oldLR           = -4
.text:0006E2BC
.text:0006E2BC                 MOV     R12, SP
.text:0006E2C0                 STMFD   SP!, {R4-R12,LR,PC}
.text:0006E2C4                 SUB     R11, R12, #4
.text:0006E2C8                 MOV     R7, R0
.text:0006E2CC                 SUB     R4, R11, #0x34
.text:0006E2D0                 MOV     R8, R1
.text:0006E2D4                 SUB     R9, R11, #0x50
.text:0006E2D8                 SUB     R10, R11, #0x3C
.text:0006E2DC                 SUB     R5, R11, #0x4C
.text:0006E2E0                 SUB     SP, SP, #0x34
.text:0006E2E4                 LDR     R0, [R0,#0xC]
.text:0006E2E8                 BL      _ZN6TDes164ZeroEv ; TDes16::Zero(void)
.text:0006E2EC                 LDR     R0, [R7,#0xC]
.text:0006E2F0                 ADD     R1, R7, #0x10
.text:0006E2F4                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0006E2F8                 LDR     R1, =aLoadsaveTmp__0    <-此处有对tmp.id文件的操作
.text:0006E2FC                 MOV     R0, R4
.text:0006E300                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0006E304                 MOV     R1, R4
.text:0006E308                 LDR     R0, [R7,#0xC]
.text:0006E30C                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0006E310                 MOV     R4, #0
.text:0006E314                 MOVL    R1, 0xFFFFFFFF
.text:0006E318                 MOV     R0, R9
.text:0006E31C                 STR     R4, [R11,#var_50]
.text:0006E320                 STR     R4, [R11,#var_3C]
.text:0006E324                 STR     R4, [R11,#var_38]
.text:0006E328                 BL      _ZN3RFs7ConnectEi ; RFs::Connect(int)
.text:0006E32C                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0006E330                 LDR     R2, [R7,#0xC]
.text:0006E334                 MOV     R1, R9
.text:0006E338                 MOV     R3, R4
.text:0006E33C                 MOV     R0, R10
.text:0006E340                 BL      _ZN5RFile4OpenER3RFsRK7TDesC16j ; RFile::Open(RFs &,TDesC16  const&,uint)    <-打开文件
.text:0006E344                 SUB     R1, R11, #0x54
.text:0006E348                 MOV     R3, #0x68
.text:0006E34C                 MOV     R0, R10
.text:0006E350                 STR     R3, [R11,#var_58]
.text:0006E354                 STR     R4, [R11,#var_54]
.text:0006E358                 BL      _ZNK5RFile4SizeERi ; RFile::Size(int &)
.text:0006E35C                 BL      _ZN4User12LeaveIfErrorEi ; User::LeaveIfError(int)
.text:0006E360                 MOV     R0, #0x2800
.text:0006E364                 BL      _ZN4User6AllocLEi ; User::AllocL(int)    <-动态开辟空间
.text:0006E368                 MOV     R2, #0x2800
.text:0006E36C                 MOV     R3, R2
.text:0006E370                 MOV     R1, R0
.text:0006E374                 MOV     R6, R0
.text:0006E378                 MOV     R0, R5
.text:0006E37C                 BL      _ZN5TPtr8C1EPhii ; TPtr8::TPtr8(uchar *,int,int)
.text:0006E380                 MOV     R0, R10
.text:0006E384                 MOV     R1, R5
.text:0006E388                 LDR     R2, [R11,#var_54]
.text:0006E38C                 BL      _ZNK5RFile4ReadER5TDes8i ; RFile::Read(TDes8 &,int)    <-读文件
.text:0006E390                 B       loc_6E3A4
.text:0006E394 ; ---------------------------------------------------------------------------
.text:0006E394
.text:0006E394 loc_6E394                               ; CODE XREF: sub_6E2BC+F0j
.text:0006E394                 LDRB    R3, [R4,R6]
.text:0006E398                 RSB     R3, R3, #0
.text:0006E39C                 STRB    R3, [R4,R6]
.text:0006E3A0                 ADD     R4, R4, #1
.text:0006E3A4
.text:0006E3A4 loc_6E3A4                               ; CODE XREF: sub_6E2BC+D4j
.text:0006E3A4                 LDR     R3, [R11,#var_54]
.text:0006E3A8                 CMP     R4, R3
.text:0006E3AC                 BLT     loc_6E394
.text:0006E3B0                 LDRB    R2, [R6,#1]
.text:0006E3B4                 LDRB    R3, [R6]
.text:0006E3B8                 ADD     R3, R3, R2,LSL#8
.text:0006E3BC                 STR     R3, [R11,#var_54]
.text:0006E3C0                 MOVL    R12, 0xFFFFFF9C
.text:0006E3C4                 MOV     R3, #0x78
.text:0006E3C8                 SUB     R1, R11, #0x58
.text:0006E3CC                 MOV     R2, R6
.text:0006E3D0                 STRB    R12, [R6,#1]
.text:0006E3D4                 MOV     R0, R8
.text:0006E3D8                 STRB    R3, [R6]
.text:0006E3DC                 LDR     R3, [R11,#var_54]
.text:0006E3E0                 BL      uncompress
.text:0006E3E4                 MOV     R5, R0
.text:0006E3E8                 MOV     R0, R6
.text:0006E3EC                 BL      hal_1
.text:0006E3F0                 CMP     R5, #0
.text:0006E3F4                 BEQ     loc_6E458
.text:0006E3F8                 MOV     R0, R10
.text:0006E3FC                 BL      _ZN5RFile5CloseEv ; RFile::Close(void)    <-关闭文件
.text:0006E400                 MOV     R0, R9
.text:0006E404                 BL      _ZN22MCoeForegroundObserver33MCoeForegroundObserver_Reserved_2Ev ; MCoeForegroundObserver::MCoeForegroundObserver_Reserved_2(void)
.text:0006E408                 MOV     R1, #0
.text:0006E40C                 MOV     R2, #0x68
.text:0006E410                 MOV     R0, R8
.text:0006E414                 BL      memset
.text:0006E418                 MOVL    R1, loc_1869C
.text:0006E420                 ADD     R1, R1, #3
.text:0006E424                 MOV     R3, R8
.text:0006E428                 MOV     R2, #0xE
.text:0006E42C
.text:0006E42C loc_6E42C                               ; CODE XREF: sub_6E2BC+17Cj
.text:0006E42C                 SUBS    R2, R2, #1
.text:0006E430                 STR     R1, [R3,#0x1C]
.text:0006E434                 ADD     R3, R3, #4
.text:0006E438                 BPL     loc_6E42C
.text:0006E43C                 MOV     R3, #0x32
.text:0006E440                 STR     R3, [R8,#0x5C]
.text:0006E444                 MOV     R0, R7
.text:0006E448                 MOV     R1, R8
.text:0006E44C                 STR     R3, [R8,#0x60]
.text:0006E450                 BL      sub_6E194    <-此处调用sub_6E194,进行文件写操作
.text:0006E454                 B       loc_6E468
.text:0006E458 ; ---------------------------------------------------------------------------
.text:0006E458
.text:0006E458 loc_6E458                               ; CODE XREF: sub_6E2BC+138j
.text:0006E458                 MOV     R0, R10
.text:0006E45C                 BL      _ZN5RFile5CloseEv ; RFile::Close(void)
.text:0006E460                 MOV     R0, R9
.text:0006E464                 BL      _ZN22MCoeForegroundObserver33MCoeForegroundObserver_Reserved_2Ev ; MCoeForegroundObserver::MCoeForegroundObserver_Reserved_2(void)
.text:0006E468
.text:0006E468 loc_6E468                               ; CODE XREF: sub_6E2BC+198j
.text:0006E468                 SUB     SP, R11, #0x28
.text:0006E46C                 LDMFD   SP, {R4-R11,SP,PC}
.text:0006E46C ; End of function sub_6E2BC
.text:0006E46C
.text:0006E46C ; ---------------------------------------------------------------------------
.text:0006E470 off_6E470       DCD aLoadsaveTmp__0     ; DATA XREF: sub_6E2BC+3Cr
.text:0006E470                                         ; "loadsave\\tmp.id"

    仔细观察会发现,只有 2 处对 tmd.id 文件可能进行写入,一个是 非子函数部分代码 另一个是 sub_6E194. 而 sub_6E2BC 只有读文件内容的代码.

4.3 - 将文件操作和取得IMEI操作函数图进行综合。
    我们能够发现,对文件操作和对IMEI操作共有的子函数是 sub_5AEF0 ,估计从这里继续追查的可能性最大。
    其次,对于函数 sub_68E3C 仅仅对文件读写,但不涉及取得 IMEI,定为其次需要追查的子函数。
    最后,对于 .text:0006E02C      LDR     R1, =aLoadsaveTmp__0,为最后追查。

5 - 正式进入分析代码

5.1 - 开始分析 sub_5AEF0

此处再将代码内容粘贴如下:
.text:0005AEF0 ; =============== S U B R O U T I N E =======================================
.text:0005AEF0
.text:0005AEF0 ; Attributes: noreturn bp-based frame
.text:0005AEF0
.text:0005AEF0 sub_5AEF0                               ; CODE XREF: sub_59204+90p
.text:0005AEF0
.text:0005AEF0 var_30          = -0x30
.text:0005AEF0 oldR5           = -0x20
.text:0005AEF0 oldR6           = -0x1C
.text:0005AEF0 oldR7           = -0x18
.text:0005AEF0 oldR8           = -0x14
.text:0005AEF0 oldR9           = -0x10
.text:0005AEF0 oldR11          = -0xC
.text:0005AEF0 oldSP           = -8
.text:0005AEF0 oldLR           = -4
.text:0005AEF0
.text:0005AEF0                 MOV     R12, SP
.text:0005AEF4                 STMFD   SP!, {R5-R9,R11,R12,LR,PC}
.text:0005AEF8                 SUB     R11, R12, #4
.text:0005AEFC                 MOV     R9, R0
.text:0005AF00                 MOVL    R0, 0x3A48
.text:0005AF08                 MOV     R6, R1
.text:0005AF0C                 MOV     R7, R2
.text:0005AF10                 MOV     R8, R3
.text:0005AF14                 SUB     SP, SP, #0xC
.text:0005AF18                 BL      _ZN4User7AllocZLEi ; User::AllocZL(int)
.text:0005AF1C                 MOV     R1, R9
.text:0005AF20                 MOV     R5, R0
.text:0005AF24                 MOV     R2, R6
.text:0005AF28                 MOV     R3, R7
.text:0005AF2C                 STR     R8, [SP,#0x30+var_30]
.text:0005AF30                 BL      sub_5B280
.text:0005AF34 ; ---------------------------------------------------------------------------
.text:0005AF34                 MOV     R0, R5
.text:0005AF38                 BL      _ZN12CleanupStack5PushLEP5CBase ; CleanupStack::PushL(CBase *)
.text:0005AF3C                 MOV     R0, R5
.text:0005AF40                 BL      sub_5BFC4
.text:0005AF44 ; ---------------------------------------------------------------------------
.text:0005AF44                 MOV     R0, R5
.text:0005AF48                 BL      sub_5C338       <-此处调用sub_5C338函数,该函数可以获得IMEI
.text:0005AF4C                 MOV     R0, R5
.text:0005AF50                 BL      sub_5C540       <-关注子函数 sub_5C540
.text:0005AF54 ; ---------------------------------------------------------------------------
.text:0005AF54                 MOV     R0, R5
.text:0005AF58                 BL      sub_6AA30       <-此处调用sub_6AA30函数,该函数可以对 tmp.id 文件操作
.text:0005AF5C ; ---------------------------------------------------------------------------
.text:0005AF5C                 BL      _ZN12CleanupStack3PopEv ; CleanupStack::Pop(void)
.text:0005AF60                 MOV     R0, R5
.text:0005AF64                 SUB     SP, R11, #0x20
.text:0005AF68                 LDMFD   SP, {R5-R9,R11,SP,PC}
.text:0005AF68 ; End of function sub_5AEF0

    看代码发现,对于子函数 sub_5C540 是夹在读取 IMEI 和操作 tmd.id 中间的唯一子函数,感觉可能性很大。

.text:0006E4D4 ; =============== S U B R O U T I N E =======================================
.text:0006E4D4
.text:0006E4D4 ; Attributes: bp-based frame
.text:0006E4D4
.text:0006E4D4 sub_6E4D4                               ; CODE XREF: sub_5C540+110p
.text:0006E4D4
.text:0006E4D4 var_3C          = -0x3C
.text:0006E4D4 var_38          = -0x38
.text:0006E4D4 var_34          = -0x34
.text:0006E4D4 oldR4           = -0x28
.text:0006E4D4 oldR5           = -0x24
.text:0006E4D4 oldR6           = -0x20
.text:0006E4D4 oldR7           = -0x1C
.text:0006E4D4 oldR8           = -0x18
.text:0006E4D4 oldR9           = -0x14
.text:0006E4D4 oldR10          = -0x10
.text:0006E4D4 oldR11          = -0xC
.text:0006E4D4 oldSP           = -8
.text:0006E4D4 oldLR           = -4
.text:0006E4D4
.text:0006E4D4                 MOV     R12, SP
.text:0006E4D8                 STMFD   SP!, {R4-R12,LR,PC}
.text:0006E4DC                 SUB     R11, R12, #4
.text:0006E4E0                 MOV     R6, R0
.text:0006E4E4                 MOV     R4, #0
.text:0006E4E8                 MOV     R10, R1
.text:0006E4EC                 SUB     R5, R11, #0x7C
.text:0006E4F0                 SUB     R9, R11, #0x3C
.text:0006E4F4                 MOV     R8, R4
.text:0006E4F8                 SUB     R7, R11, #0x74
.text:0006E4FC                 SUB     SP, SP, #0x54
.text:0006E500                 LDR     R0, [R0,#0xC]
.text:0006E504                 STR     R4, [R11,#var_3C]
.text:0006E508                 STR     R4, [R11,#var_38]
.text:0006E50C                 STR     R4, [R11,#var_34]
.text:0006E510                 BL      _ZN6TDes164ZeroEv ; TDes16::Zero(void)
.text:0006E514                 LDR     R0, [R6,#0xC]
.text:0006E518                 LDR     R1, [R6,#8]
.text:0006E51C                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0006E520                 LDR     R1, =aScriptDat_spk
.text:0006E524                 MOV     R0, R5
.text:0006E528                 BL      _ZN7TPtrC16C1EPKt ; TPtrC16::TPtrC16(ushort  const*)
.text:0006E52C                 MOV     R1, R5
.text:0006E530                 LDR     R0, [R6,#0xC]
.text:0006E534                 BL      _ZN6TDes166AppendERK7TDesC16 ; TDes16::Append(TDesC16  const&)
.text:0006E538                 MOV     R0, R6
.text:0006E53C                 LDR     R1, [R6,#0xC]
.text:0006E540                 MOV     R2, R9
.text:0006E544                 BL      sub_6D504
.text:0006E548                 MOVL    R3, 0x15A8
.text:0006E550                 STR     R4, [R10,R3]
.text:0006E554                 MOV     R5, R3
.text:0006E558
.text:0006E558 loc_6E558                               ; CODE XREF: sub_6E4D4+10Cj
.text:0006E558                                         ; sub_6E4D4+124j ...
.text:0006E558                 MOV     R1, #0
.text:0006E55C                 MOV     R2, #0x32
.text:0006E560                 MOV     R0, R7
.text:0006E564                 BL      memset
.text:0006E568                 MOV     R0, R6
.text:0006E56C                 MOV     R1, R9
.text:0006E570                 MOV     R2, R7
.text:0006E574                 BL      sub_6D620
.text:0006E578                 CMP     R0, #0
.text:0006E57C                 BEQ     loc_6E648
.text:0006E580                 MOV     R0, R7
.text:0006E584                 BL      eikdlg_254_0
.text:0006E588                 MOV     R1, R0
.text:0006E58C                 MOV     R0, #0
.text:0006E590                 CMP     R0, R1
.text:0006E594                 MOV     R2, R0
.text:0006E598                 BGE     loc_6E5CC
.text:0006E59C
.text:0006E59C loc_6E59C                               ; CODE XREF: sub_6E4D4+F4j
.text:0006E59C                 SUB     R12, R11, #0x2C
.text:0006E5A0                 ADD     R3, R2, R12
.text:0006E5A4                 LDRB    R3, [R3,#-0x48]
.text:0006E5A8                 CMP     R3, #0xD
.text:0006E5AC                 CMPNE   R3, #0x20
.text:0006E5B0                 ADD     R2, R2, #1
.text:0006E5B4                 BEQ     loc_6E5C0
.text:0006E5B8                 CMP     R3, #0xA
.text:0006E5BC                 BNE     loc_6E5CC
.text:0006E5C0
.text:0006E5C0 loc_6E5C0                               ; CODE XREF: sub_6E4D4+E0j
.text:0006E5C0                 CMP     R2, R1
.text:0006E5C4                 ADD     R0, R0, #1
.text:0006E5C8                 BLT     loc_6E59C
.text:0006E5CC
.text:0006E5CC loc_6E5CC                               ; CODE XREF: sub_6E4D4+C4j
.text:0006E5CC                                         ; sub_6E4D4+E8j
.text:0006E5CC                 ADD     R4, R7, R0
.text:0006E5D0                 MOV     R0, R4
.text:0006E5D4                 LDR     R1, =(aInfo_player_st+0xC)
.text:0006E5D8                 BL      _ZNK4CDir5CountEv ; CDir::Count(void)
.text:0006E5DC                 CMP     R0, #0
.text:0006E5E0                 BEQ     loc_6E558
.text:0006E5E4                 MOV     R0, R4
.text:0006E5E8                 LDR     R1, =(aShowend+4)
.text:0006E5EC                 BL      _ZNK4CDir5CountEv ; CDir::Count(void)
.text:0006E5F0                 CMP     R0, #0
.text:0006E5F4                 ADDEQ   R8, R8, #1
.text:0006E5F8                 BEQ     loc_6E558
.text:0006E5FC                 CMP     R8, #0
.text:0006E600                 BEQ     loc_6E65C
.text:0006E604                 CMP     R8, #1
.text:0006E608                 BEQ     loc_6E68C
.text:0006E60C                 CMP     R8, #2
.text:0006E610                 ADDEQ   R2, R10, #0x1440
.text:0006E614                 MOVEQ   R1, R4
.text:0006E618                 ADDEQ   R2, R2, #0x18
.text:0006E61C                 BEQ     loc_6E678
.text:0006E620                 CMP     R8, #3
.text:0006E624                 BEQ     loc_6E6A0
.text:0006E628                 CMP     R8, #4
.text:0006E62C                 BNE     loc_6E558
.text:0006E630                 MOV     R0, R4
.text:0006E634                 BL      atoi
.text:0006E638                 MOVL    R3, 0x15B0
.text:0006E640                 STR     R0, [R10,R3]
.text:0006E644                 B       loc_6E558
.text:0006E648 ; ---------------------------------------------------------------------------
.text:0006E648
.text:0006E648 loc_6E648                               ; CODE XREF: sub_6E4D4+A8j
.text:0006E648                 LDR     R0, [R11,#var_3C]
.text:0006E64C                 CMP     R0, #0
.text:0006E650                 BNE     loc_6E684
.text:0006E654
.text:0006E654 loc_6E654                               ; CODE XREF: sub_6E4D4+1B4j
.text:0006E654                 SUB     SP, R11, #0x28
.text:0006E658                 LDMFD   SP, {R4-R11,SP,PC}
.text:0006E65C ; ---------------------------------------------------------------------------
.text:0006E65C
.text:0006E65C loc_6E65C                               ; CODE XREF: sub_6E4D4+12Cj
.text:0006E65C                 LDR     R3, [R10,R5]
.text:0006E660                 ADD     R2, R3, R3,LSL#1
.text:0006E664                 ADD     R3, R3, #1
.text:0006E668                 STR     R3, [R10,R5]
.text:0006E66C                 RSB     R2, R2, R2,LSL#3
.text:0006E670                 MOV     R1, R4
.text:0006E674                 ADD     R2, R10, R2,LSL#3
.text:0006E678
.text:0006E678 loc_6E678                               ; CODE XREF: sub_6E4D4+148j
.text:0006E678                 MOV     R0, R6
.text:0006E67C
.text:0006E67C loc_6E67C                               ; CODE XREF: sub_6E4D4+1C8j
.text:0006E67C                 BL      sub_6D0FC
.text:0006E680                 B       loc_6E558
.text:0006E684 ; ---------------------------------------------------------------------------
.text:0006E684
.text:0006E684 loc_6E684                               ; CODE XREF: sub_6E4D4+17Cj
.text:0006E684                 BL      hal_1
.text:0006E688                 B       loc_6E654
.text:0006E68C ; ---------------------------------------------------------------------------
.text:0006E68C
.text:0006E68C loc_6E68C                               ; CODE XREF: sub_6E4D4+134j
.text:0006E68C                 ADD     R2, R10, #0x1380
.text:0006E690                 MOV     R1, R4
.text:0006E694                 ADD     R2, R2, #0x30
.text:0006E698                 MOV     R0, R6
.text:0006E69C                 B       loc_6E67C
.text:0006E6A0 ; ---------------------------------------------------------------------------
.text:0006E6A0
.text:0006E6A0 loc_6E6A0                               ; CODE XREF: sub_6E4D4+150j
.text:0006E6A0                 MOV     R1, R4
.text:0006E6A4                 MOV     R0, R6
.text:0006E6A8                 ADD     R2, R10, #0x1500
.text:0006E6AC                 BL      sub_6D0FC
.text:0006E6B0                 B       loc_6E558
.text:0006E6B0 ; End of function sub_6E4D4

但是要为了看懂这个子函数,与之密切的函数 sub_5C338 / sub_6AA30 也要看懂。小弟水平有限,看了很久,连猜带蒙的也没有读懂。也可能是没有找到关键代码。所以在此抛砖引玉,望高手能继续分析。

之后的
5.2 - 开始分析 sub_68E3C
5.3 - 开始分析 .text:0006E02C      LDR     R1, =aLoadsaveTmp__0
看了也没有看懂,仍旧是一头雾水。

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (4)
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
手机程序的分析在论坛里不多啊!自己顶一下!

请高手看一下.这个程序怎么找到关键代码啊!
2008-9-15 17:04
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
对手机软件有兴趣的朋友跟帖说说喽!
2008-9-17 12:27
0
雪    币: 109
活跃值: (438)
能力值: ( LV12,RANK:220 )
在线值:
发帖
回帖
粉丝
4
不搞手机开发
对 相关API 的调用模糊哦
呵呵
2008-10-8 18:17
0
雪    币: 208
活跃值: (10)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
5
内容太多了,没有时间看,但是从你的反汇编来看。跟我有点不同。也许是分析的方法不一样吧。

我的反汇编过程是:
  1:G   -> 到函数处。

  2:ALT+G   -> ALT+V   ->输入1 回车   (看情况1表示Thumb 指令, 0表示ARM指令)

  3:ALT+E + F + D    (注意顺序是按下ALT不放依次再按E/F/D)目的是删除函数,也就是像上面的每一个函数前都会有那些像变量一样的值,删除函数之后,那些像变量一样的值就自动整合到函数内部去了,方便我们阅读。

  4: 选项-常规-反汇编  在机器码字节数上写4  (因为是ARM汇编,最大指令长是4字节,当然Thumb的是2个字节),这样方便我们与原文件的对照也方便我们看指令的编码,因为时常要写一工具软件,当然就离不开编码。

  5:再就是分析。

我们这儿就是这样开始入正题的(只对IDA而言)。

    没有再多看你的分析了。不好意思。
2008-11-7 10:28
0
游客
登录 | 注册 方可回帖
返回
//