smali过滤特定字符串
过滤插入代码:
const-string/jumbo v0, "aaaaaaa"
invoke-static {v0}, Lcom/bihu/insurancerobot/util/filterlog;->bshow(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_0
const-string v0, "aaatag"
const-string v1, "msg"
invoke-static {v0,v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:cond_0
bshow所在smali代码:
.class public Lfilterlog;
.super Ljava/lang/Object;
.source "filterlog.java" # static fields
.field static list_filter:Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/List",
"<",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field # direct methods
.method static constructor <clinit>()V
.locals 1 .prologue
.line 21
invoke-static {}, Lfilterlog;->read()Ljava/util/List; move-result-object v0 sput-object v0, Lfilterlog;->list_filter:Ljava/util/List; return-void
.end method .method public constructor <init>()V
.locals 0 .prologue
.line 15
invoke-direct {p0}, Ljava/lang/Object;-><init>()V return-void
.end method .method public static bshow(Ljava/lang/String;)Z
.locals 5
.param p0, "clsname" # Ljava/lang/String; .prologue
.line 25
const/4 v0, 0x0 .line 27
.local v0, "bret":Z
sget-object v4, Lfilterlog;->list_filter:Ljava/util/List; invoke-interface {v4}, Ljava/util/List;->size()I move-result v2 .line 28
.local v2, "size":I
const/4 v1, 0x0 .local v1, "i":I
:goto_0
if-ge v1, v2, :cond_0 .line 30
sget-object v4, Lfilterlog;->list_filter:Ljava/util/List; invoke-interface {v4, v1}, Ljava/util/List;->get(I)Ljava/lang/Object; move-result-object v3 check-cast v3, Ljava/lang/String; .line 31
.local v3, "substr":Ljava/lang/String;
invoke-virtual {p0, v3}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z move-result v4 if-eqz v4, :cond_1 .line 33
const/4 v0, 0x1 .line 40
.end local v3 # "substr":Ljava/lang/String;
:cond_0
return v0 .line 28
.restart local v3 # "substr":Ljava/lang/String;
:cond_1
add-int/lit8 v1, v1, 0x1 goto :goto_0
.end method .method public static getInnerSDCardPath()Ljava/lang/String;
.locals 1 .prologue
.line 18
invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File; move-result-object v0 invoke-virtual {v0}, Ljava/io/File;->getPath()Ljava/lang/String; move-result-object v0 return-object v0
.end method .method public static read()Ljava/util/List;
.locals 10
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/List",
"<",
"Ljava/lang/String;",
">;"
}
.end annotation .prologue
.line 46
new-instance v0, Ljava/util/ArrayList; invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V .line 47
.local v0, "_list":Ljava/util/List;, "Ljava/util/List<Ljava/lang/String;>;"
invoke-static {}, Lfilterlog;->getInnerSDCardPath()Ljava/lang/String; move-result-object v6 .line 48
.local v6, "sdpath":Ljava/lang/String;
new-instance v8, Ljava/lang/StringBuilder; invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V invoke-virtual {v8, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 const-string/jumbo v9, "/filter" invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v8 invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v3 .line 49
.local v3, "filterpath":Ljava/lang/String;
new-instance v2, Ljava/io/File; invoke-direct {v2, v3}, Ljava/io/File;-><init>(Ljava/lang/String;)V .line 50
.local v2, "f":Ljava/io/File;
const/4 v4, 0x0 .line 51
.local v4, "reader":Ljava/io/BufferedReader;
const/4 v7, 0x0 .line 54
.local v7, "tempstr":Ljava/lang/String;
:try_start_0
new-instance v5, Ljava/io/BufferedReader; new-instance v8, Ljava/io/FileReader; invoke-direct {v8, v2}, Ljava/io/FileReader;-><init>(Ljava/io/File;)V invoke-direct {v5, v8}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
:try_end_0
.catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_3
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1 .line 55
.end local v4 # "reader":Ljava/io/BufferedReader;
.local v5, "reader":Ljava/io/BufferedReader;
:try_start_1
invoke-virtual {v5}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String; move-result-object v7 .line 56
:goto_0
if-eqz v7, :cond_0 .line 58
invoke-interface {v0, v7}, Ljava/util/List;->add(Ljava/lang/Object;)Z
:try_end_1
.catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_0
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2 goto :goto_0 .line 61
:catch_0
move-exception v1 move-object v4, v5 .line 63
.end local v5 # "reader":Ljava/io/BufferedReader;
.local v1, "e":Ljava/io/FileNotFoundException;
.restart local v4 # "reader":Ljava/io/BufferedReader;
:goto_1
invoke-virtual {v1}, Ljava/io/FileNotFoundException;->printStackTrace()V .line 70
.end local v1 # "e":Ljava/io/FileNotFoundException;
:goto_2
return-object v0 .end local v4 # "reader":Ljava/io/BufferedReader;
.restart local v5 # "reader":Ljava/io/BufferedReader;
:cond_0
move-object v4, v5 .line 67
.end local v5 # "reader":Ljava/io/BufferedReader;
.restart local v4 # "reader":Ljava/io/BufferedReader;
goto :goto_2 .line 64
:catch_1
move-exception v1 .line 66
.local v1, "e":Ljava/io/IOException;
:goto_3
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V goto :goto_2 .line 64
.end local v1 # "e":Ljava/io/IOException;
.end local v4 # "reader":Ljava/io/BufferedReader;
.restart local v5 # "reader":Ljava/io/BufferedReader;
:catch_2
move-exception v1 move-object v4, v5 .end local v5 # "reader":Ljava/io/BufferedReader;
.restart local v4 # "reader":Ljava/io/BufferedReader;
goto :goto_3 .line 61
:catch_3
move-exception v1 goto :goto_1
.end method
smali过滤特定字符串的更多相关文章
- asp正则过滤重复字符串的代码
asp下过滤重复字符串的代码,有时候我们需要过滤一些重复的字符串,下面的代码即可解决这个问题 比如 1223445677777778aabbcccccccccc 经过过滤之后就是12345678abc ...
- spyder里的"查找文件里的特定字符串"非常方便
spyder里的"查找文件里的特定字符串"非常方便 快捷键是: ^+shift+F 使用方法: 输入被查找的字符串: 比如: .rcParam, 注意大小写敏感的(默认设置) 回车 ...
- 在Linux下查找文件内容包含某个特定字符串的文件
如何在Linux下查找文件内容包含某个特定字符串的文件? 我的目录下面有test1和test2两个文件夹,里面都含有很多文件,其中test2里面还包含一个test文件夹 我想请问的是,如何通过查找关键 ...
- Linux查找含有特定字符串的文件
Linux查找含有特定字符串的文件命令为grep.以下为详细的使用方法 grep [OPTIONS] PATTERN [FILE...] #实例:递归查找当前文件夹下所有含有test的文件,并显示行号 ...
- 【转载】 C#使用string.Join快速用特定字符串串联起数组
在C#中有时候我们的数组元素需要通过一些特定的字符串串联起来,例如将整形Int数组通过逗号快速串联起来成为一个字符串,可以使用String.Join方法.或者一个字符串string类型数组所有元素快速 ...
- bat批处理 查找替换:批处理如何查找并替换文本里特定字符串中的部分内容
批处理如何查找并替换文本里特定字符串中的部分内容 摘自:http://www.bathome.net/thread-43349-1-1.html 脚本如下: @if()==() echo off &a ...
- Linux 查找当前目录下 包含特定字符串 的所有文件
使用 Linux 经常会遇到这种情况:只知道文件中包含某些特定的字符串,但是不知道具体的文件名.需要根据“特定的字符串”反向查找文件. 示例(路径文件如下): ./miracle/luna/a.txt ...
- Python-查找并保存特定字符串后面的字符串
-- -- 本算法用于查找并存储“特定字符串”后面的字符串. -- 举例: strli = "kaka is li is da is wei !" #用于查找的字符串 sep_li ...
- Python_time库_特定字符串格式的时间、struct_time、时间戳的处理
time库 时间戳:格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数. # time.strptime(),功能:将特定字符串格 ...
随机推荐
- 原生js--元素尺寸、位置和溢出
判断元素尺寸和位置的方法: elem.getBoundingClientRect() // 已验证IE7+.firefox.chrome均支持此方法 该方法返回一个对象(坐标值为视口坐标,不是文档坐 ...
- jQuery队列(一)
jQuery的队列依赖缓存机制事件,它同时是animate的基础. 它不像事件机制.缓存机制.回调机制一样有自己的命名空间,由于比较简单,所以直接挂在到$和jQuery对象上. 它提供的基础方法有: ...
- Android Studio 删除 Module
1.选中Module右击,选择 Open Module Settings,打开Project Structure 窗空.(或者选中Module,按F4打开Project Structure窗口) 2. ...
- linux下的一些操作命令
1.切换到root账号下: su root 输入密码: 2.修改root账号密码: sudo passwd root 输入密码: 3.cat用法: 查看文件内容 cat 文件名 创建文件 ...
- jenkins Email-ext plugin插件中Pre-send Script设置说明
在使用jenkins Email-ext plugin发送邮件时,项目中使用了SVN去同步,发现每次有同步,都会发送邮件,现只想SVN只更新,不发送邮件通知,这就要在Pre-send中做修改 看看官网 ...
- mock server搭建及接口测试简单实例
一.搭建mock server mock工具很多,这里我们选择用简单易操作的moco服务器 使用前必须先安装java,去相关网站下载Standalone Moco Runner 二.使用mock se ...
- Spark2 broadcast广播变量
A broadcast variable. Broadcast variables allow the programmer to keep a read-only variable cached o ...
- ASP.NET Web配置指南
利用ASP.NET,可以指定影响服务器上所有的Web应用程序.仅影响单个的应用程序.影响个别页面.或影响Web应用程序中的个别文件夹的配置设置.可以对编译器选项.调试.用户身份验证.错误消息显示.连接 ...
- Python的全局和局部变量
global1 = " def o(): #global global1; global1=2; print(global1) def p(): print(global1) if __na ...
- This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in
地址:http://stackoverflow.com/questions/18852983/eclipse-reports-rendering-library-more-recent-than-ad ...