吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 867|回复: 1
收起左侧

[Android 讨论] 大工程-快手分享服务apk逆向分析-附源码

[复制链接]
allinall 发表于 2023-7-23 19:54
前言:本次逆向分析已经过开发者允许 3aab00181bdc3c22ef3ab6c7c0ce439.jpg
逛论坛的时候无意间看到一款快手外链提取的app直达原帖
几年前的东西啊,我测试发现时居然还能用
作者也是爽快,直接开源,软件也没任何混淆
但是他发的只有核心部分,本次逆向就尝试脱出全部的lua布局
软件逆向分析一般分为以下几个步骤
1.反编译:将apk文件转换为可读的代码文件。可以使用工具如apktool、dex2jar等来进行反编译操作。这样可以获得apk的资源文件、Java源代码以及编译后的dex文件
2.静态分析:对反编译得到的代码进行分析,查找关键函数、数据结构和逻辑等。可以使用工具如IDA Pro、Ghidra等进行静态分析,也可以手动查看反编译得到的代码
3.动态分析:通过运行apk文件并监视其行为来获得更多信息。可以使用工具如Android Studio的 Profiler、Xposed、Frida等进行动态分析。这可以帮助识别apk的网络请求、敏感信息传输、加密算法等
4.逆向工程:通过修改反编译后的代码或者hook函数来破解apk。这需要对Java和Android框架有一定的了解,并且可能需要使用工具如Xposed、Frida等来帮助hook函数

当然本次分析的app没有任何混淆,是基于fa的源生态写的,所以直接反编译试试,就不需要算法助手这些工具了
首先使用工具如apktool将apk文件反编译为smali代码或者dex文件,这样就可以查看软件的资源文件、布局文件以及Java源代码

尝试用开发者工具看一下具体的页面布局是否属于整体的lua
3c09fef7f63101edceaef3dec4bc9eb(1).jpg 214028cbd1f4fba9edfb927fadd24ea.jpg 属于一个简单的lua界面
功能界面是属于简单的button按钮控制事件
再使用老朋友mt打开
0eed46e6b3d299b90e223485b4a4514(1).jpg 1a00b6e0c33905a6934b4ea93fcf7aa.jpg
使用jeb分析一下
有点乱,用lua工具再次调试

可以分析发现,这个是通过抓包,将快手的视频分享特征抓出来,从而得到外链
最后将所有的lua源码导出(已修复)
本页布局(添加了注释[本人见解])
[Lua] 纯文本查看 复制代码
require"import"
import "android.app.*"
import "android.os.*"
import "android.widget.*"
import "android.view.*"

