[HELP PLEASE] can't get acce root with adb shell - G1 Android Development

Hi guys
I've a Dream when i start it up it goes into a locked screen that says “no sim card found i tried to register it with adb shell by typing this:
sqlite3 /data/data/com.android.providers.settings/databases/settings.db “INSERT INTO system (name, value) VALUES (’device_provisioned’, 1);”
i get error no database so i tried another command:
am start -a android.intent.action.MAIN -n com.android.settings/.Settings
it the same a get error type 3
i tried evrything: instazll usb drivers, changing computers, cabales typing all commands by the way when i typing adb shell i get this $ not #
anyone can help me

de_salim said:
Hi guys
I've a Dream when i start it up it goes into a locked screen that says “no sim card found i tried to register it with adb shell by typing this:
sqlite3 /data/data/com.android.providers.settings/databases/settings.db “INSERT INTO system (name, value) VALUES (’device_provisioned’, 1);”
i get error no database so i tried another command:
am start -a android.intent.action.MAIN -n com.android.settings/.Settings
it the same a get error type 3
i tried evrything: instazll usb drivers, changing computers, cabales typing all commands by the way when i typing adb shell i get this $ not #
anyone can help me
Click to expand...
Click to collapse
.... Do you have a sim card in? is it rooted?

Related

[Q] Odd permissions issue with rooted optimus

How come this works:
Code:
[[email protected]:~/android-dev/optimus_m]$ adb shell su -c id
uid=0(root) gid=0(root)
But this:
Code:
[[email protected]:~/android-dev/optimus_m]$ adb shell su -c pm disable com.seven.Z7
Permission denied
Fails?
In the first example superuser prompts for permission and then allows the command, in the second it doesn't prompt and just instantly fails. There are no related saved settings in superuser.
If there isn't a way to fix this, is there another way to execute commands on the phone as root from a script on the host computer?
Nothing?
Looks like I'm on my own. :\

How do I install netflix patch

