构建一个简单的键盘记录Android应用程序:辅助研究虚拟键盘 [英] Build a simple Keylogger Android Application: Accessibility research for Virtual keyboard

查看:226
本文介绍了构建一个简单的键盘记录Android应用程序:辅助研究虚拟键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图找到一些资源,以建立一个为Android平台(APILevel 17)上的可访问性研究项目,键盘记录程序的Andr​​oid应用程序。

I have been trying to find some resources in order to build a Keylogger Android application for an accessibility research project on the Android platform (APILevel 17).

该应用程序的界面是一个简单的的EditText字段,其中使用用户类型的虚拟屏幕键盘的[在输入设置中选择所需的键盘后] 。

The Interface of the application would be a simple "EditText" field where the user types using the virtual onscreen keyboard [After selecting the required keyboard from the Input Settings].

我的目标是创建为我的应用按键记录数据库(有一个SQLite数据库,因为我很熟悉,但一个简单的CSV文件DB也工作得很好:)!)看起来像下面这样:
(图)

I aim to create a Keylog database for my application (with an SQLite DB because I'm familiar with that, but a simple csv file DB would also work well! :) ) which looks like the following: (Illustration)

因此​​,我需要尽快,因为它是类型化的登录一个新条目每个字符,用时间戳。
我一直在试图与 TextWatcher

Hence I need to log each character on a new entry as soon as it is typed, along with the timestamp. I have been trying to expriment with the "TextWatcher" Class

    EditText KeyLogEditText = (EditText) findViewById(R.id.editTextforKeyLog);
    TextWatcher KeyLogTextWatcher = new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) 
        {   }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,int arg3) 
        {   }

        @Override
        public void afterTextChanged(Editable arg0) {
    // TODO Log the characters in the SQLite DB with a timeStamp etc.
    // Here I call my database each time and insert an entry in the database table. 
    //I am yet to figure out how to find the latest-typed-character by user in the EditText 

        }

我的问题是:


  1. 这是实现这一点?
  2. 正道
  3. 我能获得一个与时间一起输入,并将其插入到数据库SQLite的,我可以在以后获取和分析??一个字符

  4. ,还是有的onkeyup 方法比较有用? [我没有使用过尝试的方法还没有,所以这将是巨大的,如果有人能指出我朝着以此来建立一个键盘记录,如果这是简单的!]

  1. Is this the Right way of Implementing this?
  2. Can I obtain Exactly ONE character that is typed along with the time and insert it into the SQLite DB which I can later obtain and analyse??
  3. Or Would the onKeyUp Method be more useful? [I have not used tried method yet, So it would be great if someone could point me towards using this to build a keylogger if that's simpler!]

*在此先感谢任何人谁可以帮助我以任何方式!

*Thanks in Advance to anyone who can help me in any way!

平硐*

推荐答案

现在您TextWatcher不绑定到的EditText

For now your TextWatcher is not binded to EditText

您应该使用 addTextChangedListener(TextWatcher yourWatcher)您的EditText。
这是我的例子:

You should use addTextChangedListener(TextWatcher yourWatcher) on your EditText. Here is my example:

      smsET.addTextChangedListener(new TextWatcher() {

        public void onTextChanged(CharSequence s, int start, int before, int count) {
        Log.d(TAG, "onTextChanged start :"+start +"  end :"+count);}
        public void beforeTextChanged(CharSequence s, int start, int count,int after) {
            Log.d(TAG, "beforeTextChanged start :"+start +"  after :"+after);
        }

        public void afterTextChanged(Editable s) {
                int lastPosition = s.length()-1;
            char lastChar = s.charAt(lastPosition);
            Log.d(TAG, "afterTextChange last char"+lastChar );
        }

    });

在您的code就应该是这样的:

In your code it should be like this :

KeyLogEditText.addTextChangeListener(KeyLogTextWatcher );

包括在该观察法的每一个由从键盘输入的每一个符号triggerd。
既然你输入后得到posistion你可以伊斯利得到字符已输入

Each of method included in this Watcher is triggerd by entering every single sign from keyboard. Since you get posistion after input you can easly get character that was entered

要你提到的数据存储,共享preferences会比DB更快。 (很多写到DB)如果你的目标是至少11 API,你可以简单地使用StringSet <一个href=\"http://developer.android.com/reference/android/content/Shared$p$pferences.Editor.html#putStringSet%28java.lang.String,%20java.util.Set%3Cjava.lang.String%3E%29\"相对=nofollow> Editor.putStringSet 如果你的目标是降低它也有可能,一些示例:的http://android$c$cmonkey.blogspot.com/2011/07/store-and-get-object-in-android-shared.html

To store data you mentioned, SharedPreferences will be faster than DB. (Many writes to DB) If your target is at least api 11 you can simply use StringSet Editor.putStringSet if your target is lower it is also possible, some example : http://androidcodemonkey.blogspot.com/2011/07/store-and-get-object-in-android-shared.html

这篇关于构建一个简单的键盘记录Android应用程序:辅助研究虚拟键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