zoukankan      html  css  js  c++  java
  • eclipse + python + monkeyrunner环境搭建

    安装python

    http://pydev.org/updates

    加载python.exe

    jython 加载jython 包 , 加载Hier包 chilm包

    》》》》》》》》》》》》》》》》》》》》》》》》》》

    monkeyrunner 录制回放脚本,保存为mr_rocorder.py

    from com.android.monkeyrunner import MonkeyRunner as mr

    from com.android.monkeyrunner.recorder import MonkeyRecorder as recorder

    device = mr.waitForConnection()

    recorder.start(device)

    运行monkeyrunner mr_rocorder.py

    monkeyplayback.py

     import sys

        com.android.monkeyrunner import MonkeyRunner

        # The format of the file we are parsing is very carfeully constructed.

        # Each line corresponds to a single command. The line is split into 2

        # parts with a | character. Text to the left of the pipe denotes

        # which command to run. The text to the right of the pipe is a python

        # dictionary (it can be evaled into existence) that specifies the

        # arguments for the command. In most cases, this directly maps to the

        # keyword argument dictionary that could be passed to the underlying

        # command.

        # Lookup table to map command strings to functions that implement that

        # command.

        CMD_MAP = {

        ""TOUCH"": lambda dev, arg: dev.touch(**arg),

        ""DRAG"": lambda dev, arg: dev.drag(**arg),

        ""PRESS"": lambda dev, arg: dev.press(**arg),

        ""TYPE"": lambda dev, arg: dev.type(**arg),

        ""WAIT"": lambda dev, arg: MonkeyRunner.sleep(**arg)

        }

        # Process a single file for the specified device.

        def process_file(fp, device):

        for line in fp:

        (cmd, rest) = line.split(""|"")

        try:

        # Parse the pydict

        rest = eval(rest)

        except:

        print ""unable to parse options""

        continue

        if cmd not in CMD_MAP:

        print ""unknown command: "" + cmd

        continue

        CMD_MAP[cmd](device, rest)

        def main(): 

        file = sys.argv[1]

        fp = open(file, ""r"")

        device = MonkeyRunner.waitForConnection()

        process_file(fp, device)

        fp.close();

        if __name__ == ""__main__"":

        main()

    运行monkeyplayback.py + 录制的文件名

    安装findbugs:http://findbugs.cs.umd.edu/eclipse  在eclipse中安装

    使用tcpdump及wireshark 抓包:

    adb push <tcpdump path>  /data/local/tcpdump

    adb shell chmod 6755 /data/local/tcpdump

    adb shell

    cd /data/local

    tcpdump -p -vv -s 0 -w /data/local/capture.pcap

    adb pull /data/local/capture.pcap D:

    分析网络耗时、网络协议 IP地址等

    详细查看TCP、ip协议卷一到卷三

    反编译apk包方法:

    下载apktools工具,终端指向apktools根目录 http://www.newasp.net/soft/68139.html#downloads

    java -jar apktool.jar d xxx.apk

    反编译后生成一个和apk名字一样的文件夹

    重编译:

    java -jar apktools.jar b <反编译出来的文件夹>

    重编译成功后会生成两个文件夹 build 和dist文件夹,重编译的apk保存在dist文件夹中,但是这个apk还不能正常安装,因为apk未签名

    下载re-sign.jar:http://troido.com/downloads/1/category

    下载jex2jar:http://www.hicode.cn/software/View-Software-26981.html

    start jex2jar.sh xxx.apk 生成一个_dex2jar.jar文件

    下载jd-gui工具:http://www.hicode.cn/software/View-Software-26981.html

    使用jd-gui工具打开_dex2jar.jar文件就可查看源代码

  • 相关阅读:
    [EffectiveC++]item22:Declare data members private
    垃圾人定律
    [EffectiveC++]item17:以独立语句将newed对象置入智能指针
    [EffectiveC++]item15:Provide access to raw resources in resource-managing class
    C++ 中operator用法:隐式类型转换
    [EffectiveC++]item13:Use objects to manage resources(RAII)
    为什么拷贝构造函数的参数必须是引用?
    SPF邮件服务器
    raspberry
    bash
  • 原文地址:https://www.cnblogs.com/collect/p/4549368.html
Copyright © 2011-2022 走看看