Hi,
I am rooted now (I guess/hope) I would like to fix it, I have the patch and have tried to copy the libnvomx.so to the lib dir n my TF using file manager HD, but it wont let me paste it, I dont have or seem to have access.
also, is the libnvomx.so the only one I need to copy from the patch?
does this mean I am not rooted?
Is there somewhere/link where I can learn how to, and what terms like adb, push, clear the cache sideload, quickboot, recovery, etc... mean? (search hasnt helped me much with the ones I have looked for, too many results or too few)
thanks for any help,
John
use the terminal emulator, and make sure you "su" before you try to copy.
Another option is Root Explorer: https://market.android.com/details?id=com.speedsoftware.rootexplorer
Root Explorer will allow you to establish write access to system files. It's what I used to get Netflix working on my Transformer
AustinMartin said:
use the terminal emulator, and make sure you "su" before you try to copy.
Click to expand...
Click to collapse
Hi,
Thanks, what is su?
I tried using adb (at dos prompt) I tried
adb push libnvomx.so /system/lib/
it said read only access
will the su give me access? how do I su?
I am not even sure what the terminal emu is?
thanks,
John
I don't know if your rooting added the terminal app to the tf101.
You need to run the su(superuser) command to gain access to the system files.
I think you can run it from adb as well, if you used adb to root, then you probably already used this command.
you can also just download the netflix patch zip to the microsd card, and install the zip from cwm recovery mode.
Xerravon said:
Hi,
Thanks, what is su?
I tried using adb (at dos prompt) I tried
adb push libnvomx.so /system/lib/
it said read only access
will the su give me access? how do I su?
I am not even sure what the terminal emu is?
thanks,
John
Click to expand...
Click to collapse
Close, no cigar:
try this:
adb remount
adb pull /system/lib/libnvomx.so libnvomx.so.orig
adb push libnvomx.so /system/lib/
adb chmod 644 /system/lib/libnvomx.so
adb remount
adb reboot
----
I'm not recalling if you can do an adb chmod, but probably you can so I'll add that in up there just in case it works: Also I added a bit where you get a copy of the original in case this all somehow goes bad.
hachamacha said:
Close, no cigar:
try this:
adb remount
adb pull /system/lib/libnvomx.so libnvomx.so.orig
adb push libnvomx.so /system/lib/
adb chmod 644 /system/lib/libnvomx.so
adb remount
adb reboot
----
I'm not recalling if you can do an adb chmod, but probably you can so I'll add that in up there just in case it works: Also I added a bit where you get a copy of the original in case this all somehow goes bad.
Click to expand...
Click to collapse
hI,
Thanks,
I havnt tried yet but will asap. Where did you learn this stuff? I was reading this thread (I finally looked in general)
http://forum.xda-developers.com/showthread.php?t=872128
It has some info but real detailed, like in your script, the "chmod 644" the 644 part. I guess it takes time, I ave only had this TF for a week or so and it is my first android OS.
thanks again, (I will let you know when I try,
John
edit
Just wondering before I try this, the pull command (Is that backing up the libnvomx file to the pc?
after reading the thread linked above, wont I have to be in adb shell to geet permission to copy the file to the lib dir?
AustinMartin said:
I don't know if your rooting added the terminal app to the tf101.
You need to run the su(superuser) command to gain access to the system files.
I think you can run it from adb as well, if you used adb to root, then you probably already used this command.
Click to expand...
Click to collapse
I used nvflash and adb to install busybox and superuser and su.
I dont know anything about su or superuser, I havent found any threads with info on them yet.
thanks,
It might sound confusing but this is just all basic linux.
when you're running the adb shell just enter su. This gives you permission to edit the /system files
Then pull(copy) the file from your tf101, to your local machine. this is a backup.
Then change the permissions on the file on your tf101.
Then push the new file from your local machine to your tf101.
AustinMartin said:
It might sound confusing but this is just all basic linux.
when you're running the adb shell just enter su. This gives you permission to edit the /system files
Then pull(copy) the file from your tf101, to your local machine. this is a backup.
Then change the permissions on the file on your tf101.
Then push the new file from your local machine to your tf101.
Click to expand...
Click to collapse
Hi,
I broke down and used your script, I tried doing it on my own but kept getting errors. I did seem to get one error in this line of yours
adb chmod 644 /system/lib/libnvomx.so
when I ran it (and I copy and pasted it to dos window)) it gave an error, well not an error but it listed commands and switches like if there is a typo. I dont know if it took the command or not here is a paste
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Kerr Avon>cd adb
The system cannot find the path specified.
C:\Users\Kerr Avon>
C:\Users\Kerr Avon>cd\adb
C:\ADB>adb remount
remount succeeded
C:\ADB>adb pull /system/lib/libnvomx.so libnvomx.so.orig
3429 KB/s (189660 bytes in 0.054s)
C:\ADB>adb push libnvomx.so /system/lib/
1174 KB/s (164764 bytes in 0.137s)
C:\ADB>adb chmod 644 /system/lib/libnvomx.so
Android Debug Bridge version 1.0.26
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <serial number> - directs command to the USB device or emulator with
the given serial number. Overrides ANDROID_SERIAL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
devices - list all connected devices
connect <host>:<port> - connect to a device via TCP/IP
disconnect <host>:<port> - disconnect from a TCP/IP device
device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> [<local>] - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp - list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] [-s] <file> - push this package file to the device and install it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data)
('-s' means install on SD card instead of internal storag
e)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories)
adb bugreport - return all information from the device
that should be included in a bug report.
adb help - show this help message
adb version - show version num
DATAOPTS:
(no option) - don't touch the data partition
-w - wipe the data partition
-d - flash the data partition
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb status-window - continuously print device status for a specified device
adb remount - remounts the /system partition on the device read-write
adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or
recovery program
adb reboot-bootloader - reboots the device into the bootloader
adb root - restarts the adbd daemon with root permissions
adb usb - restarts the adbd daemon listening on USB
adb tcpip <port> - restarts the adbd daemon listening on TCP on the specifie
d port
networking:
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PPP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [ <directory> ]
<localdir> can be interpreted in several ways:
- If <directory> is not specified, both /system and /data partitions will be updated.
- If it is "system" or "data", only the corresponding partition
is updated.
C:\ADB>remount
'remount' is not recognized as an internal or external command,
operable program or batch file.
C:\ADB>adb remount
remount succeeded
C:\ADB>adb reboot
C:\ADB>adb reboot
Click to expand...
Click to collapse
Looks like it probably did work, anyway netflix is running.
some of the lines I tried that didnt work (and did) are here, not sure what was wrong.
adb push libnvomx.so /system/lib/
adb pull /system/lib/libnvomx.so libnvomx.so.orig
(I think push and pull wont work under shell)
*******************************************
cp /system/lib/libnvomx.so removable/microsd/isoa/libnvomx.so.orig
cp /system/lib/libnvomx.so removable/microsd/isoa/libnvomx.so.orig
cp isoa/libnvomx.so /system/lib/libnvomx.so
(dont know why these didnt work, I did su first)
***************************************************************
this worked!!!
cp /system/lib/libnvomx.so sdcard/isoa/libnvomx.so.orig
***************************************************************
cp sdcard/isoa/libnvomx.so system/lib/libnvomx.so
file exists error
********************************************************
Click to expand...
Click to collapse
Oh, so the android runs linux, or a version of it (like ubuntu, freebsd, etc...)? that should help me a lot. I installed ubuntu on one of my PC's a few years back but they didnt have drivers for sli and raid for my system at the time, I played with it a day or 2 and went back to MS. It has always been on the list to do. I am going to have to try it again.
I just looked, it looks like there are lots of new "distro's" (versions) now a day from back when I tried it.
anyway, thank you very much for the help,
John
once you did this:
C:\ADB>adb push libnvomx.so /system/lib/
1174 KB/s (164764 bytes in 0.137s)
you already copied it, so you must have already had permissions. Therefore this next command:
C:\ADB>adb chmod 644 /system/lib/libnvomx.so
Android Debug Bridge version 1.0.26
was redundant anyways. I suspect you needed to run
adb shell chmod 664 /system/lib/libnvomx.so
for adb to run the command on the transformer(shell) rather than in the dos directory.
AustinMartin said:
once you did this:
C:\ADB>adb push libnvomx.so /system/lib/
1174 KB/s (164764 bytes in 0.137s)
you already copied it, so you must have already had permissions. Therefore this next command:
C:\ADB>adb chmod 644 /system/lib/libnvomx.so
Android Debug Bridge version 1.0.26
was redundant anyways. I suspect you needed to run
adb shell chmod 664 /system/lib/libnvomx.so
for adb to run the command on the transformer(shell) rather than in the dos directory.
Click to expand...
Click to collapse
I see, so shell is like I am running it in/from the TF. I guess that is why push and pull doesn't work in shell, it could be confusing??
I downloaded/installed root explorer but I would rather learn it the harder way.
thanks again for your help!!
John
Cool. I wasn't sure about the "adb chmod" working since I'd only done that from a linux shell before this, but it was worth a shot. If you went into adb shell, then typed "mount -o rw,remount /system"; chmod 644 /system/lib/{whatever that file name was}; and mount -o remount,ro the thatt that would work", or I suspect he is right about how you can use "adb shell chmod 644 /../../.....".
Anyway, glad it worked out.
hachamacha said:
Cool. I wasn't sure about the "adb chmod" working since I'd only done that from a linux shell before this, but it was worth a shot. If you went into adb shell, then typed "mount -o rw,remount /system"; chmod 644 /system/lib/{whatever that file name was}; and mount -o remount,ro the thatt that would work", or I suspect he is right about how you can use "adb shell chmod 644 /../../.....".
Anyway, glad it worked out.
Click to expand...
Click to collapse
Hi,
If I shell, do su, then exit the shell (which I couldn't figure out how to do) do the su rights still apply, if I then use adb commands?
mount and remount, I see those are for mounting partitions, do the partitions each have different rights? and what does chmod do?
thanks again,
John
Xerravon said:
Hi,
If I shell, do su, then exit the shell (which I couldn't figure out how to do) do the su rights still apply, if I then use adb commands?
mount and remount, I see those are for mounting partitions, do the partitions each have different rights? and what does chmod do?
thanks again,
John
Click to expand...
Click to collapse
If you did an $su ; # inside the shell (adb shell), then when you typed in exit, that'd exit the shell, and cause any subshell's kicked off with a command (like "su" to pick one from a hat), to 'go away', So no, you wouldn't still be su.
But: There is a 'switch' or setting somewhere that brings up the adb shell in # su mode, but it escapes me right now.
Mount -o remount,rw||ro /{mountshare} (one command) will just remount some partition like system as you direct it to. It will 'outlast' the adb session. If you leave adb after doing a mount -o remount,rw /system, then you've left /system mounted rw. It doesn't hurt anything, but in theory you type in $sync; sync and $ mount -o remount,ro, and then the clean police will be happier.
chmod changes permissions. You could look up the man page on google, and it'll show you that you have 3 groups, owner, group and world. You could do the command in a couple forms, like #chmod {permission mask like 777} {filename} or chmod w+x {filename} where first one gave all permissions (rwe/rwe/rwe) to some file, 2nd gave the world execute permission.
hachamacha said:
If you did an $su ; # inside the shell (adb shell), then when you typed in exit, that'd exit the shell, and cause any subshell's kicked off with a command (like "su" to pick one from a hat), to 'go away', So no, you wouldn't still be su.
But: There is a 'switch' or setting somewhere that brings up the adb shell in # su mode, but it escapes me right now.
Mount -o remount,rw||ro /{mountshare} (one command) will just remount some partition like system as you direct it to. It will 'outlast' the adb session. If you leave adb after doing a mount -o remount,rw /system, then you've left /system mounted rw. It doesn't hurt anything, but in theory you type in $sync; sync and $ mount -o remount,ro, and then the clean police will be happier.
chmod changes permissions. You could look up the man page on google, and it'll show you that you have 3 groups, owner, group and world. You could do the command in a couple forms, like #chmod {permission mask like 777} {filename} or chmod w+x {filename} where first one gave all permissions (rwe/rwe/rwe) to some file, 2nd gave the world execute permission.
Click to expand...
Click to collapse
hI,
Thanks again, this is over my head right now, I am going to do like you say and search Google for a good beginners site. I am thinking about putting linux on my pc also, been wanting to for a while, I think that will help. I do know a lot more than I did when I started the thread
thank you,
John

[HOWTO] Use pattern lock and device encryption

Normally, a pattern/gesture lock is not available when device encryption is activated.
But the lockscreen can be reactivated by changing the corresponding settings in /data/data/com.android.providers.settings/databases/settings.db to the values used for the pattern lock before enabling device encryption, namely resetting lockscreen.password_type to PASSWORD_QUALITY_SOMETHING.
If you don't run Android 4.0.4, you may verify that android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING still corresponds to 0x10000.
Enter a root shell and execute:
Code:
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='65536' WHERE name = 'lockscreen.password_type'"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='1' WHERE name = 'lockscreen.patterneverchosen'"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='1' WHERE name = 'lock_pattern_autolock'"
Generate a new gesture.key with the attached perl script (call it without arguments for help) and transfer it to the device:
Code:
mv gen-gesture.key.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
./gen-gesture.key.pl 01258 > gesture.key
adb push gesture.key /mnt/sdcard/Download/
adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^C
Reboot the device.
This was tested on my Samsung Galaxy S3 with Android 4.0.4.
Thanks to robberknight who initiated a thread about PIN locks and encryption.
Thanks for the post!
I tried this today with my Samsung Galaxy Note 2 but it didn't work (Android 4.1)
The only thing I couldn't do (regarding to your how-to) was using the sqlite3 command from the shell, because there is no sqlite3 on my device (installing it with "SQLite Installer for root" didn't work either, I'm getting a "CANNOT LINK EXECUTABLE" error). So I just pulled the settings.db to my computer, editied it with an sqlite-manager and pushed it back. But I guess this shouldn't make any difference ...
I simply can't get rid of the password unlock screen, no matter what I enter in the sqlite database.
And I would be happy if I could even use a PIN instead of an alphanumeric password (which is the only option for encryption now)
By the way, what did you mean with "If you don't run Android 4.0.4, you may verify that android.app.admin.DevicePolicyManager.PASSWORD_QUA LITY_SOMETHING still corresponds to 0x10000."?
On my phone this constant is 65536
Right now this would be my lock-settings from the settings.db:
"103","lock_after_timeout_rollback","60000"
"35","lock_motion_tilt_to_unlock","0"
"107","lock_pattern_autolock","1"
"108","lock_pattern_visible_pattern","0"
"104","lock_screen_lock_after_timeout","60000"
"94","lock_screen_owner_info","..."
"95","lock_screen_owner_info_enabled","1"
"59","lock_screen_quick_note","1"
"36","lock_signature_visible_pattern","1"
"29","lockscreen.disabled","0"
"109","lockscreen.lockexchange.enable","0"
"34","lockscreen.options","enable_facelock"
"105","lockscreen.password_type","65536"
"106","lockscreen.patterneverchosen","1"
Found the solution on my own: Just delete the /data/system/locksettings.db (this one was empty on my device anyway)
After a restart the lock-keys of settings.db now finally work. I guess there is some caching in place and removing the locksettings.db forces Android to update the settings of the lock-screen.
Hello!
This sounds very interesting.
How to define the unlock pattern:
Does the perl-script create a pattern/gesture that corresponds to the digits you entered. In your example:
gen-gesture.key.pl 01258 > gesture.key - This makes your pattern 01258? (Since there is no dot inte 3x3 pattern matrix to represent a "0" then this cannot be correct.)
How do I define the pattern I want to use then? Is this done separately by going in to the settings later when the phone is booted? I don't dare to do this in fear of "locking" the device with a pattern/gesture that I don't know.
I hope to get your help here...
Thank you!
Thank you very much mod23! My phone is finally usable again
Works as described on Galaxy R with leaked ICS.
-Android Freak- said:
This makes your pattern 01258? (Since there is no dot inte 3x3 pattern matrix to represent a "0" then this cannot be correct.)
Click to expand...
Click to collapse
Was confused at first as well, but running the perl script without arguments tells us:
0 1 2
3 4 5
6 7 8
Afterwards, you won't be able to change it in the settings. I think you have to newly generate the gesture.key
Warning
I do not want to give lessons to anybody, but just to highlight how the unlock pattern protection is low, thwarting almost certainly the extra layer of protection that is supposed to be brought by Android full-phone encryption. Just consider the following remarks:
1) Contrary to a PIN code, pattern lock equivalent digits will be linked to each other (except if you are really really cunning). For example, if you start at digit 0, the following digits are to be 1,4 or 3. Thus decreasing dramatically the entropy of the underlying number.
2) You can't use the same digit two times. As an example, try the greek PHI symbol. The equivalent PIN code can't be 03452147, because 4 can't be used two times. The equivalent code must be simpler: 034521 7. You will agree that this greatly reduces the number of possible equivalent PIN codes you can achieve with pattern lock.
3) The protection mechanism offered by Android is way too weak in my opinion for such lock mechanism. After 3 failed attempts, your phone just ask you to wait for 30 sec. It does not shutdown.
4) But the killing argument is: you have grease under your fingers. Except if you systematically think to wipe the screen of your phone after unlocking your phone, the gesture will let a fingerprint corresponding to the gesture you will repeat several times per day. Try by yourself, and see how easy it is to see the lock pattern used with an oblique light source.
So, if I was to steal your phone to have access to your personal data you think secured by encryption, I would
1) Steal your phone when it is on
2) Realize that it is "protected" by lock pattern
2) Use an oblique light with the almost certainty that I will see the fingerprint of the pattern lock (except if you wipe systematically your screen, or you wash your hands always before unlocking your phone).
3) Try to draw the pattern in one direction.
4) Try it in the other direction if it fails. Almost sure to unlock the phone at this point (except if the pattern is really really intricate).
5) Once your phone is unlocked, I could do whatever I would want to with it. So no need to be the king of crackers.
I hope, after reading this, you will reconsider using pattern lock in parallel to encryption. In my opinion, it is a total nonsense. But it is my only personal opinion. Just judge by yourself.
Edit:
------
For me, the only way, both secure and practical, to secure your phone is by using a PIN code of at least 4 numbers (6 is better). PIN codes let fingerprints much harder to "interpret" than unlock pattern. Then use a handy tool like EncPassChanger to have a true complex password for decryption at boot time. And, if you are clearly paranoid, follow this great tip: http://forum.xda-developers.com/showpost.php?p=26730989&postcount=2.
And, something that people may forget, always double check that USB debugging is disabled.
lolo250612 said:
For me, the only way, both secure and practical, to secure your phone is by using a PIN code of at least 4 numbers (6 is better). PIN codes let fingerprints much harder to "interpret" that unlock pattern. Then use a handy tool like EncPassChanger to have a true complex password for decryption only at boot time. And, if you are clearly paranoid, follow this great tip: http://forum.xda-developers.com/showpost.php?p=26730989&postcount=2.
Click to expand...
Click to collapse
There is one big problem with your solution: The SD card. The SD card is encrypted with your PIN Code as well, which is stored in the same file as your screen-unlock-PIN code. I have no idea why the Google developers choose to use the same file for everything, but they did. So your solution is a good idea as long as you don't care about the security of your SD card.
On my phone (Lenvo A789, with ICS 4.0.4), the sdcards (both internal and external) are not encrypted at all. Only /data and other "system" partitions. You can view them with Terminal Emulator, by typing the mount command. The encrypted partitions correspond to /dev/block/dm-x (x is a number). Just to be clear, I mean "sdcards", the partition /mnt/sdcard or /mnt/sdcard2 as reported by Android and mounted as such.
Anyway. I am certainly not an expert in security. I am just trying to document myself to have an overview of the security mechanisms I use. But, if I am right, your encrypted partitions are not encrypted directly with your password or your PIN code. They are encrypted by a random key generated by Android when you start the encryption process. This master key is then encrypted itself at first by your PIN code (if you choose this option) before being saved in a file. That's what allows the user to change his password without having to re-encrypt everything. And I agree with you, this is a major security flaw, as a password with only digits can be cracked in a few µsec by a casual PC, if somebody has access physically to the content of your phone memory and this key file.
This is where EncPassChanger acts. It reencrypts your master key (not the data itself) with a password that can be complex as you don't type it everytime you unlock your phone.
So you have your PIN code to unlock your phone when it is on ( and only when it is on); it does not decrypt anything, decryption only occurs at boot time; it just gives you access to the UI and allows you to interact with your phone. And you have a strong password for the encryption of the data that lay physically on the memory (even when the phone is off), that allows Android to decrypt your master encryption key at boot, and therefore your data. And the PIN code cannot be used to decrypt your encryption master key any longer.
"Online" protection (phone lock) and "offline" protection (encryption of data lying "physically" on the memory) are really two different things. They become completely disconnected from each other once you use EncPassChanger to make the encryption/decryption password different from the initial PIN code. The only thing you have to be careful about, is that if you change your PIN code for whatever reasons, Android reencrypts the master encryption key with this new PIN code, droping the job done previously by EncPassChanger. So you have to use it again.
And the fact that, for a reason I don't see clearly, your sdcard would be encrypted as well as /data, does not change anything to that.
But I may be wrong, don't I ?
For more extensive details, see: http://nelenkov.blogspot.fr/2012/08/changing-androids-disk-encryption.html and http://source.android.com/tech/encryption/android_crypto_implementation.html
And even more details (Android encryption is in fact more or less Linux LUKS): http://www.markus-gattol.name/ws/dm-crypt_luks.html
Confirmed working on Nexus 10 and Nexus 4 with 4.2.2
Check for records in settings.db first!
If they don't exist, use this method.
On newer devices, the fields above do not exist in the settings.db file once encryption has been activated. The proper way to do this for a device is to confirm the settings are there, and if not, go through the below process (note the INSERTs instead of UPDATEs).
Create gesture.key using the Perl script and copy to SDCARD
Ensure device is unlocked and keep screen active while running the below code. If the device locks, you can get stuck on a black screen after removing /data/system/locksettings.db.
Run the below code.
Code:
su -
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lockscreen.password_type', '65536')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lockscreen.patterneverchosen', '1')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lock_pattern_autolock', '1')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lock_pattern_visible_pattern', '1')"
cat /mnt/sdcard/gesture.key > /data/system/gesture.key
rm /data/system/locksettings.*
Reboot
Lastly, combine with EncPassChanger to use a 20+ character encryption password at boot to ease your mind about brute force attempts.
Thanks,
Ben
Fmstrat said:
Confirmed working on Nexus 10 and Nexus 4 with 4.2.2
Check for records in settings.db first!
If they don't exist, use this method.
On newer devices, the fields above do not exist in the settings.db file once encryption has been activated. The proper way to do this for a device is to confirm the settings are there, and if not, go through the below process (note the INSERTs instead of UPDATEs).
Create gesture.key using the Perl script and copy to SDCARD
Ensure device is unlocked and keep screen active while running the below code. If the device locks, you can get stuck on a black screen after removing /data/system/locksettings.db.
Run the below code.
Code:
su -
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lockscreen.password_type', '65536')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lockscreen.patterneverchosen', '1')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lock_pattern_autolock', '1')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lock_pattern_visible_pattern', '1')"
cat /mnt/sdcard/gesture.key > /data/system/gesture.key
rm /data/system/locksettings.*
Reboot
Lastly, combine with EncPassChanger to use a 20+ character encryption password at boot to ease your mind about brute force attempts.
Thanks,
Ben
Click to expand...
Click to collapse
Thanks for the update. I want to give this a try on my Razr Maxx HD running 4.1.1, any idea if this will work? Also, in your info here, your code says:
Code:
('lockscreen.password_type', '65536')"
But isn't it impossible to use the same number twice? Not sure I understand this correctly if that is a true pattern lock sequence.
gadsden said:
Thanks for the update. I want to give this a try on my Razr Maxx HD running 4.1.1, any idea if this will work? Also, in your info here, your code says:
Code:
('lockscreen.password_type', '65536')"
But isn't it impossible to use the same number twice? Not sure I understand this correctly if that is a true pattern lock sequence.
Click to expand...
Click to collapse
I don't see any reason why it wouldn't work, but of course, no guarantees. As for the password_type, 65536 is a code saying "use the pattern lock", it is not the same as the string of numbers used with the python file to create your gesture.key file.
Thanks,
Ben
Fmstrat said:
Confirmed working on Nexus 10 and Nexus 4 with 4.2.2
Check for records in settings.db first!
If they don't exist, use this method.
On newer devices, the fields above do not exist in the settings.db file once encryption has been activated. The proper way to do this for a device is to confirm the settings are there, and if not, go through the below process (note the INSERTs instead of UPDATEs).
Create gesture.key using the Perl script and copy to SDCARD
Ensure device is unlocked and keep screen active while running the below code. If the device locks, you can get stuck on a black screen after removing /data/system/locksettings.db.
Run the below code.
Code:
su -
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lockscreen.password_type', '65536')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lockscreen.patterneverchosen', '1')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lock_pattern_autolock', '1')"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) values ('lock_pattern_visible_pattern', '1')"
cat /mnt/sdcard/gesture.key > /data/system/gesture.key
rm /data/system/locksettings.*
Reboot
Lastly, combine with EncPassChanger to use a 20+ character encryption password at boot to ease your mind about brute force attempts.
Thanks,
Ben
Click to expand...
Click to collapse
Ok, I'm ready to do this, but I am afraid I have no idea what I'm doing! I couldn't find the settings.db like you said might happen. I tried running the perl script, but got permission denied when it tried to create /data/system/gesture.key. It did create the key and push it to the device, but then it stopped there.
After I verified it did push the gesture.key, I tried running the sqlite3 code in root shell. Some of the commands said adb does not recognize this command as an internal or external command. I have never ran commands like the ones shown here for sqlite3. My adb experience is pretty limited to following directions to root. I have done manual roots in adb, so I understand some basic commands, but this is out of my league! Can you help me a little bit to do this with some steps that are more beginner-ish? If you can help me out (PM is fine), I'll be glad to type out the instructions in an organized way for others to follow in the future. I really want to be able to set this up, any help would be greatly appreciated.
Ok, I think I need to stop messing with this now, been working on it all day! I ran all the sqlite3 commands you said, and got stuck at the cat command. It says no such file or directory. I think I did the perl script wrong and never got the gesture key done right. It pushed a file called gesture.key, but I don't know if it's right. I am not sure how to run the perl script, really. I have to get back to my job that I haven't done anything at today, yikes! Any help is appreciated.
Ok, I didn't quite understand the concept of how this worked yesterday, so I spent some more time on it today. I thought the perl script was to be ran from the PC. I didn't understand that I was supposed to be loosely following the steps in the other thread referenced here. Having no experience whatsoever with python, I didn't know what to do. Now, I understand the process, I am just having a little trouble. So far I have followed these instructions.
Fmstrat said:
Check for records in settings.db first!
If they don't exist, use this method.
Click to expand...
Click to collapse
I looked and could not find this, so I proceeded as described.
azoom1 said:
1) Load SLA4
2) Menu-View-Interpreters
3) Menu-Add
4) Select Python 2.6.2 - the SLA4 app will go get Python and intall it with the correct linking
5) Exit SLA4, then start Python and select Install, and when finished, exit Python
6) Put the pin_change.py file in the SLA4 "scripts" directory
7) Start SLA4
After that, when SLA4 is run you should see the script in the pick list. Upon selection SLA4 will pop-up an icon select-list. Pick the gear, which will run the script.
Click to expand...
Click to collapse
(I pasted this from the other thread, I did not use the script name here, I did use gen-gesture.key.py)
I installed SLA4 as described here and went to run the script with the gear icon. When I run it, all I get is a notification that gen-gesture.key.py was exited. Reading that I am supposed to generate the key, then copy it to the SD card, I thought maybe it did generate the gesture.key and I just have to find it, but I looked everywhere through files and couldn't find the file anywhere. I did locate a log file, gen-gesture.key.py.log, but it was blank, nothing to see.
Thinking there might have been a problem with the script, I tried to use the QR code here, but python said "Invalid QR code content". I double checked my script and I don't appear to have missed anything when I copied it, so I am lead to believe there is something else I am missing about how to use python. Only other thing I can think of that's wrong is the script extension, I used .py to run it in python, but wonder if it's supposed to be .pl since it's perl, or if I need .py to run it in python and the script runs as a perl script like that.
So, I am trying really hard to do this, I'm trying to learn on my own, but a little help would be really nice if anyone is able.
Bumped for help!
gadsden said:
Bumped for help!
Click to expand...
Click to collapse
You should not need to follow any directions in another thread. The Perl script is intended to be run on a PC, not on the phone, so there is no need for Perl to be installed. Running the script with out any arguments prints out the pattern of the android lock screen but instead of dots it has numbers. Run the script with the numbers after it as provided in the example in post number 1 to create the gesture.key file on your PC. Then copy that file over to the phone as described.
I'm also a little confused by your comment about not finding settings.db. I can think of no reason why the file would not exist, unless you mean that the records were not in the database file.
Thanks,
Ben
Fmstrat said:
You should not need to follow any directions in another thread. The Perl script is intended to be run on a PC, not on the phone, so there is no need for Perl to be installed. Running the script with out any arguments prints out the pattern of the android lock screen but instead of dots it has numbers. Run the script with the numbers after it as provided in the example in post number 1 to create the gesture.key file on your PC. Then copy that file over to the phone as described.
I'm also a little confused by your comment about not finding settings.db. I can think of no reason why the file would not exist, unless you mean that the records were not in the database file.
Thanks,
Ben
Click to expand...
Click to collapse
You said to check for records in settings.db first. When I search through my files, I can locate the directory data/data/com.android.providers.settings, but there is nothing inside of it. So, I did run the sqlite codes. I ran each line separately, and it said Error:too many options. So, I ran them all together and no errors came back. However, I still can't find anything in the directory.
Then to run the script, there is an attached file here called gen-gesture.key.pl.txt. Am I supposed to put that file into my platform tools folder and use the mv gen-gesture.key code to call the script? Or do I paste the text in the txt file into adb? I have tried running everything explained here in root shell in adb, I thought that was how I am supposed to do it, but I seem to be missing something. Sorry for the basic questions, but I'm still learning here.
Fmstrat said:
You should not need to follow any directions in another thread. The Perl script is intended to be run on a PC, not on the phone, so there is no need for Perl to be installed. Running the script with out any arguments prints out the pattern of the android lock screen but instead of dots it has numbers. Run the script with the numbers after it as provided in the example in post number 1 to create the gesture.key file on your PC. Then copy that file over to the phone as described.
I'm also a little confused by your comment about not finding settings.db. I can think of no reason why the file would not exist, unless you mean that the records were not in the database file.
Thanks,
Ben
Click to expand...
Click to collapse
Here's what I did so far.
1) Installed perl because it wasn't on my computer
2) changed permissions on /data/data/com.android.providers.settings/databases/settings.db to 777 so I could view the files in DDMS. Checked the settings.db and when I outputted it as a text file, all I got was a blank document
3) installed sqlite3 on my phone with sqlite installer
4) Entered root shell and entered
Code:
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='65536' WHERE name = 'lockscreen.password_type'"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='1' WHERE name = 'lockscreen.patterneverchosen'"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='1' WHERE name = 'lock_pattern_autolock'"
I didn't know if I was supposed to run each line individually, or all at once, so I did it both ways. neither one had an error
5) Saved the gen-gesture.key.pl.txt file to my platform tools folder. Ran
Code:
perl gen.gesture.key.pl.txt
It came back with this
Code:
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>perl C:\Android\ad
t-bundle-windows-x86-20130219\sdk\platform-tools\gen-gesture.key.pl.txt
Usage: gen-gesture.key.pl <sequence>
With sequence as number sequence drawn on this keypad:
0 1 2
3 4 5
6 7 8
The generated binary output has to be put into: /data/system/gesture.key
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>
6) then entered this all at once
Code:
mv gen-gesture.key.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
./gen-gesture.key.pl 01258 > gesture.key
adb push gesture.key /mnt/sdcard/Download/
adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^C
it came back with a bunch of errors and left me at root shell. I figured maybe I was supposed to run it from root shell anyway, so I entered it again. The very first command came back as "mv" is not a recognized internal or external command. I tried it a couple more times, but I'm not following what's supposed to happen here. I did do a reboot of the phone and when I did so, the lock settings were disabled. So, something is happening, but not everything that needs to. I I've probably spent over 12 hours on this over the past week and I am sure I'm doing it wrong. The OP doesn't describe in detail how a beginner needs to do this. I've learned as much as I can, but seeing as how I even got stuck on not knowing I needed to install perl, I'm positive that I'm missing more. The post just isn't beginner friendly. I'm trying hard to understand this but I'm becoming really discouraged here. Can someone provide a little more info here.
Here's the whole session if it helps
Code:
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>perl C:\Android\ad
t-bundle-windows-x86-20130219\sdk\platform-tools\gen-gesture.key.pl.txt
Usage: gen-gesture.key.pl <sequence>
With sequence as number sequence drawn on this keypad:
0 1 2
3 4 5
6 7 8
The generated binary output has to be put into: /data/system/gesture.key
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>mv gen-gesture.key
.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
'mv' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>./gen-gesture.key.
pl 01258 > gesture.key
'.' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb push gesture.k
ey /mnt/sdcard/Download/
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^Csu -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
[email protected]:/ $ su -
re.key > /data/system/gesture.key <
[email protected]:/ # mv gen-gesture.key.pl.txt gen-gesture.key.pl && chmod +x gen-g
esture.key.pl
./gen-gesture.key.pl 01258 > gesture.key
adb push gesture.key /mnt/sdcard/Download/
adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
n-gesture.key.pl && chmod +x gen-gesture.key.pl <
sh: ^Cmv: not found
adb push gesture.key /mnt/sdcard/Download/
adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
127|[email protected]:/ # ./gen-gesture.key.pl 01258 > gesture.key
sh: can't create gesture.key: Read-only file system
1|[email protected]:/ # adb push gesture.key /mnt/sdcard/Download/
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
error: device not found
1|[email protected]:/ # adb shell
error: device not found
1|[email protected]:/ # su -
re.key > /data/system/gesture.key <
[email protected]:/ #
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>mv gen-gesture.key
.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
'mv' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>./gen-gesture.key.
pl 01258 > gesture.key
'.' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb push gesture.k
ey /mnt/sdcard/Download/
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^Csu -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
[email protected]:/ $ su -
re.key > /data/system/gesture.key <
[email protected]:/ # exit
^Cexit
sh: ^Cexit: not found
127|[email protected]:/ # exit
exit
127|[email protected]:/ $ exit
exit
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>mv gen-gesture.key
.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
'mv' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>./gen-gesture.key.
pl 01258 > gesture.key
'.' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb push gesture.k
ey /mnt/sdcard/Download/
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^Csu -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
[email protected]:/ $ su -
re.key > /data/system/gesture.key <
[email protected]:/ #
Been working on this for a whole week now, just wondering if I'm even on the right track here?
gadsden said:
Here's what I did so far.
1) Installed perl because it wasn't on my computer
2) changed permissions on /data/data/com.android.providers.settings/databases/settings.db to 777 so I could view the files in DDMS. Checked the settings.db and when I outputted it as a text file, all I got was a blank document
3) installed sqlite3 on my phone with sqlite installer
4) Entered root shell and entered
Code:
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='65536' WHERE name = 'lockscreen.password_type'"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='1' WHERE name = 'lockscreen.patterneverchosen'"
sqlite3 -batch /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='1' WHERE name = 'lock_pattern_autolock'"
I didn't know if I was supposed to run each line individually, or all at once, so I did it both ways. neither one had an error
5) Saved the gen-gesture.key.pl.txt file to my platform tools folder. Ran
Code:
perl gen.gesture.key.pl.txt
It came back with this
Code:
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>perl C:\Android\ad
t-bundle-windows-x86-20130219\sdk\platform-tools\gen-gesture.key.pl.txt
Usage: gen-gesture.key.pl <sequence>
With sequence as number sequence drawn on this keypad:
0 1 2
3 4 5
6 7 8
The generated binary output has to be put into: /data/system/gesture.key
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>
6) then entered this all at once
Code:
mv gen-gesture.key.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
./gen-gesture.key.pl 01258 > gesture.key
adb push gesture.key /mnt/sdcard/Download/
adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^C
it came back with a bunch of errors and left me at root shell. I figured maybe I was supposed to run it from root shell anyway, so I entered it again. The very first command came back as "mv" is not a recognized internal or external command. I tried it a couple more times, but I'm not following what's supposed to happen here. I did do a reboot of the phone and when I did so, the lock settings were disabled. So, something is happening, but not everything that needs to. I I've probably spent over 12 hours on this over the past week and I am sure I'm doing it wrong. The OP doesn't describe in detail how a beginner needs to do this. I've learned as much as I can, but seeing as how I even got stuck on not knowing I needed to install perl, I'm positive that I'm missing more. The post just isn't beginner friendly. I'm trying hard to understand this but I'm becoming really discouraged here. Can someone provide a little more info here.
Here's the whole session if it helps
Code:
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>perl C:\Android\ad
t-bundle-windows-x86-20130219\sdk\platform-tools\gen-gesture.key.pl.txt
Usage: gen-gesture.key.pl <sequence>
With sequence as number sequence drawn on this keypad:
0 1 2
3 4 5
6 7 8
The generated binary output has to be put into: /data/system/gesture.key
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>mv gen-gesture.key
.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
'mv' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>./gen-gesture.key.
pl 01258 > gesture.key
'.' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb push gesture.k
ey /mnt/sdcard/Download/
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^Csu -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
[email protected]:/ $ su -
re.key > /data/system/gesture.key <
[email protected]:/ # mv gen-gesture.key.pl.txt gen-gesture.key.pl && chmod +x gen-g
esture.key.pl
./gen-gesture.key.pl 01258 > gesture.key
adb push gesture.key /mnt/sdcard/Download/
adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
n-gesture.key.pl && chmod +x gen-gesture.key.pl <
sh: ^Cmv: not found
adb push gesture.key /mnt/sdcard/Download/
adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
127|[email protected]:/ # ./gen-gesture.key.pl 01258 > gesture.key
sh: can't create gesture.key: Read-only file system
1|[email protected]:/ # adb push gesture.key /mnt/sdcard/Download/
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
error: device not found
1|[email protected]:/ # adb shell
error: device not found
1|[email protected]:/ # su -
re.key > /data/system/gesture.key <
[email protected]:/ #
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>mv gen-gesture.key
.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
'mv' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>./gen-gesture.key.
pl 01258 > gesture.key
'.' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb push gesture.k
ey /mnt/sdcard/Download/
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^Csu -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
[email protected]:/ $ su -
re.key > /data/system/gesture.key <
[email protected]:/ # exit
^Cexit
sh: ^Cexit: not found
127|[email protected]:/ # exit
exit
127|[email protected]:/ $ exit
exit
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>mv gen-gesture.key
.pl.txt gen-gesture.key.pl && chmod +x gen-gesture.key.pl
'mv' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>./gen-gesture.key.
pl 01258 > gesture.key
'.' is not recognized as an internal or external command,
operable program or batch file.
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb push gesture.k
ey /mnt/sdcard/Download/
C:\Android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb shell
su -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
^Csu -
cat /mnt/sdcard/Download/gesture.key > /data/system/gesture.key
[email protected]:/ $ su -
re.key > /data/system/gesture.key <
[email protected]:/ #
Click to expand...
Click to collapse
thx

