我一直在尝试使用adb从设备中完整地取出sms / mms收件箱,但遇到了一些麻烦。电话根植了,我尝试了以下命令:
输入
./adb pull /data/data/com.android.providers.telephony/databases/mmssms.db
输出
Permission denied
输入
./adb pull su /data/data/com.android.providers.telephony/databases/mmssms.db
输出
The help menu
我认为我可以通过类似于我试过的命令拉出短信收件箱吗?如果可以做我的命令有什么问题?
由于
答案 0 :(得分:36)
获取/ data目录内容的一种方法是首先将sqlite数据库复制到可访问的某个位置,然后使用adb pull从那里复制到主机。
例如,以下命令使用android桥来获取短信数据(假设它包含在/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 .
现在您的主机上有mms / sms数据库,可以查找最受欢迎的收件人,例如:
sqlite3 -header mmssms.db 'select address from sms' | sort -n | uniq -c | sort -n
最后,整理临时区域:
adb shell
$ rm /mnt/sdcard/tmp/mmssms.db
$ rmdir /mnt/sdcard/tmp
$ exit
答案 1 :(得分:6)
在拉动数据库之前,您必须提供ADB根权限
adb root
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db ./
答案 2 :(得分:3)
感谢@ Bonlenfum的回答,我能够提出一个可重复使用的脚本,用于将根设备上的任何文件/目录复制到Windows路径(本地或UNC)。
编辑:修正了包含空格的路径的错误。
将以下内容另存为: 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 benlemmond@codeglue.org
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
用法:
adbSuPull <RemotePath> [<LocalPath>]
Copies files/directories from a rooted Android device to a Windows path.
Author: Ben Lemmond benlemmond@codeglue.org
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.