mygpub=
--主框架
{
  LinearLayout;--线性布局
  layout_width='match_parent';--布局宽度
  layout_height='match_parent';--布局高度
  background='#388E3C';--布局背景颜色(或者图片路径)

  --纵向滚动框架
  {
    ScrollView,
    layout_width="match_parent";
    layout_height="match_parent";
    VerticalScrollBarEnabled=false;

    {
      LinearLayout;--线性布局
      Orientation='horizontal';--布局方向
      layout_width='match_parent';--布局宽度
      layout_height='match_parent';--布局高度
      background='#5D4037';--布局背景颜色


      -- -----------左边竖布局开始--------------
      --左线程框架
      {
        LinearLayout;
        orientation="vertical";
        layout_width="49%w";
        layout_height="match_parent";
        layout_marginLeft="1%w";


        --第一个卡片按钮
        {
          CardView;--卡片控件
          layout_margin='10dp';--卡片边距
          layout_gravity='center';--重力属性
          Elevation='6dp';--阴影属性
          layout_width='45%w';--卡片宽度
          layout_height='45%h';--卡片高度
          radius='8dp';--卡片圆角
          CardBackgroundColor='#616161';--卡片背景颜色
          {
            LinearLayout;--线性布局
            id="l1";
            Orientation='horizontal';--布局方向
            layout_gravity='right';--重力属性
            layout_width='match_parent';--布局宽度
            layout_height='match_parent';--布局高度
            {
              LinearLayout;--线性布局
              layout_width='9%h';--布局宽度
              layout_height='11%h';--布局高度
              {
                CircleImageView;--圆形图片
                layout_marginLeft='3%w';--布局左距
                src='https://p4.a.yximgs.com/ufile/atlas/NTIwNTU5ODI5NzY5MDQxMjAxMF8xNjU3ODkwNTk5OTIz_4.jpg';--图片路径
                layout_width='12%w';--图片宽度
                layout_height='12%w';--图片高度
                layout_gravity='left|center';--重力属性
              };
            };
            {
              LinearLayout;--线性布局
              Orientation='vertical';--布局方向
              layout_gravity='right';--重力属性
              layout_width='match_parent';--布局宽度
              layout_height='match_parent';--布局高度
              {
                LinearLayout;--线性布局
                layout_width='match_parent';--布局宽度
                layout_height='5%h';--布局高度
                {
                  TextView;--文本控件
                  layout_marginTop='2%h';--布局顶距
                  layout_width='match_parent';--文本宽度
                  layout_height='match_parent';--文本高度
                  Gravity='left|center';--重力属性
                  textColor='#FF000000';--文本颜色
                  text='KS分享服务';--显示的文本
                  textSize='16sp';--文本大小
                };
              };
              {
                LinearLayout;--线性布局
                layout_width='match_parent';--布局宽度
                layout_height='6.1%h';--布局高度
                {
                  TextView;--文本控件
                  layout_width='match_parent';--文本宽度
                  layout_height='match_parent';--文本高度
                  Gravity='left';--重力属性
                  textColor='#69000000';--文本颜色
                  text='快手分享服务,支持图片/视频/音频等外链,永久有效';--显示的文本
                  textSize='12sp';--文本大小
                };
              };
            };
          };
          {
            CardView;--卡片控件
            layout_margin='0dp';--卡片边距
            layout_gravity='bottom';--重力属性
            Elevation='0dp';--阴影属性
            layout_width='match_parent';--卡片宽度
            layout_height='2%h';--卡片高度
            radius='0dp';--卡片圆角
            CardBackgroundColor='#9E9E9E';--卡片背景颜色
          };
        };



        --第二个卡片
        {
          CardView;--卡片控件
          layout_margin='10dp';--卡片边距
          layout_gravity='center';--重力属性
          Elevation='6dp';--阴影属性
          layout_width='45%w';--卡片宽度
          layout_height='45%h';--卡片高度
          radius='8dp';--卡片圆角
          CardBackgroundColor='#FF6E40';--卡片背景颜色
          {
            LinearLayout;--线性布局
            id="l2";
            Orientation='horizontal';--布局方向
            layout_gravity='right';--重力属性
            layout_width='match_parent';--布局宽度
            layout_height='match_parent';--布局高度
            {
              LinearLayout;--线性布局
              layout_width='9%h';--布局宽度
              layout_height='11%h';--布局高度
              {
                CircleImageView;--圆形图片
                layout_marginLeft='3%w';--布局左距
                src='https://p4.a.yximgs.com/ufile/atlas/NTIwNTU5ODI5NzY5MDQxMjAxMF8xNjU3ODkwNTk5OTIz_5.jpg';--图片路径
                layout_width='12%w';--图片宽度
                layout_height='12%w';--图片高度
                layout_gravity='left|center';--重力属性
              };
            };
            {
              LinearLayout;--线性布局
              Orientation='vertical';--布局方向
              layout_gravity='right';--重力属性
              layout_width='match_parent';--布局宽度
              layout_height='match_parent';--布局高度
              {
                LinearLayout;--线性布局
                layout_width='match_parent';--布局宽度
                layout_height='5%h';--布局高度
                {
                  TextView;--文本控件
                  layout_marginTop='2%h';--布局顶距
                  layout_width='match_parent';--文本宽度
                  layout_height='match_parent';--文本高度
                  Gravity='left|center';--重力属性
                  textColor='#FF000000';--文本颜色
                  text='分享该应用';--显示的文本
                  textSize='16sp';--文本大小
                };
              };
              {
                LinearLayout;--线性布局
                layout_width='match_parent';--布局宽度
                layout_height='6.1%h';--布局高度
                {
                  TextView;--文本控件
                  layout_width='match_parent';--文本宽度
                  layout_height='match_parent';--文本高度
                  Gravity='left';--重力属性
                  textColor='#69000000';--文本颜色
                  text='把好东西分享给大家,快乐加倍';--显示的文本
                  textSize='12sp';--文本大小
                };
              };
            };
          };
          {
            CardView;--卡片控件
            layout_margin='0dp';--卡片边距
            layout_gravity='bottom';--重力属性
            Elevation='0dp';--阴影属性
            layout_width='match_parent';--卡片宽度
            layout_height='2%h';--卡片高度
            radius='0dp';--卡片圆角
            CardBackgroundColor='#FFFF2F00';--卡片背景颜色
          };
        };

      };--左总线程框架结束
      -- -----------左边竖布局结束--------------




      -- -----------右边竖布局开始--------------
      --右总线程框架开始
      {
        LinearLayout;
        orientation="vertical";
        layout_width="49%w";
        layout_height="match_parent";
        layout_marginRight="1%w";


        --第一个卡片按钮
        {
          CardView;--卡片控件
          layout_margin='10dp';--卡片边距
          layout_gravity='center';--重力属性
          Elevation='6dp';--阴影属性
          layout_width='45%w';--卡片宽度
          layout_height='45%h';--卡片高度
          radius='8dp';--卡片圆角
          CardBackgroundColor='#303F9F';--卡片背景颜色
          {
            LinearLayout;--线性布局
            id="r1";
            Orientation='horizontal';--布局方向
            layout_gravity='right';--重力属性
            layout_width='match_parent';--布局宽度
            layout_height='match_parent';--布局高度
            {
              LinearLayout;--线性布局
              layout_width='9%h';--布局宽度
              layout_height='11%h';--布局高度
              {
                CircleImageView;--圆形图片
                layout_marginLeft='3%w';--布局左距
                src='https://p4.a.yximgs.com/ufile/atlas/NTIwNTU5ODI5NzY5MDQxMjAxMF8xNjU3ODkwNTk5OTIz_3.jpg';--图片路径
                layout_width='12%w';--图片宽度
                layout_height='12%w';--图片高度
                layout_gravity='left|center';--重力属性
              };
            };
            {
              LinearLayout;--线性布局
              Orientation='vertical';--布局方向
              layout_gravity='right';--重力属性
              layout_width='match_parent';--布局宽度
              layout_height='match_parent';--布局高度
              {
                LinearLayout;--线性布局
                layout_width='match_parent';--布局宽度
                layout_height='5%h';--布局高度
                {
                  TextView;--文本控件
                  layout_marginTop='2%h';--布局顶距
                  layout_width='match_parent';--文本宽度
                  layout_height='match_parent';--文本高度
                  Gravity='left|center';--重力属性
                  textColor='#FF000000';--文本颜色
                  text='法律声明';--显示的文本
                  textSize='16sp';--文本大小
                };
              };
              {
                LinearLayout;--线性布局
                layout_width='match_parent';--布局宽度
                layout_height='6.1%h';--布局高度
                {
                  TextView;--文本控件
                  layout_width='match_parent';--文本宽度
                  layout_height='match_parent';--文本高度
                  Gravity='left';--重力属性
                  textColor='#69000000';--文本颜色
                  text='做应用慢原因:写应用花一天,读法规花一年。';--显示的文本
                  textSize='12sp';--文本大小
                };
              };
            };
          };
          {
            CardView;--卡片控件
            layout_margin='0dp';--卡片边距
            layout_gravity='bottom';--重力属性
            Elevation='0dp';--阴影属性
            layout_width='match_parent';--卡片宽度
            layout_height='2%h';--卡片高度
            radius='0dp';--卡片圆角
            CardBackgroundColor='#FF0088C2';--卡片背景颜色
          };
        };



        --第二个卡片
        {
          CardView;--卡片控件
          layout_margin='10dp';--卡片边距
          layout_gravity='center';--重力属性
          Elevation='6dp';--阴影属性
          layout_width='45%w';--卡片宽度
          layout_height='45%h';--卡片高度
          radius='8dp';--卡片圆角
          CardBackgroundColor='#FFF59D';--卡片背景颜色
          {
            LinearLayout;--线性布局
            id="r2";
            Orientation='horizontal';--布局方向
            layout_gravity='right';--重力属性
            layout_width='match_parent';--布局宽度
            layout_height='match_parent';--布局高度
            {
              LinearLayout;--线性布局
              layout_width='9%h';--布局宽度
              layout_height='11%h';--布局高度
              {
                CircleImageView;--圆形图片
                layout_marginLeft='3%w';--布局左距
                src='https://p4.a.yximgs.com/ufile/atlas/NTIwNTU5ODI5NzY5MDQxMjAxMF8xNjU3ODkwNTk5OTIz_2.jpg';--图片路径
                layout_width='12%w';--图片宽度
                layout_height='12%w';--图片高度
                layout_gravity='left|center';--重力属性
              };
            };
            {
              LinearLayout;--线性布局
              Orientation='vertical';--布局方向
              layout_gravity='right';--重力属性
              layout_width='match_parent';--布局宽度
              layout_height='match_parent';--布局高度
              {
                LinearLayout;--线性布局
                layout_width='match_parent';--布局宽度
                layout_height='5%h';--布局高度
                {
                  TextView;--文本控件
                  layout_marginTop='2%h';--布局顶距
                  layout_width='match_parent';--文本宽度
                  layout_height='match_parent';--文本高度
                  Gravity='left|center';--重力属性
                  textColor='#FF000000';--文本颜色
                  text='作者有些话';--显示的文本
                  textSize='16sp';--文本大小
                };
              };
              {
                LinearLayout;--线性布局
                layout_width='match_parent';--布局宽度
                layout_height='6.1%h';--布局高度
                {
                  TextView;--文本控件
                  layout_width='match_parent';--文本宽度
                  layout_height='match_parent';--文本高度
                  Gravity='left';--重力属性
                  textColor='#69000000';--文本颜色
                  text='作者的一些话';--显示的文本
                  textSize='12sp';--文本大小
                };
              };
            };
          };
          {
            CardView;--卡片控件
            layout_margin='0dp';--卡片边距
            layout_gravity='bottom';--重力属性
            Elevation='0dp';--阴影属性
            layout_width='match_parent';--卡片宽度
            layout_height='2%h';--卡片高度
            radius='0dp';--卡片圆角
            CardBackgroundColor='#FFFFE001';--卡片背景颜色
          };
        };



      };--右总线程框架结束
      -- -----------右边竖布局结束--------------



    };--线程布局框架
  };--纵向滚动框架
};--总框架
activity.setContentView(loadlayout(mygpub))

