Android Read WhatsApp Data

前端 未结 3 794
感动是毒
感动是毒 2020-12-24 09:24

So far I googled a lot about decrypting whatsapp db file with extension as,

.db.crypt5

but no a

3条回答
  •  青春惊慌失措
    2020-12-24 10:14

    I have done this by using following :

    Root your device and try this code::

    public void copyDbToSdcard()
    {
        try
        {
            String comando = "cp -r /data/data/com.whatsapp/databases/msgstore.db /sdcard/My_Custom_Folder/";
            Process suProcess = Runtime.getRuntime().exec("su");
            DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
            os.writeBytes(comando + "\n");
            os.flush();
            os.writeBytes("exit\n");
            os.flush();
            try
            {
                int suProcessRetval = suProcess.waitFor();
                if(255 != suProcessRetval)
                {
                    //
                }
                else
                {
                    //
                }
            }
            catch (Exception ex)
            {
                Log.e("ERROR-->", ex.toString());
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }  
    
    
        private void openAndQueryDatabase()
    {
        try
        {
            DataBaseHelper dbHelper = new DataBaseHelper(this.getApplicationContext());
            newDB = dbHelper.getWritableDatabase();
    
            Cursor c = newDB.rawQuery("SELECT data FROM messages where data!=''", null);
    
            if(c != null)
            {
                if(c.moveToFirst())
                {
                    do
                    {
    
                        String data = c.getString(c.getColumnIndex("data"));
    
                        results.add(data); //adding to arrayList
    
                    }
                    while (c.moveToNext());
                }
            }
    
                    while (c3.moveToNext());
                }
            }
        }
    
        catch (SQLiteException se)
        {
            Log.e(getClass().getSimpleName(), "Could not create or Open the database");
        }
    }  
    

    And then display results in your TextView or wherever you want.

提交回复
热议问题