首页
社区
课程
招聘
[求助] 关于ida 里面 伪c代码basic_string 是什么用的
2021-11-16 16:19 7514

[求助] 关于ida 里面 伪c代码basic_string 是什么用的

2021-11-16 16:19
7514

小白提问,可能很白痴,大神别笑哈
我在ida 中看到很多std::__ndk1::basic_string 不知道是干什么的

 

比如:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
void __fastcall Java_o_k_d(_JNIEnv *a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
  unsigned __int64 v5; // x26
  __int64 v6; // x24
  void *v7; // x20
  __int64 v8; // x21
  _JNIEnv *v9; // x19
  const char *v10; // x23
  SecurityLib *v11; // x22
  unsigned __int8 *v12; // x25
  _BYTE *v13; // x1
  unsigned __int64 v14[2]; // [xsp+0h] [xbp-90h]
  void *v15; // [xsp+10h] [xbp-80h]
  unsigned __int64 v16[2]; // [xsp+18h] [xbp-78h]
  void *v17; // [xsp+28h] [xbp-68h]
  char v18; // [xsp+30h] [xbp-60h]
  _BYTE v19[7]; // [xsp+31h] [xbp-5Fh]
  void *v20; // [xsp+40h] [xbp-50h]
  __int64 v21; // [xsp+48h] [xbp-48h]
 
  v5 = _ReadStatusReg(ARM64_SYSREG(3, 3, 13, 0, 2));
  v6 = a3;
  v21 = *(v5 + 40);
  v7 = a5;
  v8 = a4;
  v9 = a1;
  v10 = a1->functions->GetStringUTFChars(&a1->functions, a4, 0LL);
  v11 = v9->functions->GetStringUTFChars(&v9->functions, v7, 0LL);
  v12 = SecurityLib::getInstance(v11);
  std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::basic_string<decltype(nullptr)>(
    v16,
    v10);//----------1-----------
  std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::basic_string<decltype(nullptr)>(
    v14,
    v11);//----------2-----------
  SecurityLib::getRequestString(v12, v16, v14, &v18, v9, v6);
  if ( v14[0] & 1 )
    operator delete(v15);
  if ( v16[0] & 1 )
    operator delete(v17);
  (v9->functions->ReleaseStringUTFChars)(v9, v8, v10);
  (v9->functions->ReleaseStringUTFChars)(v9, v7, v11);
  if ( v18 & 1 )
    v13 = v20;
  else
    v13 = v19;
  (v9->functions->NewStringUTF)(v9, v13);
  if ( v18 & 1 )
    operator delete(v20);
  *(v5 + 40);
}

代码1,2分别用basestring方法 传入的是一个cstring
在ida 可以点击去,好像又不是系统的方法....
如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
unsigned __int64 __fastcall std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::basic_string<decltype(nullptr)>(unsigned __int64 *a1, __int64 a2)
{
  unsigned __int64 *v2; // x19
  __int64 v3; // x20
  unsigned __int64 result; // x0
  unsigned __int64 v5; // x21
  signed __int64 v6; // x19
  unsigned __int64 v7; // x22
  __int64 v8; // x0
  __int64 v9; // x0
 
  v2 = a1;
  *a1 = 0LL;
  a1[1] = 0LL;
  a1[2] = 0LL;
  v3 = a2;
  result = strlen(a2);
  if ( result < 0xFFFFFFFFFFFFFFF0LL )
  {
    v5 = result;
    if ( result >= 0x17 )
    {
      v7 = (result + 16) & 0xFFFFFFFFFFFFFFF0LL;
      v8 = operator new(v7);
      v2[1] = v5;
      v2[2] = v8;
      *v2 = v7 | 1;
      v6 = v8;
    }
    else
    {
      *v2 = 2 * result;
      v6 = v2 + 1;
      if ( !result )
        goto LABEL_7;
    }
    result = memcpy(v6, v3, v5);
LABEL_7:
    *(v6 + v5) = 0;
    return result;
  }
  v9 = std::__ndk1::__basic_string_common<true>::__throw_length_error(v2);
  return Java_o_l_v(v9);
}

所以这不是系统方法吧 basestring 主要做了什么


[培训]内核驱动高级班,冲击BAT一流互联网大厂工 作,每周日13:00-18:00直播授课

收藏
点赞0
打赏
分享
最新回复 (1)
雪    币: 6124
活跃值: (4151)
能力值: ( LV6,RANK:80 )
在线值:
发帖
回帖
粉丝
黑洛 1 2021-11-16 19:36
2
1
basic_string 是std::string 和std::wstring 等的基类,直接看做是普通的std::string或者std::wstring就好
游客
登录 | 注册 方可回帖
返回