--波纹函数
function 波纹(id,颜色)
  import "android.content.res.ColorStateList"
  local attrsArray = {android.R.attr.selectableItemBackgroundBorderless}
  local typedArray =activity.obtainStyledAttributes(attrsArray)
  ripple=typedArray.getResourceId(0,0)
  Pretend=activity.Resources.getDrawable(ripple)
  Pretend.setColor(ColorStateList(int[0].class{int{}},int{颜色}))
  id.setBackground(Pretend.setColor(ColorStateList(int[0].class{int{}},int{颜色})))
end

分享页lua布局(添加了注释[本人见解])
[Lua] 纯文本查看 复制代码
shamrock=
--布局
{
  LinearLayout;--线性布局
  Orientation='vertical';--布局方向
  layout_width='fill';--布局宽度
  layout_height='fill';--布局高度
  background='https://p4.a.yximgs.com/ufile/atlas/NTIwNTU5ODI5NzY5MDQxMjAxMF8xNjU3ODkwNTk5OTIz_1.jpg';--布局背景颜色(或者图片路径)
  gravity='center';
  {
    StackView;
    id='stack';
    layout_width='900';
    layout_height='900';
  };
};
activity.setContentView(loadlayout(shamrock))
--分享文件
function Sharing(path)
  import "android.webkit.MimeTypeMap"
  import "android.content.Intent"
  import "android.net.Uri"
  import "java.io.File"
  FileName=tostring(File(path).Name)
  ExtensionName=FileName:match("%.(.+)")
  Mime=MimeTypeMap.getSingleton().getMimeTypeFromExtension(ExtensionName)
  intent = Intent();
  intent.setAction(Intent.ACTION_SEND);
  intent.setType(Mime);
  file = File(path);
  uri = Uri.fromFile(file);
  intent.putExtra(Intent.EXTRA_STREAM,uri);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  activity.startActivity(Intent.createChooser(intent, "分享到:"));
