聯(lián)通IPTV ZTEB860AV1.2 ADB密碼計算


title: 聯(lián)通IPTV ZTEB860AV1.2 ADB密碼計算
date: 2017-11-17 09:37:31
tags: [iptv,adb,破解]


需求

辦理的聯(lián)通寬帶,增送iptv,可惜一直沒有電視。丈母娘家的小旅館歇業(yè)了,趁個周末就去搬了臺電視回來。當時正值S賽期間,iptv盒子不能裝直播軟件看比賽,確實不爽。

方案

上網(wǎng)研究了半天,發(fā)現(xiàn)這款盒子可以通過打開遠程ADB的方式遠程安裝app。不過開啟遠程ADB卻需要密碼。

原由

論壇上有個“三無”APP,安裝后輸入隨機數(shù)和mac地址可以計算出密碼。出于對“三無”APP缺失安全感,也是因為好奇,決定逆向看看這個密碼是怎么算出來的。

開動吧

apk改后綴名zip,提取so扔進ida。

int __fastcall getHashcode(char *a1, char *a2)
{
  char *v2; // r6@1
  char *v3; // r5@1
  int v4; // r2@1
  int v5; // r3@1
  int v6; // r0@1
  int result; // r0@1
  char s; // [sp+1Ch] [bp-114h]@1
  char v9; // [sp+9Ch] [bp-94h]@1
  int v10; // [sp+11Ch] [bp-14h]@1

  v2 = a1;
  v3 = a2;
  v10 = _stack_chk_guard;
  printf("rand =%s\n", a1);
  printf("mac =%s\n", v3);
  memset(&s, 0, 0x80u);
  memset(&v9, 0, 0x80u);
  _sprintf_chk(&s, 0, 128, "%s%s%s%s%s", "open_ADB", v2, "@", v3, "ZTE_ENCRYPT");
  printf("MD5 %s\n", &s);
  md5_string(&s, (int)&v9, v4, v5);
  printf("chashnum %s\n", &v9);
  v6 = hashcode(&v9);
  printf("%d\n", v6);
  result = hashcode(&v9);
  if ( v10 != _stack_chk_guard )
    _stack_chk_fail(result);
  return result;
}

int __fastcall hashcode(const char *a1)
{
  const char *v1; // r6@1
  int v2; // r0@1
  int v3; // r2@2
  signed int v4; // r12@2
  int v5; // r1@3
  int result; // r0@6
  char s[1024]; // [sp+4h] [bp-414h]@1
  int v8; // [sp+404h] [bp-14h]@1

  v1 = a1;
  v8 = _stack_chk_guard;
  memset(s, 0, 0x400u);
  _strcpy_chk(s, v1, 1024);
  v2 = _strlen_chk(s, 1024);
  if ( v2 )
  {
    v3 = 0;
    v4 = 0;
    do
    {
      v5 = (unsigned __int8)s[v3++];
      v4 = v5 + 31 * v4;
    }
    while ( v3 != v2 );
  }
  else
  {
    v4 = 0;
  }
  result = (v4 ^ (v4 >> 31)) - (v4 >> 31);
  if ( v8 != _stack_chk_guard )
    _stack_chk_fail(result);
  return result;
}

getHashcode函數(shù)參數(shù),a1是隨機數(shù),a2是mac地址。

text = "open_ADB", v2, "@", v3, "ZTE_ENCRYPT"
hash =md5(text)
pass = hashcode(hash)

hashcode就是計算一個校驗值。

后續(xù)

等有時間了,把hashcode的計算改成python仍在web上,做個在線計算。

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容