Android逆向之路---让我们试试另一种方法看漫画-(1)

前言

上周博主周末发烧了,所以停更,烧了好几天,不得不说真的是好难受。
所以呢,希望大家也多注意注意身体。多锻炼,毕竟身体才是革命的本钱

本文分析基于:快看漫画5.2.0(52000)
事先说明,这是一个系列,关于快看漫画的系列,不过在今天写看漫画这个系列的时候,博主后面的工作也还没有做呢,也希望在大家的监督之下一点一点的全部完成吧。
ps:避免广告嫌疑,以下统称kk漫画了。

为什么选择这个app?
排名靠前啊,反正就选到了,
有对别的感兴趣的同学也欢迎投稿,博主会尽自己所能,给大家带来点好玩的。

声明

本文对kk漫画只做技术研究,不做商用,如有雷同,概不负责

终极目标

不用kk漫画官方app看漫画,逆向协议,逆向代码,

本次的小目标

找到内部log开关,看看开发者打印了什么重要日志
然后大体看下此app内部都用了什么技术
抓到kk漫画的部分协议,尝试性分析

找到内部log开关

首先下载好app后利用apktool拆包

 apktool d .\com.kuaikan.comic_5.2.0_52000.apk

如你所见,本文使用的是5.2.0版本
内部版本号versionCode: ‘52000’

拆包之后,先看看app包名是com.kuaikan.comic,所以我们主要就看这个文件夹下的大体结构

然后我发现了他的LogUtil类,那就进去看看吧。看到了如下代码,看不懂不要着急,我稍做解释

.line 16
    new-instance v0, Ljava/io/File;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    sget-object v2, Lcom/kuaikan/comic/util/FileUtil;->b:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "/kkmh_debug"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v0

    sput-boolean v0, Lcom/kuaikan/comic/util/LogUtil;->a:Z

博主帮你转java,你再看,看不懂你可以打人,当然是别人啊

public static boolean a = new File(FileUtil.b + "/kkmh_debug").exists()

smali啰哩啰唆,其实转成java就这么一行,
我们就靠直觉,一起来猜,这个FileUtil.b + /kkmh_debug是不是就有很大的概率就是那个debug_log的开关了呢。

我们创建文件试一试,有个疑问?FileUtil.b路径在哪里呢,那我们就跟过去看看

# direct methods
.method static constructor <clinit>()V
    .locals 2

    .prologue
    .line 36
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "/KuaiKan"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/kuaikan/comic/util/FileUtil;->b:Ljava/lang/String;

    return-void
.end method

别着急,博主再帮你手动转成java来看


StringBuilder sb = new StringBuilder();
sb.append(Environemt.getExternalStorageDirectory())
sb.append(|"/KuaiKan");
FileUtil.b = sb.toString();

以上的这些话在方法里面,其实你可以理解为就是类在初始化的时候,虚拟机会执行这些代码,以便于给b赋值初值,这个方法你平时不会自己用到,但是虚拟机会用到啊。

所以呢,按照上面的来说,我们基本上定位好了,那么我就在我的sd卡的根目录创建好了/KuaiKan文件夹,然后里面创建了一个空的kkmh_debug文件。

看看快看漫画大概用了什么技术

其实有一些可能不是kk漫画程序员主动用的,而是引入了一些第三方库,他们自带的,那些我就不一一列举了

  • frecso图片加载框架
  • butterknife
  • 极光推送
  • shareSDK
  • google的zxing二维码识别
  • jakewharton的retrofit2
  • hybird
  • okhttp
  • 七牛云存储

太多了,就不一一列举了,有兴趣大家自己去看

一起去看协议吧

按照上面说的方法,debug log开关就算是打开了,然后我们尝试着请求一个漫画,看看他是不是把所有信息都打印出来了。

我呢,就用一个例子来试试吧。“搜神记”,如图

点击后,我们看log日志,
我截取一些看着比较有用的日志,来贴出来

下面的是他的打点统计日志