end

--分享文字
text="文本"
intent=Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "分享");
intent.putExtra(Intent.EXTRA_TEXT, text);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(Intent.createChooser(intent,"分享到:")); 

作者主页布局(添加了注释[本人见解])
[Lua] 纯文本查看 复制代码
shamrock=
--布局请写在这里
{
  LinearLayout;--线性布局
  Orientation='vertical';--布局方向
  layout_width='fill';--布局宽度
  layout_height='fill';--布局高度
  background='https://p4.a.yximgs.com/ufile/atlas/NTIwNTU5ODI5NzY5MDQxMjAxMF8xNjU3ODkwNTk5OTIz_0.jpg';--布局背景颜色(或者图片路径)
  gravity='center';
  {
    StackView;
    id='stack';
    layout_width='900';
    layout_height='900';
  };
};
activity.setContentView(loadlayout(shamrock))

item={
  LinearLayout;--线性布局
  Orientation='vertical';--布局方向
  layout_width='fill';--布局宽度
  layout_height='fill';--布局高度
  background='#00000000';--布局背景颜色(或者图片路径)
  {
    CardView;--卡片控件
    id='card';
    layout_gravity='center';--重力属性
    Elevation='0';--阴影属性
    layout_width='750';--卡片宽度
    layout_height='750';--卡片高度
    radius='50';--卡片圆角
    CardBackgroundColor='#ff7e5cf8';--卡片背景颜色
    {
      TextView;--文本控件
      id='text';
      layout_width='fill';--文本宽度
      layout_height='fill';--文本高度
      Gravity='center';--重力属性
      textColor='#ffffff';--文本颜色
      text='ONE';--显示的文本
      textSize='20sp';--文本大小
    };
  };
};
--创建项目数组
text_table={'不准翻开!','说了不准翻开!','你!怎么不听话!','你是不是喜欢我???','翻吧翻吧,没有啦!'}
data={}
color_table={0xff7e5cf8,0xff7ef7f8,0xfff65cf8,0xff7e00f8,0xff135cf8}
data={}
--创建适配器
adp=LuaAdapter(activity,data,item)
--添加数据
for n=1,5 do
  table.insert(data,{
    text={
      Text=text_table[n],
    },
    card={
      BackgroundColor=color_table[n],
    },
  })