I'm stupid, please help. Stuck in bootloop

I have been playing with some commands and wondered what would happen if I set a wrong screen resolution on my S7 Edge.
Code:
adb shell wm size 1080x1922
The answer is that you get stuck in a bootloop.
Now I'm wondering how to escape the bootloop.
Safe mode also bootloops.
Resetting it while booting didn't help:
Code:
adb shell wm size reset
Error type 2
android.util.AndroidException: Can't connect to window manager; is the system running?
at com.android.commands.wm.Wm.onRun(Wm.java:81)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
at com.android.commands.wm.Wm.main(Wm.java:46)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:316)
This script also didn't:
Code:
@ECHO off
adb wait-for-device
adb -d shell stop
adb shell wm size reset
GreeTech said:
I have been playing with some commands and wondered what would happen if I set a wrong screen resolution on my S7 Edge.
Code:
adb shell wm size 1080x1922
The answer is that you get stuck in a bootloop.
Now I'm wondering how to escape the bootloop.
Safe mode also bootloops.
Resetting it while booting didn't help:
Code:
adb shell wm size reset
Error type 2
android.util.AndroidException: Can't connect to window manager; is the system running?
at com.android.commands.wm.Wm.onRun(Wm.java:81)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
at com.android.commands.wm.Wm.main(Wm.java:46)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:316)
This script also didn't:
Code:
@ECHO off
adb wait-for-device
adb -d shell stop
adb shell wm size reset
Click to expand...
Click to collapse
Edit:
Apparently this script solved it:
Code:
@echo off
:loop
adb shell wm size reset
goto loop

