2012-09-04 37 views
21

Tôi đã cố gắng sử dụng adb để kéo toàn bộ hộp thư sms/mms khỏi thiết bị nhưng đang gặp một số sự cố. Chiếc điện thoại này được bắt nguồn và tôi đã thử các lệnh sau:sao lưu toàn bộ nội dung sms/mm qua adb

Input

./adb pull /data/data/com.android.providers.telephony/databases/mmssms.db 

đầu ra

Permission denied 

Input

./adb pull su /data/data/com.android.providers.telephony/databases/mmssms.db 

Output

The help menu 

Tôi có thiếu sót trong suy nghĩ của tôi rằng tôi có thể kéo hộp thư đến sms thông qua các lệnh tương tự như những cái tôi đã thử? Nếu nó có thể được thực hiện những gì là sai với lệnh của tôi?

Cảm ơn

Trả lời

34

Một cách để lấy nội dung của thư mục/data là lần đầu tiên sao chép db sql đến một nơi nào đó có thể truy cập, và sau đó sử dụng kéo adb để sao chép từ đó đến máy chủ.

Ví dụ, lệnh sau đây sử dụng cầu android để lấy dữ liệu sms (giả sử nó được chứa trong /data/data/com.android.providers.telephony/databases/mmssms.db):

adb shell 
$ mkdir /mnt/sdcard/tmp 
# su 
# cat /data/data/com.android.providers.telephony/databases/mmssms.db > /mnt/sdcard/tmp/mmssms.db 
# exit 
$ exit 
adb pull /mnt/sdcard/tmp/mmssms.db . 

Bây giờ bạn có mms/cơ sở dữ liệu sms trên máy chủ của bạn, thăm dò để tìm người nhận phổ biến nhất, ví dụ:

sqlite3 -header mmssms.db 'select address from sms' | sort -n | uniq -c | sort -n 

Cuối cùng, dọn dẹp khu vực tạm thời:

adb shell 
$ rm /mnt/sdcard/tmp/mmssms.db 
$ rmdir /mnt/sdcard/tmp 
$ exit 
+2

Phương pháp từng bước tuyệt vời! - cần quyền truy cập root ... – bgs

3

Nhờ câu trả lời của @ Bonlenfum tôi đã có thể đưa ra một tập lệnh có thể tái sử dụng để sao chép bất kỳ tệp/thư mục nào trên thiết bị gốc sang đường dẫn Windows (cục bộ hoặc UNC).


Sửa: Cố định lỗi với đường dẫn chứa dấu cách.


Save the sau như: adbSuPull.bat

@echo off 

SetLocal 
set RemotePath=%~1 
set LocalPath=%~f2 

if [%1] == [] goto Usage 
if "%~1" == "/?" goto Usage 
if not [%3] == [] goto Usage 

:: Replace " " with "\ " (escape spaces) 
set RemotePath=%RemotePath: =\ % 

set TimeStamp=%date:~-4,4%-%date:~-10,2%-%date:~-7,2%_%time:~-11,2%-%time:~-8,2%-%time:~-5,2% 

:: Replace spaces with zeros 
set TimeStamp=%TimeStamp: =0% 

if "%LocalPath%" == "" set LocalPath=adbSuPull_%UserName%_%TimeStamp% 
set SdCardPath=/mnt/sdcard 
set TempPath=%SdCardPath%/adbSuPull_temp_%TimeStamp%/ 

echo. 
echo Copying to temp location "%TempPath%" 
echo. 
adb shell "su -c 'mkdir -p %TempPath%; cp -RLv %RemotePath% %TempPath%'" 

echo. 
echo Copying to destination "%LocalPath%" 
echo. 
adb pull "%TempPath%" "%LocalPath%" 
if ErrorLevel 0 goto Cleanup 

:Error 
echo. 
echo Operation failed. Is USB Storage in use? 
echo. 
pause 
call Cleanup 
exit /b 1 

:Cleanup 
echo. 
echo Removing temp location "%TempPath%" 
echo. 
adb shell "rm -Rf '%TempPath%'" 
exit /b ErrorLevel 

:Usage 
echo. 
echo.adbSuPull ^<RemotePath^> [^<LocalPath^>] 
echo. 
echo Copies files/directories from a rooted Android device to a Windows path. 
echo Author: Ben Lemmond [email protected] 
echo. 
echo. RemotePath (required) Specifies the path to the file or directory on 
echo.       the rooted Android device. 
echo. 
echo. LocalPath (optional) Specifies the destination path. This can be a 
echo.       Windows local path (C:\folder) or a UNC path 
echo.       (\\server\share). 
echo.       Defaults to adbSuPull_%%UserName%%_%%TimeStamp%% 
echo.       in the current working directory. 
exit /b 1 

Cách sử dụng:

adbSuPull <RemotePath> [<LocalPath>] 

Copies files/directories from a rooted Android device to a Windows path. 
Author: Ben Lemmond [email protected] 

    RemotePath (required) Specifies the path to the file or directory on 
         the rooted Android device. 

    LocalPath (optional) Specifies the destination path. This can be a 
         Windows local path (C:\folder) or a UNC path 
         (\\server\share). 
         Defaults to adbSuPull_%UserName%_%TimeStamp% 
         in the current working directory. 
3

Bạn phải từ bỏ privalages gốc ADB trước khi bạn kéo rằng cơ sở dữ liệu

adb root 

adb pull /data/data/com.android.providers.telephony/databases/mmssms.db ./ 
Các vấn đề liên quan