03-26 04:14:06.682: D/TrackRouterManger(7288): [ (TrackRouterManger.java:242)#h ] level=2,current node=Node{id=111, parentId=11, path='发现/推荐', page='FindRec', kid.size=2}

一些activity栈的信息

03-26 04:14:06.692: V/ActivityRecordMgr(7288): [ (ActivityRecordMgr.java:102)#d ] -----------------Activity stack begin---------------------
03-26 04:14:06.692: V/ActivityRecordMgr(7288): [ (ActivityRecordMgr.java:105)#d ] Activity Stack[0]com.kuaikan.comic.ui.MainActivity@429f4e08 # lifeState=onPause
03-26 04:14:06.692: V/ActivityRecordMgr(7288): [ (ActivityRecordMgr.java:107)#d ] -----------------Activity stack end-----------------------

此时此刻我的页面是这个样子的,为什么要给大家看这个呢,因为看了页面,才能知道他的数据源获取

数据源如下,已经在log里发现了

我们点击当前页面的开始阅读,然后继续看log。

log如下,log太多了,我就截取一部分关键的了

03-26 04:23:14.672: D/OkHttp(7288): {"code":200,"data":{"comment_view_message":"吐槽神马的尽管来","can_view":true,"cover_image_url":"http://f2.kkmh.com/image/171104/7tmqcg0ho.webp-w750","created_at":1509616533,"recommend":{"recommend_list":[{"male_vertical_image_url":"http://f2.kkmh.com/image/161212/804va2fbp.webp-w320.w","vertical_image_url":"http://f2.kkmh.com/image/161212/804va2fbp.webp-w320.w","recommend_tag":["奇幻","古风","剧情"],"topic_id":885,"recommend_source":"AI推荐","title":"美人为将"},{"male_vertical_image_url":"http://f2.kkmh.com/image/170222/jvwhcv89p.webp-w320.w","vertical_image_url":"http://f2.kkmh.com/image/170222/jvwhcv89p.webp-w320.w","recommend_tag":["古风","穿越"],"topic_id":1035,"recommend_source":"AI推荐","title":"蓬山远"},{"male_vertical_image_url":"http://f2.kkmh.com/image/170922/jlihj7f6n.webp-w320.w","vertical_image_url":"http://f2.kkmh.com/image/170922/jlihj7f6n.webp-w320.w","recommend_tag":["古风","宫斗"],"topic_id":1518,"recommend_source":"AI推荐","title":"妃·夕妍雪"}],"title":"猜你喜欢"},"is_favourite":false,"title":"搜神记:上古神话开启","widgets":[],"recommend_count":0,"updated_at":1509615372,"selling_kk_currency":0,"zoomable":0,"push_flag":1,"previous_comic_id":null,"share":{"award":false,"activity_id":null,"show_draw_record":false,"title":""},"customized_share":[{"description":"改编自树下野狐同名小说《搜神记》,传说中三皇五帝时代,随着天下公认的领袖去世,各族群雄蠢蠢欲动。在此动荡时代,一位少年横空出世,机缘巧合下进入了一个爱恨情仇的古代神话世界……\r\n","share_platform":1,"title":"好看哭!《搜神记》这个漫画太优秀了!","picture":"http://f2.kkmh.com/image/171104/7tmqcg0ho.webp-w750","url":"https://m.kuaikanmanhua.com/comics/57778"},{"description":"改编自树下野狐同名小说《搜神记》,传说中三皇五帝时代,随着天下公认的领袖去世,各族群雄蠢蠢欲动。在此动荡时代,一位少年横空出世,机缘巧合下进入了一个爱恨情仇的古代神话世界……\r\n","share_platform":4,"title":"好看哭!《搜神记》这个漫画太优秀了!","picture":"http://f2.kkmh.com/image/171104/7tmqcg0ho.webp-w750","url":"https://m.kuaikanmanhua.com/comics/57778"},{"description":"改编自树下野狐同名小说《搜神记》,传说中三皇五帝时代,随着天下公认的领袖去世,各族群雄蠢蠢欲动。在此动荡时代,一位少年横空出世,机缘巧合下进入了一个爱恨情仇的古代神话世界……\r\n","share_platform":3,"title":"好看哭!《搜神记》这个漫画太优秀了!","picture":"http://f2.kkmh.com/image/171104/7tmqcg0ho.webp-w750","url":"https://m.kuaikanmanhua.com/comics/57778"},{"description":"好看哭!《搜神记》这个漫画太优秀了!传送门:https://m.kuaikanmanhua.com/comics/57778 ","share_platform":5,"title":"","picture":"http://f2.kkmh.com/image/171104/7tmqcg0ho.webp-w750","url":"https://m.kuaikanmanhua.com/comics/57778"},{"description":"","share_platform":2,"title":"好看哭!《搜神记》这个漫画太优秀了!","picture":"http://f2.kkmh.com/image/171104/7tmqcg0ho.webp-w750","url":"https://m.kuaikanmanhua.com/comics/57778"}],"id":57778,"comic_type":0,"is_login":false,"is_liked":false,"images":["http://p1.kkmh.com/image/c57778/171104/ly6huctjr.webp-c.w1080?sign=abc129032198c237159d029e0715d759&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/gkfv3xx80.webp-c.w1080?sign=3a8807108a14ed9f49a2750dbe168ba3&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/tjc901nwz.webp-c.w1080?sign=a2d7be2867052a445587e21ccb7ee14b&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/5kzfzqffd.webp-c.w1080?sign=6b52f8285c515d8a266af32981bae787&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/cahur12gy.webp-c.w1080?sign=f514ff5bd33c0c6e4f27ec19f55dc919&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/0pigomyew.webp-c.w1080?sign=003061dd0a43130cf177fc3b193b94fb&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/0qfpkk2vk.web
03-26 04:23:14.672: D/OkHttp(7288): kmh.com/image/c57778/171104/ldt0b3mh6.webp-c.w1080?sign=f836b25c6cec5298effaae4fc67576a6&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/ffo7egep9.webp-c.w1080?sign=eb956afe89173b48eece50bae6e5b440&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/psi8565i7.webp-c.w1080?sign=0543fefa2c40dc869e8042ce807ad04a&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/t5scd1m3a.webp-c.w1080?sign=3dbc1ab67096f721d606560f87c31717&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/yd6tw60hx.webp-c.w1080?sign=c41f7038b79a759114f488610bf56b90&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/8fu1zst61.webp-c.w1080?sign=63bb65a0a9a67fa0072475b1b67341b5&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/bmjr223nj.webp-c.w1080?sign=ca09d02f0a6a1839b1bd6ecf009f6cd3&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/zwpd4aqxx.webp-c.w1080?sign=68d5cf64f352656b4e99e5868bf110b4&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/qiw9poat9.webp-c.w1080?sign=c31ff1a362338d37357ed0b6be1d56b7&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/5v7c6ot27.webp-c.w1080?sign=a23052b5c561b5699617039266f76c16&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/h6st3nd4n.webp-c.w1080?sign=7f874a231c23ea71fb6333f3dc986f3f&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/mjpq7cyjc.webp-c.w1080?sign=81aedeaa44ed94956e3fbe67db2cb60a&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/9utqlqmiz.webp-c.w1080?sign=14dd3c96c0c82c7fa18e7bb60df32bab&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/7rbz4ngds.webp-c.w1080?sign=64e436f9c5f80a52b096ad4a619a4854&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/irzb8xzf8.webp-c.w1080?sign=57b4246122d006c79a72c3999bd0ea99&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/63ag2ajch.webp-c.w1080?sign=5c7a6b2c514c1c13166e6b79d74d93d9&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/pzsmr1sls.webp-c.w1080?sign=18e97d8dfad73802d55500a19d1fb7d0&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/ef89i1pdz.webp-c.w1080?sign=f961707f8198e7d37d0d79c88a12a839&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/y2qai7jw2.webp-c.w1080?sign=1e5c7c43613757a19d60cec457f501ee&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/t8wu5827b.webp-c.w1080?sign=1c7cd2cfd8048f1c70867453acf42e2f&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/pmmjncy60.webp-c.w1080?sign=6aae69e1b636686d54e371a5e15b727f&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/pow2olll2.webp-c.w1080?sign=814bb733cc9826731c000e2ff91f66ae&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/4vn79h8y7.webp-c.w1080?sign=bca52794d26cf135de7ce3de91e7e5d9&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/a5p0pd48g.webp-c.w1080?sign=39127851a5b94e657ec5ab253d6f1cf8&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/8jbdc523r.webp-c.w1080?sign=1ab92b8c2a569c1539cd4f9e53ffc81a&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/ov2w7hrih.webp-c.w1080?sign=d0c9b82b207280b359cc8cc04fc1be30&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/v7q7i0tig.webp-c.w1080?sign=871b1aaecc9e32db85831d1eadb02cf3&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/xighrl3a2.webp-c.w1080?sign=f9702db0ca898eb20ffede1821a638b2&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/3nvs5ehm7.webp-c.w1080?sign=797392c3571dee1be605309ada441b00&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/u2dcjj2v9.webp-c.w1080?sign=a35d816c0eac09b2cb1430c6a4ae90b1&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/shwqkh0nb.webp-c.w1080?sign=c03c5bb74a67ced367247526e131d435&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/joaf56gi4.webp-c.w1080?sign=3d2f66d155e362333ae40724ca33bbe9&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/le26yhiwo.webp-c.w1080?sign=9741fcc15f12fe0fba453f018153861c&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/k0cfwj0h6.webp-c.w1080?sign=8b6e0232fa6922522e985272930abdd6&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/dx2f0nr2k.webp-c.w1080?sign=4b95278e39a6d8d868e020ac8b87af47&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/mptqvh12h.webp-c.
03-26 04:23:14.672: D/OkHttp(7288): w1080?sign=093d740152a24175a9f737b396c3b9fb&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/ks8tfc49e.webp-c.w1080?sign=93ec93bee7e709f0ca044f7241d800e4&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/rcow9dctl.webp-c.w1080?sign=84c14293dad2aea2a4334f386de5f676&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/ejjemvlgt.webp-c.w1080?sign=ce253e0f8f1c3ed665c57548e03e88c8&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/6mzzltu91.webp-c.w1080?sign=920ea61288f8e312824cab3523e43a3f&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/20yw7tdpv.webp-c.w1080?sign=e37730a45857f01b60f580bcb62992f2&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/dpqkp2wl0.webp-c.w1080?sign=3e294f3ae32b6db922094e182cc22e7d&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/qfc33d23w.webp-c.w1080?sign=751cc3cc92830a9fe0f1b5fe23f6cecd&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/l5iqe7wnm.webp-c.w1080?sign=1c7bcaf56e0757e9c8a5d26895416e2a&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/mruj2pynw.webp-c.w1080?sign=6851c78caae814ce3993e9f391805d3e&t=5abbf9b2","http://p1.kkmh.com/image/c57778/171104/9p528qqa0.webp-c.w1080?sign=56b08c5c33a22549cd9563f596618fb0&t=5abbf9b2"],"tencent_share_title":"最近发现一部超好看的漫画:搜神记","storyboard_cnt":1,"image_infos":[{"width":1280,"key":"952dfc47a04418776d4d73de2d5368e5","height":1000},{"width":1280,"key":"03d2ab0a6b36ddd29f5b4b1ba78d2127","height":1000},{"width":1280,"key":"2ec602d95c558a211ccd94f37e1770d3","height":500},{"width":1280,"key":"f2db8348b69c27c77ea129157d82db76","height":1000},{"width":1280,"key":"0104a2504d59d41c03bfb311ac6a7ea1","height":1000},{"width":1280,"key":"dca1ee4fd1a24667358b1a55eb30ee66","height":1000},{"width":1280,"key":"15ef78d7753b1c433d590d79b3ccec5e","height":1000},{"width":1280,"key":"7c3d64cf7122a0de3ffd37ddb7aabef5","height":1000},{"width":1280,"key":"a9224c1ffe66c0382e6eee3496c6ab70","height":1000},{"width":1280,"key":"820a413bc6589b532d5854d6c937554e","height":1000},{"width":1280,"key":"63c815ec28692fd721ba7fe1ee8a3bfe","height":1000},{"width":1280,"key":"3430bd74bef55c778cd818b3b4867e5c","height":1000},{"width":1280,"key":"ced4682dd93f24dd4dde06e0d9f7f674","height":1000},{"width":1280,"key":"07b03cb6fcd2f98273815d0b137ff76c","height":1000},{"width":1280,"key":"e1a1b70af35b9fa48872b06fe0753424","height":1000},{"width":1280,"key":"ad4df94db7b48a703e2a7dcd5b7c08f3","height":1000},{"width":1280,"key":"7c4b3caea151bed943465cc35691b43c","height":1000},{"width":1280,"key":"5f7ae4d70cbfef52489f8bd5d95188d6","height":1000},{"width":1280,"key":"e6a07bfaa39d018bbf828fab1cb4f1a4","height":1000},{"width":1280,"key":"c6e794df442df12d3f7e96d8848ce6a5","height":1000},{"width":1280,"key":"b8f120e3fae32412f5ff5e4dee3813de","height":1000},{"width":1280,"key":"2b372a464a9b245ec7b6908e481bc046","height":1000},{"width":1280,"key":"cc07f3d93445a5c0d9e1c011eb9d4348","height":1000},{"width":1280,"key":"2191ed6af451241e4a94ca85782f086b","height":1000},{"width":1280,"key":"3b1bb36b5a010acae4b8a65e8987d79d","height":1000},{"width":1280,"key":"bb98ec1d8098f80898a51bef7bbe64ee","height":1000},{"width":1280,"key":"f59f7a9242f83cfce854773a2a69e67f","height":1000},{"width":1280,"key":"c069854147401d73422a96c8a5b6e273","height":1000},{"width":1280,"key":"a94cbe3fd850e617c1a5d16c87f11516","height":1000},{"width":1280,"key":"2211baa0d6b48dab3dc39caec4248e17","height":1000},{"width":1280,"key":"4c1d022196cecdb26c71ece4f2cd0f23","height":1000},{"width":1280,"key":"969cbcae3ad521ab2a7b2d7bf8a6a0c3","height":1000},{"width":1280,"key":"240aa85af9aa2e68b8f48b1bcbad856f","height":1000},{"width":1280,"key":"85426449db27644dd0ee01f04044d7ff","height":1000},{"width":1280,"key":"446f8ca3b314d9ffa3a57a2a6711190d","height":1000},{"width":1280,"key":"03cc165dab6f0300b8460b4d4147db35","height":1000},{"width":1280,"key":"84b9bb73ea4439b8712cd0448fe6260b","height":1000},{"width":1280,"key":"c62604339652a4619fc593ada3b205ff","height":1000},{"width":1280,"key":"11be18c0a6e28303de60191306e4e9ec","height":1000},{"width":

好了好了,到了这里,相信你就已经发现了,漫画的种种url已经暴露出来了,比如下面这个

http://p1.kkmh.com/image/c57778/171104/pzsmr1sls.webp-c.w1080?sign=18e97d8dfad73802d55500a19d1fb7d0&t=5abbf9b2

http://p1.kkmh.com/image/c57778/171104/ef89i1pdz.webp-c.w1080?sign=f961707f8198e7d37d0d79c88a12a839&t=5abbf9b2

http://p1.kkmh.com/image/c57778/171104/y2qai7jw2.webp-c.w1080?sign=1e5c7c43613757a19d60cec457f501ee&t=5abbf9b2

告一段落

好了好了,其实说到了这里,今天就说到这里吧,具体的如何自己写个工具把一整本书都提取出来,我们可以下次分着说。
慢慢来,别着急。

我希望呢,自己写博客,能够认认真真的写出一点东西分享给大家,而不是网上抄来抄去。希望能做一个踏踏实实做技术的人吧,不敢求太多,能给大家带来点好玩的就挺好。

写在最后

如有雷同,概不负责啊,有什么问题欢迎给博主指出。

关于我

个人网站:MartinHan的小站

博客:hanhan12312的专栏

知乎:MartinHan01