ADB command to insert SQL data

I'm trying to give an application root access in Magisk.
If I run these commands manually this works:
Code:
adb shell
su
sqlite3 /data/adb/magisk.db "INSERT INTO policies (uid,policy,until,logging,notification) VALUES(12345,2,0,1,1)"
What I am trying to do though is do it through a batch script as a single line. I tried different variations of this:
Code:
adb shell "su -c 'sqlite3 /data/adb/magisk.db 'INSERT INTO policies (uid,policy,until,logging,notification);VALUES(12345,2,0,1,1);''"
adb shell "su -c 'sqlite3 /data/adb/magisk.db 'INSERT INTO policies uid,policy,until,logging,notification;VALUES 12345,2,0,1,1;''"
adb shell "su -c 'sqlite3 /data/adb/magisk.db 'INSERT INTO policies VALUES 12345,2,0,1,1;''"
I either get an error telling me "Error: incomplete input", or "/system/bin/sh: syntax error: unexpected '('"
Does anyone have any thoughts? I'm sure it's just a syntax issue, but I'm not sure what else to try.
Thanks in advance.
In the 2nd code example the quotes used are wrong set: you always must alternate double quote and single quote, means the term
'INSERT INTO policies VALUES 12345,2,0,1,1;'
must get written as
"INSERT INTO policies VALUES 12345,2,0,1,1;"
BTW:
Never run several adb shell one after one: it always opens internally a shell window what really doesn't make sense.
Thank you, I'll give your suggestion a try.
Regarding the adb shell; if I do have multiple ADB shell commands to send, then what would be the proper way to do that?
What I am trying to accomplish is writing a batch script in windows that will automate several tasks for me after a factory reset.
I perform several application installs, disable several applications I don't need,
try to add permissions to apps through ADB, and also try to add root permissions like in my example above.
If there is a better way of sending multiple commands like that, could you show an example?
Quick follow up question...
Is there a way to update permission flags to USER_SET?
I tried:
Code:
adb shell pm clear-permission-flags com.name.app android.permission.READ_EXTERNAL_STORAGE user-set
and
Code:
adb shell pm set-permission-flags com.name.app android.permission.READ_EXTERNAL_STORAGE user-set
both gave me an error that the command is unknown. Is there another way? I am trying to set the USER_SET flag for android.permission.READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE

Categories

Resources