so分析 a2222()方法的生成sign逻辑
本帖最后由 式神 于 2020-12-22 14:30 编辑新手刚开始学习今天分析一个apk的请求,想知道具体sign算法这是最终生成的字符串```
1608355022,ZZEIl3,f8088ccfbf018256cf164c0463060c22
```
java调用了so的a2222(str)方法 str是一串在java层生成的盐```
tlkyeueq7fej8vtzitt26yl24kswrgm5
```
以下是ida F5后的a2222的具体代码
```
// local variable allocation has failed, the output may be wrong!
jstring __fastcall Java_com_mihoyo_hyperion_net_DamoclesInterceptor_a2222(JNIEnv *env, jobject thiz, jstring jstr)
{
JNIEnv *v3; // r10
jstring v4; // r5
const char *v5; // r0
const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *v6; // r5
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v7; // r0
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > *v8; // r0
__int64 v9; // r4
int v10; // r2
const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *v11; // r1
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v12; // r2
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > *v13; // r0
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v14; // r5
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::pointer v15; // r6
int v16; // r2
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > *v17; // r0
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v18; // r5
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::pointer v19; // r6
int v20; // r2
const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *v21; // r1
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v22; // r2
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > *v23; // r0
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v24; // r5
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::pointer v25; // r6
int v26; // r2
const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *v27; // r1
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v28; // r2
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > *v29; // r0
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v30; // r3
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::pointer v31; // r6
int i; // r2
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > *v33; // r0
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v34; // r3
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::pointer v35; // r6
int j; // r2
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > *v37; // r2
const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *v38; // r1
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v39; // r2
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > *v40; // r0
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::size_type v41; // r5
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::pointer v42; // r6
int k; // r2
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::pointer v44; // r1
_jstring *v45; // r5
jstring result; // r0
int v47; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > v48; //
std::__ndk1::string v49; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > v50; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > v51; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > v52; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > v53; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > __str; //
std::__ndk1::string v55; //
Random v56; //
std::__ndk1::string __lhs; //
struct timeval tv; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > __rhs; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > v60; //
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> > v61; //
int v62; //
v3 = env;
v4 = jstr;
v60.__r_.__value_._anon_0.__l.__cap_ = 0;
*(_QWORD *)&v60.__r_.__value_._anon_0.__r.__words = 0LL;
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::__init(
&v60,
(const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *)"4kswrgm",
7u);
v5 = (const char *)((int (__fastcall *)(JNIEnv *, jstring, _DWORD))v3->functions->GetStringUTFChars)(v3, v4, 0);
v6 = (const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *)v5;
__rhs.__r_.__value_._anon_0.__l.__cap_ = 0;
*(_QWORD *)&__rhs.__r_.__value_._anon_0.__r.__words = 0LL;
v7 = strlen(v5);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::__init(&__rhs, v6, v7);
gettimeofday(&tv, 0);
std::__ndk1::to_string(&__lhs, tv.tv_usec + tv.tv_sec);
Random::random(&v55, &v56);
std::__ndk1::operator+<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>(
&v51,
(const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *)"salt=",
&__rhs);
v8 = std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::append(
&v51,
(const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *)"&t=");
v9 = *(_QWORD *)&v8->__r_.__value_._anon_0.__r.__words;
v10 = 0;
v52.__r_.__value_._anon_0.__l.__cap_ = v8->__r_.__value_._anon_0.__l.__cap_;
*(_QWORD *)&v52.__r_.__value_._anon_0.__r.__words = v9;
while ( v10 != 3 )
*(&v8->__r_.__value_._anon_0.__l.__cap_ + v10++) = 0;
v11 = __lhs.__r_.__value_._anon_0.__l.__data_;
v12 = __lhs.__r_.__value_._anon_0.__l.__size_;
if ( !(__lhs.__r_.__value_._anon_0.__s._anon_0.__size_ & 1) )
{
v11 = __lhs.__r_.__value_._anon_0.__s.__data_;
v12 = (unsigned int)__lhs.__r_.__value_._anon_0.__s._anon_0.__size_ >> 1;
}
v13 = std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::append(
&v52,
v11,
v12);
v14 = v13->__r_.__value_._anon_0.__l.__size_;
v15 = v13->__r_.__value_._anon_0.__l.__data_;
v16 = 0;
v53.__r_.__value_._anon_0.__l.__cap_ = v13->__r_.__value_._anon_0.__l.__cap_;
*(_QWORD *)&v53.__r_.__value_._anon_0.__r.__words = __PAIR__((unsigned int)v15, v14);
while ( v16 != 3 )
*(&v13->__r_.__value_._anon_0.__l.__cap_ + v16++) = 0;
v17 = std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::append(
&v53,
(const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *)"&r=");
v18 = v17->__r_.__value_._anon_0.__l.__size_;
v19 = v17->__r_.__value_._anon_0.__l.__data_;
v20 = 0;
v61.__r_.__value_._anon_0.__l.__cap_ = v17->__r_.__value_._anon_0.__l.__cap_;
*(_QWORD *)&v61.__r_.__value_._anon_0.__r.__words = __PAIR__((unsigned int)v19, v18);
while ( v20 != 3 )
*(&v17->__r_.__value_._anon_0.__l.__cap_ + v20++) = 0;
v21 = v55.__r_.__value_._anon_0.__l.__data_;
v22 = v55.__r_.__value_._anon_0.__l.__size_;
if ( !(v55.__r_.__value_._anon_0.__s._anon_0.__size_ & 1) )
{
v21 = v55.__r_.__value_._anon_0.__s.__data_;
v22 = (unsigned int)v55.__r_.__value_._anon_0.__s._anon_0.__size_ >> 1;
}
v23 = std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::append(
&v61,
v21,
v22);
v24 = v23->__r_.__value_._anon_0.__l.__size_;
v25 = v23->__r_.__value_._anon_0.__l.__data_;
v26 = 0;
__str.__r_.__value_._anon_0.__l.__cap_ = v23->__r_.__value_._anon_0.__l.__cap_;
*(_QWORD *)&__str.__r_.__value_._anon_0.__r.__words = __PAIR__((unsigned int)v25, v24);
while ( v26 != 3 )
*(&v23->__r_.__value_._anon_0.__l.__cap_ + v26++) = 0;
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v61);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v53);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v52);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v51);
CMD5::CMD5((CMD5 *)&v61);
std::__ndk1::operator+<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>(
&v50,
&__lhs,
(const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *)",");
v27 = v55.__r_.__value_._anon_0.__l.__data_;
v28 = v55.__r_.__value_._anon_0.__l.__size_;
if ( !(v55.__r_.__value_._anon_0.__s._anon_0.__size_ & 1) )
{
v27 = v55.__r_.__value_._anon_0.__s.__data_;
v28 = (unsigned int)v55.__r_.__value_._anon_0.__s._anon_0.__size_ >> 1;
}
v29 = std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::append(
&v50,
v27,
v28);
v30 = v29->__r_.__value_._anon_0.__l.__size_;
v31 = v29->__r_.__value_._anon_0.__l.__data_;
v51.__r_.__value_._anon_0.__l.__cap_ = v29->__r_.__value_._anon_0.__l.__cap_;
*(_QWORD *)&v51.__r_.__value_._anon_0.__r.__words = __PAIR__((unsigned int)v31, v30);
for ( i = 0; i != 3; ++i )
*(&v29->__r_.__value_._anon_0.__l.__cap_ + i) = 0;
v33 = std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::append(
&v51,
(const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::value_type *)",");
v34 = v33->__r_.__value_._anon_0.__l.__size_;
v35 = v33->__r_.__value_._anon_0.__l.__data_;
v52.__r_.__value_._anon_0.__l.__cap_ = v33->__r_.__value_._anon_0.__l.__cap_;
*(_QWORD *)&v52.__r_.__value_._anon_0.__r.__words = __PAIR__((unsigned int)v35, v34);
for ( j = 0; j != 3; ++j )
*(&v33->__r_.__value_._anon_0.__l.__cap_ + j) = 0;
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::basic_string(
&v48,
&__str);
v37 = &v48;
CMD5::md5(&v49, (CMD5 *)&v61, *(std::__ndk1::string *)&v47);
v38 = v49.__r_.__value_._anon_0.__l.__data_;
v39 = v49.__r_.__value_._anon_0.__l.__size_;
if ( !(v49.__r_.__value_._anon_0.__s._anon_0.__size_ & 1) )
{
v38 = v49.__r_.__value_._anon_0.__s.__data_;
v39 = (unsigned int)v49.__r_.__value_._anon_0.__s._anon_0.__size_ >> 1;
}
v40 = std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::append(
&v52,
v38,
v39);
v41 = v40->__r_.__value_._anon_0.__l.__size_;
v42 = v40->__r_.__value_._anon_0.__l.__data_;
v53.__r_.__value_._anon_0.__l.__cap_ = v40->__r_.__value_._anon_0.__l.__cap_;
*(_QWORD *)&v53.__r_.__value_._anon_0.__r.__words = __PAIR__((unsigned int)v42, v41);
for ( k = 0; k != 3; ++k )
*(&v40->__r_.__value_._anon_0.__l.__cap_ + k) = 0;
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v49);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v48);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v52);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v51);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v50);
v44 = v53.__r_.__value_._anon_0.__l.__data_;
if ( !(v53.__r_.__value_._anon_0.__s._anon_0.__size_ & 1) )
v44 = v53.__r_.__value_._anon_0.__s.__data_;
v45 = (_jstring *)((int (__fastcall *)(JNIEnv *, std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char> >::pointer))v3->functions->NewStringUTF)(
v3,
v44);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v53);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&__str);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v55);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&__lhs);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&__rhs);
std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>::~basic_string(&v60);
result = (jstring)(_stack_chk_guard - v62);
if ( _stack_chk_guard == v62 )
result = v45;
return result;
}
```
一半看一半猜 salt=tlkyeueq7fej8vtzitt26yl24kswrgm5&t=1608355022&r=ZZEIl3 然后md5加密 结果生成的sign并不对不知道是不是我哪里逻辑理解的有问题现在没有思路了 来问问大家
so的具体文件
链接: https://pan.baidu.com/s/1Z4w-a4A9roySlq5yYR2y6Q 提取码: krv9 复制这段内容后打开百度网盘手机App,操作更方便哦
本帖最后由 syrmb 于 2021-2-11 21:47 编辑
我看了下 没错
可能你salt搞混了
md5 arg: salt=10lh48tgunx1pkv8na4civsm5azb3f2d&t=1613049593&r=7o6io4
retval: 1613049593,7o6io4,7ffd214f40746bd35d07e1144b7b31f2 本帖最后由 式神 于 2021-2-22 10:12 编辑
syrmb 发表于 2021-2-11 21:46
我看了下 没错
可能你salt搞混了
已解决
syrmb 发表于 2021-2-11 21:46
我看了下 没错
可能你salt搞混了
确实是我salt搞混了 感谢我拿着ios抓的包 太不严谨了看来还是要准备一台安卓手机
页:
[1]