end
--设置适配器
stack.Adapter=adp

stack.onItemClick=function()
--这里输入点击卡片执行的代码
end

软件核心--提取外链功能(添加了注释[本人见解])
[Lua] 纯文本查看 复制代码
require "import"
import "android.app.*"
import "android.os.*"
import "android.widget.*"
import "android.view.*"
layout={
  LinearLayout;
  layout_height="fill";
  orientation="vertical";
  layout_width="fill";
  {
    Button;
    text="注意事项及使用教程";
    id="bt1";
    layout_gravity="center";
  };
  {
    Button;
    text="点击获取外链";
    id="bt";
    layout_gravity="center";
  };
  {
    LuaWebView;
    layout_width="match_parent";
    id="webView2";
    layout_height="50%h";
    Visibility="2";
  };
  {
    TextView;
    id="txt";
    layout_width="match_parent";
  };
  {
    ListView;
    id="lv";
    layout_height="match_parent";
    layout_width="match_parent";
  };
};


activity.setTheme(android.R.style.Theme_DeviceDefault_Light)--设置md主题
--activity.setTheme(R.AndLua1)
activity.setTitle("外链获取")
activity.setContentView(loadlayout(layout))



import "android.content.Intent"
import "android.net.Uri"



item={
  LinearLayout;
  orientation="vertical";
  {
    TextView;
    id="tx";
    layout_width="match_parent";
  };
};


data={}
adp=LuaAdapter(activity,data,item)
lv.Adapter=adp

bt1.onClick=function
--这里输入点击注意事项及使用教程的执行的代码
end

bt.onClick=function
  adp.clear()

  InputLayout={
    LinearLayout;
    orientation="vertical";
    Focusable=true,
    FocusableInTouchMode=true,


    {
      EditText;
      text="";
      hint="输入视频分享链接";
      layout_marginTop="5dp";
      layout_width="80%w";
      layout_gravity="center",
      id="ed1";
    };
    {
      TextView;
      text="不用去掉文字,仅快手";
      layout_width="match_parent";
    };

  };

  AlertDialog.Builder(this)
  .setTitle("需要获取外链的链接")
  .setView(loadlayout(InputLayout))
  .setPositiveButton("确定",{onClick=function(v)

      n=0
      webView2.loadUrl(ed1.Text)
      webView2.setWebViewClient{

        onLoadResource=function(view,url)

          if (url:find'upic')or (url:find'ufile') then--嗅探关键词,可自行添加
            -- webView2.stopLoading()
            adp.add{tx=url}
            n=n+1
            txt.setText("已获取到"..tostring(n).."条外链,请自行辨认")
          end
        end }



    end})
  .setNegativeButton("取消",nil)
  .show()



end


import "android.content.Context"
lv.onItemClick=function(l,v,p,i)
  url=v.Tag.tx.Text
  activity.getSystemService(Context.CLIPBOARD_SERVICE).setText(url)
  import "android.content.Intent"
  import "android.net.Uri"
  viewIntent = Intent("android.intent.action.VIEW",Uri.parse(url))
  activity.startActivity(viewIntent)
  return true
end

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| allinall 发表于 2023-7-23 19:58
图床不靠谱啊咋无法加载
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-6 05:37

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表