zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    给存储过程传递一个表
    Linker problems with Borland builder
    Python内置函数super的不便之处
    接口测试基础
    接口测试工具篇postman
    接口测试工具篇jmeter
    git的使用
    git与pycharm结合使用
    抓包工具fiddler
    sql 中 case when 语法
  • 原文地址:https://www.cnblogs.com/fply/p/8329577.html
Copyright © 2011-2022 走看看