标签:视频去广告 腾讯视频去广告 android反汇编 android
关于反汇编内容,大家还可以参考我这篇博文:http://blog.csdn.net/itleaks/article/details/30342955
1) 小平台应用---由于小平台应用没有能力做自己的广告系统,一般它们会嵌入广告发行商的SDK来显示广告,然后和广告发行商分成。这种广告类型屏蔽有两种:
1. 找出主流广告发行商的广告地址,让其不可访问。将这些网址添加到/etc/hosts里即可。
实例:127.0.0.1 xxx.com
2. 广告要显示,肯定必须得存在某个view里,而一般这个view都是在sdk定义好了的,且是固定的。所以有了第二种方法,找出主流广告发行商广告对应的view,将其摘掉。
2) 视频类大平台应用—由于视频类应用广告投放量大且其本身属于媒体且一般都是财主烧钱类型肯定会构建自己的广告系统。这种广告类型不太可控,只有从程序本身下手。视频类程序都有一个行为---广告加载失败直接播放视频,因此屏蔽方案就是让广告加载失败。
下面以腾讯视频程序为例来实践如何让其广告加载失败:
腾讯视频加载广告的逻辑在smali/com/tencent/ads/view/AdView.smali文件里,在该文件里搜索fail就可知道修改如下函数可以有所作为:
method private handleAdResponse(Lcom/tencent/ads/service/AdResponse;)V ………. invoke-static {v6}, Lcom/tencent/ads/utility/SLog;->v(Ljava/lang/String;)V .line 860 array-length v6, v0 //如果v6不等于0跳转至cond_2,等于0则继续往下走,继续往下走自然就 //会执行fireFailedEvent。我们的目标就是无论如何都让其调用fireFailedEvent //函数。怎么办呢?很简单,去掉这个条件判断即可达到目的 if-nez v6, :cond_2 .line 862 new-instance v6, Lcom/tencent/ads/view/ErrorCode; const/16 v7, 0x65 const-string v8, "no ad for this vid." invoke-direct {v6, v7, v8}, Lcom/tencent/ads/view/ErrorCode;-><init>(ILjava/lang/String;)V iput-object v6, p0, Lcom/tencent/ads/view/AdView;->mErrorCode:Lcom/tencent/ads/view/ErrorCode; .line 863 invoke-direct {p0}, Lcom/tencent/ads/view/AdView;->fireFailedEvent()V修改后:
.line 860 array-length v6, v0 .line 862 new-instance v6, Lcom/tencent/ads/view/ErrorCode; const/16 v7, 0x65 const-string v8, "no ad for this vid." invoke-direct {v6, v7, v8}, Lcom/tencent/ads/view/ErrorCode;-><init>(ILjava/lang/String;)V iput-object v6, p0, Lcom/tencent/ads/view/AdView;->mErrorCode:Lcom/tencent/ads/view/ErrorCode; .line 863 invoke-direct {p0}, Lcom/tencent/ads/view/AdView;->fireFailedEvent()V
apktool b TencentVideo tmp.apk java –jar signapk.jar testkey.x509.pem testkey.pk8 tmp.apk tmp_signed.apk
由于修改后的apk使用的是test签名,和官方的签名冲突,必须保证你的手机上的腾讯视频软件已经卸载
adb install tmp_signed.apk
附录:
完整的操作过程如下:
itleaks@itleaks-a:/tmp$ apktool d TencentVideo.apk I: Baksmaling... I: Loading resource table... I: Loaded. I: Loading resource table from file: /home/itleaks/apktool/framework/1.apk I: Loaded. I: Decoding file-resources... I: Decoding values*/* XMLs... I: Done. I: Copying assets and libs... itleaks@itleaks-a:/tmp$ vi TencentVideo/smali/com/tencent/ads/view/AdView.smali itleaks@itleaks-a:/tmp$ apktool b TencentVideo/ tmp.apk I: Checking whether sources has changed... I: Smaling... I: Checking whether resources has changed... I: Building resources... I: Copying libs... I: Building apk file... itleaks@itleaks-a:/tmp$ java –jar signapk.jar testkey.x509.pem testkey.pk8 tmp.apk tmp_signed.apk
/********************************
* 本文来自博客 “爱踢门”
* 转载请标明出处:http://blog.csdn.net/itleaks
******************************************/
标签:视频去广告 腾讯视频去广告 android反汇编 android
原文地址:http://blog.csdn.net/itleaks/article/details/39692391