Basically I have been working on a Boot animation changer for the Nexus 7 and the program so far is coded in a C# form for windows.
I have coded everything fine up till now. And I'm a little stuck.
I need to run a ADB command to push a file from my Program files x86 to the nexus 7 and write over the original Boot file.
But is there a simple and easy solution for writing this code? Or do I need to make a console application which does this process when started?
Thanks.
( I can push files manually via ADB, but the point is to make the tool " one click " If you get my drift. )
QuantumCipher said:
Basically I have been working on a Boot animation changer for the Nexus 7 and the program so far is coded in a C# form for windows.
I have coded everything fine up till now. And I'm a little stuck.
I need to run a ADB command to push a file from my Program files x86 to the nexus 7 and write over the original Boot file.
But is there a simple and easy solution for writing this code? Or do I need to make a console application which does this process when started?
Thanks.
( I can push files manually via ADB, but the point is to make the tool " one click " If you get my drift. )
Click to expand...
Click to collapse
Simply execute adb via shell command?
cakebomb said:
Simply execute adb via shell command?
Click to expand...
Click to collapse
Oh so I can actually run the command from the C# application instead of the console? Just write the argument?
QuantumCipher said:
Oh so I can actually run the command from the C# application instead of the console? Just write the argument?
Click to expand...
Click to collapse
I don't know, how to do it in C#, I just know VB.
But you should be able to run adb (shell) with process.start or something and then just type the commands behind adb (shell), like if you want to run 'cmd.exe shutdown -s'.
And if not let your program create and run a batch file, which starts adb and copys the files to the phone, this is definitely possible.
Sent from my GT-I9100 using xda app-developers app
QuantumCipher said:
Oh so I can actually run the command from the C# application instead of the console? Just write the argument?
Click to expand...
Click to collapse
not 100% sure but should be something like
this is just an example and may be wrong, better check out exact arguments or google
using System;
using System.Diagnostics;
namespace adb.test
{
class ProcessStart
{
static void Main(string[] args)
{
Process adb = new Process();
adb.StartInfo.FileName = "adb.exe";
adb.StartInfo.Arguments = "shell";
adb.Start();
}
}
}
hopefully this will help you.
ADB VB Express 2008 - WM-Explorer
Hi,
this function is maked by my for WM-Explorer (WM8850 tablets - nanospic.ro ) in VB Express 2008
Dim CurrentPath As String = Environment.CurrentDirectory & "\"
Public Function ADB_Send_Cmd(ByVal cmd As String, ByVal timeout As Integer) As String
Dim dos_out As String = "dos_out.pms"
Dim bat_file As String = "getcmd.bat"
Dim sir As String
sir = "adb.exe " & cmd & " > " & dos_out
System.IO.File.WriteAllText(CurrentPath & bat_file, sir)
Shell(CurrentPath & bat_file, AppWinStyle.Hide, True, timeout)
Application.DoEvents()
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("adb")
For Each p As Process In pProcess
p.Kill()
p.WaitForExit()
Next
Application.DoEvents()
Dim sr As StreamReader = File.OpenText(CurrentPath & dos_out)
Dim out As String = sr.ReadToEnd
sr.Close()
System.IO.File.Delete(CurrentPath & bat_file)
System.IO.File.Delete(CurrentPath & dos_out)
ADB_Send_Cmd = out
End Function
and how to use this function :
cmd = "devices"
rezultat = ADB_Send_Cmd(cmd, 20000)
'rezultat' may be :
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
xxxxxxxxx
cakebomb said:
I don't know, how to do it in C#, I just know VB.
But you should be able to run adb (shell) with process.start or something and then just type the commands behind adb (shell), like if you want to run 'cmd.exe shutdown -s'.
And if not let your program create and run a batch file, which starts adb and copys the files to the phone, this is definitely possible.
Sent from my GT-I9100 using xda app-developers app
Click to expand...
Click to collapse
Xadder said:
not 100% sure but should be something like
this is just an example and may be wrong, better check out exact arguments or google
using System;
using System.Diagnostics;
namespace adb.test
{
class ProcessStart
{
static void Main(string[] args)
{
Process adb = new Process();
adb.StartInfo.FileName = "adb.exe";
adb.StartInfo.Arguments = "shell";
adb.Start();
}
}
}
hopefully this will help you.
Click to expand...
Click to collapse
diabetu said:
Hi,
this function is maked by my for WM-Explorer (WM8850 tablets - nanospic.ro ) in VB Express 2008
Dim CurrentPath As String = Environment.CurrentDirectory & "\"
Public Function ADB_Send_Cmd(ByVal cmd As String, ByVal timeout As Integer) As String
Dim dos_out As String = "dos_out.pms"
Dim bat_file As String = "getcmd.bat"
Dim sir As String
sir = "adb.exe " & cmd & " > " & dos_out
System.IO.File.WriteAllText(CurrentPath & bat_file, sir)
Shell(CurrentPath & bat_file, AppWinStyle.Hide, True, timeout)
Application.DoEvents()
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("adb")
For Each p As Process In pProcess
p.Kill()
p.WaitForExit()
Next
Application.DoEvents()
Dim sr As StreamReader = File.OpenText(CurrentPath & dos_out)
Dim out As String = sr.ReadToEnd
sr.Close()
System.IO.File.Delete(CurrentPath & bat_file)
System.IO.File.Delete(CurrentPath & dos_out)
ADB_Send_Cmd = out
End Function
and how to use this function :
cmd = "devices"
rezultat = ADB_Send_Cmd(cmd, 20000)
'rezultat' may be :
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
xxxxxxxxx
Click to expand...
Click to collapse
Thanks for the effort guys I found a way round it all and learnt a few new things about the android system ways and file permissions Ill be posting the app on here today or tomorrow may add a few more features to make it more worth while for users.
(Y)
QuantumCipher said:
Thanks for the effort guys I found a way round it all and learnt a few new things about the android system ways and file permissions Ill be posting the app on here today or tomorrow may add a few more features to make it more worth while for users.
(Y)
Click to expand...
Click to collapse
I am attempting a similar feat and I was wondering what your work around is?
My batch file terminates issues cmd commands at the shell prompt.
I am merely using a "Unlock" and "Lock" Form button to issue several commands to ADB Shell to Change the HTC One Max Flag for Locked Bootloader status. I would like to hard code the shell commands to execute with form button press but I have yet to find a way. Below are 2 sequenced events i need to occur on button press. I am using Visual Studio 2013
Mark Boot loader as Locked Code is:
Code:
adb shell
su
(if needed to get a # prompt)
echo -ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796
exit
exit
adb reboot bootloader
(This is for the user to verify the Bootloader flag has changed)
Mark Boot loader as Unlocked Code is:
Code:
adb shell
su
(if needed to get a # prompt)
echo -ne "HTCU" | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796
exit
exit
adb reboot bootloader
Thanks for your help
DeadPhoenix said:
I am attempting a similar feat and I was wondering what your work around is?
My batch file terminates issues cmd commands at the shell prompt.
I am merely using a "Unlock" and "Lock" Form button to issue several commands to ADB Shell to Change the HTC One Max Flag for Locked Bootloader status. I would like to hard code the shell commands to execute with form button press but I have yet to find a way. Below are 2 sequenced events i need to occur on button press. I am using Visual Studio 2013
Mark Boot loader as Locked Code is:
Code:
adb shell
su
(if needed to get a # prompt)
echo -ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796
exit
exit
adb reboot bootloader
(This is for the user to verify the Bootloader flag has changed)
Mark Boot loader as Unlocked Code is:
Code:
adb shell
su
(if needed to get a # prompt)
echo -ne "HTCU" | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796
exit
exit
adb reboot bootloader
Thanks for your help
Click to expand...
Click to collapse
does this help?
http://forum.xda-developers.com/showthread.php?t=2042227
QuantumCipher said:
does this help?
http://forum.xda-developers.com/showthread.php?t=2042227
Click to expand...
Click to collapse
I was looking at more of something like this.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
The reason your linked thread won't work is because once you enter the ADB Shell environment your are no longer issuing commands via the cmd.exe process. There for any command sent from that process are not interpreted by the console as valid as you are in ADB Shell. At least that is my understanding. The Namespace in my link seems to have what I need but I am having a hard time breaking down what I need as I am so new to C# programming.
DeadPhoenix said:
I was looking at more of something like this.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
Click to expand...
Click to collapse
OKay ive just refrenced that in my new tool ..Ill look in a few hours buddy going ski center now
DeadPhoenix said:
I was looking at more of something like this.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
The reason your linked thread won't work is because once you enter the ADB Shell environment your are no longer issuing commands via the cmd.exe process. There for any command sent from that process are not interpreted by the console as valid as you are in ADB Shell. At least that is my understanding. The Namespace in my link seems to have what I need but I am having a hard time breaking down what I need as I am so new to C# programming.
Click to expand...
Click to collapse
Right I had a quick look and I think I know what you mean.. Theres a few ways I can think of ..
1. Is Make a thread process and covert your commands like adb reboot to Cmd process like my tutorial.
And for the shell as you said there is AndroidLIB.DLL You need to set the adb shell up from that so you can execute that longer command.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
Something like this :
But obviously change this code to use adbshellcommand
Code:
AdbCommand adbCmd = Adb.FormAdbCommand(device, true, "input", "keyevent", (int)KeyEventCode.HOME);
If you get stuck Ill right the code out later as I was thinking about adding shell to my console app.
QuantumCipher said:
Right I had a quick look and I think I know what you mean.. Theres a few ways I can think of ..
1. Is Make a thread process and covert your commands like adb reboot to Cmd process like my tutorial.
And for the shell as you said there is AndroidLIB.DLL You need to set the adb shell up from that so you can execute that longer command.
http://www.regawmod.com/software/wi...html/986559a3-c009-64d7-e1b0-c3cad2bf4fd4.htm
Something like this :
But obviously change this code to use adbshellcommand
Code:
AdbCommand adbCmd = Adb.FormAdbCommand(device, true, "input", "keyevent", (int)KeyEventCode.HOME);
If you get stuck Ill right the code out later as I was thinking about adding shell to my console app.
Click to expand...
Click to collapse
Here is my code for the button I am using
Code:
private void lockboot_Click(object sender, EventArgs e)
{
string serial;
android = AndroidController.Instance;
android.UpdateDeviceList();
serial = android.ConnectedDevices[0];
device = android.GetConnectedDevice(serial);
AdbCommand adbCmd = Adb.FormAdbShellCommand(device, true, "echo", "-ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796");
Adb.ExecuteAdbCommand(adbCmd);
lbllocked.Visible = true;
lblunlock.Visible = false;
textboxcolor.BackColor = Color.Red;
}
It Compiles with no issues however the command is not executing properly. The Bootloader show be flagged unlocked when I boot in to Bootloader. It is however remaining unchanged.
DeadPhoenix said:
Here is my code for the button I am using
Code:
private void lockboot_Click(object sender, EventArgs e)
{
string serial;
android = AndroidController.Instance;
android.UpdateDeviceList();
serial = android.ConnectedDevices[0];
device = android.GetConnectedDevice(serial);
AdbCommand adbCmd = Adb.FormAdbShellCommand(device, true, "echo", "-ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796");
Adb.ExecuteAdbCommand(adbCmd);
lbllocked.Visible = true;
lblunlock.Visible = false;
textboxcolor.BackColor = Color.Red;
}
It Compiles with no issues however the command is not executing properly. The Bootloader show be flagged unlocked when I boot in to Bootloader. It is however remaining unchanged.
Click to expand...
Click to collapse
Any Suggestions?
Related
So I am trying to make a tool to use with the LG Ally for root and recovery, kind of like Unrevoked. All commands necessary can be done via ADB, all resources including adb can be placed in a resource folder.
I am having very frustrating issues as the Ally doesn't have Root on auto via adb, and adb root doesnt work properly. So I started using a batch file and fan into problems where when I issue adb shell su the script gets "stuck" in the shell and wont accept any input until the su shell terminates. If I adb shell su then close the window, the su permissions are NOT preserved.
I have moved on to visual basic, so I have a little more control, but I cannot for the life of me find out how to successfully pass commands to the shell the best I can do is open new shells for each command which is no good.
I know Im missing something and I know its something simple I just cant for the life of me figure it out
ok so I made a media player which is written in c# and it passes commands to adb...I can show you how to talk to shell via c# if you want.
Ok s how are you writing to shell one by one? Are you using a stream writer to a process?
At this point the commands are issued one by one.
I just installed vb 2k8, I think my problems lye in the deprecation of vb6 commands
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("C:\android-sdk-windows\tools\adb.exe shell su")
SendKeys.Send("ls")
SendKeys.Send("{ENTER}")
End Sub
End Class
Im trying to keep it simple for now. This code will open up 2 cmd windows for some reason. and it doesnt pass the SendKeys.Send keys, I just end up with 2 cmd windows sitting at the #.
If I Shell("CMD.EXE") and try running adb commands with sendkeys, the keys sent will be jarbled, it moves around my keys (I would imagine because / is an escape char?)
I havent mucked about with vb in a few years so sorry for my noobism, Im good at bash scripting but this is very counter-intuitive
ok that is a bad way of doing it...no offense
Anyway, here's the proper way of sending shell commands one by one and getting back output...
objProcess = New System.Diagnostics.Process()
objProcess.StartInfo.FileName = ProcessPath
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.Start()
and you set processpath to be "cmd"
and you say objprocess.standardinput.writeline("whatever command you want")
and you say objprocess.standardoutput.readline() to return a string which you can display in a messagebox by saying "msgbox(string)"
-Hope this helps
None taken, my VB is weak like the ukraine, Im just trying to make a copy of my tool for windows, since most people use it. Thatsnks for the tips Im on the right track now, I think.
It is however giving me some trouble with objProcess.StandardInput.WriteLine...
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objProcess = New System.Diagnostics.Process()
objProcess.StartInfo.FileName = "cmd"
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.Start()
objProcess.StandardInput.WriteLine("echo TEST")
End Sub
End Class
its still super simple in testing mode. This when ran gives me the error "StandardIn has not been redirected." Thanks for the help im currently researching to see if I can figure it out. If you have any more ideals let me know
Got it, thanks
heres is the working code for a test I did
Code:
Public Class Form1
Private WithEvents objProcess As Process
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
objProcess = New Process
objProcess.StartInfo.FileName = "cmd"
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.StartInfo.RedirectStandardInput = True
objProcess.StartInfo.UseShellExecute = False
objProcess.StartInfo.RedirectStandardOutput = True
objProcess.Start()
objProcess.StandardInput.WriteLine("C:\android-sdk-windows\tools\adb.exe kill-server")
objProcess.StandardInput.WriteLine("C:\android-sdk-windows\tools\adb.exe start-server")
objProcess.StandardInput.WriteLine("C:\android-sdk-windows\tools\adb.exe shell su")
objProcess.StandardInput.WriteLine("C:\android-sdk-windows\tools\adb.exe shell mkdir /sdcard/TEST")
End Sub
End Class
If it's useful, I have a technique to start an app, then to call the app again from the command line.
If the app is still running, it will process the command line. If it's not running, it simply launches a new instance and then processes the command line.
Let me know if you can use it.
Cheers
You Guys should look at the AndroidLib.dll it has adb/fastboot and device libraries already so you can just package 1 exe in your distro without the need to include or reference Adb and fastboot directly. Here is an example of a Form Button to reboot in to the bootloader.
Code:
private void button1_Click(object sender, EventArgs e)
{
AdbCommand adbrebootCmd = Adb.FormAdbCommand(device, "reboot bootloader");
Adb.ExecuteAdbCommand(adbrebootCmd);
android.Dispose();
}
The library also allows you to send AdbShell commands with Root access.
Really useful.
Hi all,
i'm very happy to finally see our hated boot loader unlocked!
By the way i was following the_laser steps to unlock it but i'm on a GNU/Linux machine
(Archlinux) so i tried the Virtualbox way noticing that "s1tool" for checking if the phone
is unlockable or not works fine but the batch "msm7227_semc.cmd" isn't at all (maybe
"adb" doesn't communicate very well through Virtualbox USB virtualization, i don't know),
so i port the batch as a shell script and it works.
It's not good to keep it in my laptop so here it is:
Code:
#!/bin/sh
#
# msm7227_semc.sh - a simple step-by-step port of msm7227_semc.cmd
# by [email protected]
#
# 2011 - Alessandro "ff0000.it" Massignan
#
COUNT=0
function error ()
{
MESSAGE=$1
echo "Error: ${MESSAGE}"
exit 1
}
function step ()
{
COUNT=$(( COUNT + 1 ))
MESSAGE=$1
printf "\n${COUNT}. ${MESSAGE}"
read
}
cat <<EOF
******************************************************
*** Process requires standard Android 2.x firmware ***
*** -= now it's up to you! ;-) =- ***
******************************************************
EOF
step "searching for 'adb' executable"
_WHICH=`which which 2>/dev/null` || { error "Missing tool: which"; }
_ADB=`${_WHICH} adb 2>/dev/null` || { error "Missing tool: adb"; }
step "getting root priviledges"
echo "waiting for device..."
$_ADB wait-for-device
echo "pushing exploit..."
$_ADB push bootTools/rageagainstthecage /data/local/tmp/expl || \
{ error "Failed to push the exploit"; }
$_ADB shell "chmod 777 /data/local/tmp/expl" || \
{ error "Failed to change permission on exploit"; }
echo "executing exploit..."
$_ADB shell "/data/local/tmp/expl" || \
{ error "Failed to execute the exploit"; }
echo "waiting for device..."
$_ADB wait-for-device
step "removing NAND MPU restrictions via SEMC backdoor (this is permanent)"
$_ADB push bootTools/fixPart /data/local/tmp/fixPart || \
{ error "Failed to push the backdoor"; }
$_ADB shell "chmod 777 /data/local/tmp/fixPart" || \
{ error "Failed to change permission on backdoor"; }
$_ADB shell "/data/local/tmp/fixPart" || \
{ error "Failed to execute the backdoor"; }
echo "Rebooting..."
$_ADB shell reboot
echo "Waiting for device..."
$_ADB wait-for-device
step "re-getting root priviledges (wait for complete boot process)"
$_ADB shell "/data/local/tmp/expl" || { exit 1; }
echo "Waiting..."
$_ADB wait-for-device
step "getting access to semcboot area"
$_ADB push bootTools/mapper_2.6.29.ko /data/local/tmp/mapper_2.6.29.ko || \
{ error "Failed to push maper module"; }
$_ADB shell "chmod 777 /data/local/tmp/mapper_2.6.29.ko" || \
{ error "Failed to change permission on mapper module"; }
$_ADB shell insmod /data/local/tmp/mapper_2.6.29.ko || \
{ "Failed to load maper module into kernel"; }
step "writing semcboot"
$_ADB push my7227bootwrite_semcSL /data/local/tmp/my7227bootwrite_semcSL || \
{ error "Failed to push semcbooti data"; }
$_ADB shell "chmod 777 /data/local/tmp/my7227bootwrite_semcSL" || \
{ error "Failed to change permission on semcboot data"; }
$_ADB shell "/data/local/tmp/my7227bootwrite_semcSL" || \
{ error "Failed to execute semcboot data"; }
step "All done."
exit 0
copy this one and put it as msm7227_semc.sh in msm7227 directory (the one you obtain extracting the archive built by the_laser, http://forum.xda-developers.com/showthread.php?t=1254225), enter the directory
and execute it:
Code:
[email protected]:msm7227# sh ./msm7227_semc.sh
******************************************************
*** Process requires standard Android 2.x firmware ***
*** -= now it's up to you! ;-) =- ***
******************************************************
1. searching for 'adb' executable
2. getting root priviledges
waiting for device...
pushing exploit...
2324 KB/s (585731 bytes in 0.246s)
executing exploit...
waiting for device...
3. removing NAND MPU restrictions via SEMC backdoor (this is permanent)
12 KB/s (3087 bytes in 0.240s)
success
Rebooting...
Waiting for device...
4. re-getting root priviledges (wait for complete boot process)
Waiting...
5. getting access to semcboot area
154 KB/s (8064 bytes in 0.051s)
6. writing semcboot
1294 KB/s (596916 bytes in 0.450s)
successfully wrote 0003ff00
7. All done.
[email protected]:msm7227#
*** each step has to be confirmed by pressing a key ***
It requires "adb" executable in one of the directory listed in $PATH variable.
It works for me so it has to work for you ;-)
Happy unlocking and endless kudos to the_laser ,
ff0000
THANK YOU! Im on linux and had to use my rubbishy windows machine to do bl unlock also QEMU might be better for USB as the android emulator runs it and that works fine
Sent from my U20i using XDA App
x10man said:
THANK YOU! Im on linux and had to use my rubbishy windows machine to do bl unlock also QEMU might be better for USB as the android emulator runs it and that works fine
Sent from my U20i using XDA App
Click to expand...
Click to collapse
It's been a (long) while since i don't use Qemu (maybe i could give it a chance ;-)... the annoying thing is that folks here at XDA isn't so Opensource-proned and don't tend to share their sources :-/, for this unlocking procedure you've to bow down to Windows for the s1tool and that's so-so-so-so-so-so-so-so-so boring... on the other hand if s1tool's sources is available, someone could port it to GNU/Linux in order to have a complete platform independent task... but that's only my point of view i don't want to mess up with great gifts we receive from XDA
Cheers,
ff0000
Yeah its kinda sad that androids based off of linux but most of its utilities are windoze.... Yeah on sources it is useful to release but sometimes not
Sent from my U20i using XDA App
x10man said:
Yeah its kinda sad that androids based off of linux but most of its utilities are windoze.... Yeah on sources it is useful to release but sometimes not
Sent from my U20i using XDA App
Click to expand...
Click to collapse
I think sharing informations (in this case code sources) is always good to give people the opportunity to learn so to evolve... and i have no relationship with Richard Stallman at all! :-DDD
SteveBallmer said:
Monkey Dance to you! (me no like that idea oo oo ah ah!)
Click to expand...
Click to collapse
thats all i have to say to this.
Sorry. One off troll plus it was a jab at ballmer
Anyway have you tried asking the_laser for sources? He may give you them if you say you are porting to linux
Sent from my U20i using XDA App
x10man said:
Sorry. One off troll plus it was a jab at ballmer
Anyway have you tried asking the_laser for sources? He may give you them if you say you are porting to linux
Sent from my U20i using XDA App
Click to expand...
Click to collapse
No problem mate, i still can't do the monkey dance X-D... i should try in a drunken state X-DDD...
I asked him to include the script in the msm7227 package but it'd be better to ask the source of s1tool so i could totally port (if i'm able to ).
By the way, do any of you try my script?!? Is it working?
Thanks x10man,
ff0000.it
Cool man! I'll give it a shot. You should link to the original thread though
kissmyarch said:
Cool man! I'll give it a shot. You should link to the original thread though
Click to expand...
Click to collapse
Thanks mate,
in these day i'll see if it could be included in the_laser's package but first i've to be sure to be able to port s1tool or we stay with a foot on Windows and the other on GNU/Linux and that's not good
And what about flashtool? Is there a linux alternative? because I'm using it through Virtualbox and it's a little bit annoying.
Sorry I can't try your script since I've already unlocked... but thanks anyway.
ambrosiosanchez said:
And what about flashtool? Is there a linux alternative? because I'm using it through Virtualbox and it's a little bit annoying.
Sorry I can't try your script since I've already unlocked... but thanks anyway.
Click to expand...
Click to collapse
You could use Flashtool in GNU/Linux with Mono, but i never try it (however that's another annoying point)
I run the script on my unlocked phone and it worked fine (the_laser told me that i could run it how many times i want to) ;-)
But guys flashtool is on java! So you run it by
Code:
java -jar flashtool.jar
I've done it before
Oh and ff0000.it could you please include in your first post the download links of what we need to run with your script?
It's nice to have them all in one place rather than searching among several posts. Thanks!
i cant do a full unlock test but i can test on already unlocked if its ok and off topic i am able to do the monkey dance quite well btw there is a hilarious vid on utube called best of ballmer watch it. soooo funny LINUX FTW! btw what distro u on im either openSUSE or crunchbang depends on mood im in
kissmyarch said:
But guys flashtool is on java! So you run it by
Code:
java -jar flashtool.jar
I've done it before
Oh and ff0000.it could you please include in your first post the download links of what we need to run with your script?
It's nice to have them all in one place rather than searching among several posts. Thanks!
Click to expand...
Click to collapse
You're totally right... i was writing about Flashtool and thinking about SuperOneClick... my moronic brain has stricken again!
I added the link to the unlocking guide that has the link to the package ;-)
kissmyarch said:
But guys flashtool is on java! So you run it by
Code:
java -jar flashtool.jar
I've done it before
Oh and ff0000.it could you please include in your first post the download links of what we need to run with your script?
It's nice to have them all in one place rather than searching among several posts. Thanks!
Click to expand...
Click to collapse
Thanks! much easier than Virtualbox
Great! I just had to change the top line to #!/bin/bash (syntacs error with the sh interpreter) and run the script as root.
Hey Guys,
I know there is an app in the market already Keystore Unlocker, but it doesnt seem to work with the latest su binary. Does anyone know if there is a way to disable the password requirement for stored certificates. It would be a useful feature to bake into some roms or even a new app that works with latest su.
I decomplied the apk for Keystore Unlocker but it was no help. I emailed the developer and asked if he would either update the app and make it paid (99 cents wouldnt be too much) or release the source for us to use for future projects.
Let me know if you guys have any ideas.
Same issue on HTC Incredible, Stock + Root ROM 2.3.4. Really annoying, anyone know a fix? My initial thinking is it's at kernel layer, as Hot Reboot doesn't cause issue but a "full" reboot does. Anybody have a suggestion on fix or workaround?
+1
Would love to bypass the credential storage. It literally decimates the battery trying to log into a credentialed WiFi (try/fail/try/fail) if you don't happen to notice that you haven't done the credential yet.
+1
I have mailed to the app's author, perhaps he has a solution.
Does anybody knows what exactly the app does? Is there a way by command line to activate the credential storage? (so it could be done in autostart)?
There are two possibilities to unlock the keystore. Both need to be run under UID=1000!
1) You have an AOSP based ROM, like Cyanogen:
There is a tool called "keystore_cli", which provides basic access to the keystore by commandline.
Simply run
Code:
su -c 'keystore_cli u <password>' 1000
to unlock it.
Other options are can be found in keystore.c:
Code:
static struct action {
int8_t (*run)();
int8_t code;
int8_t state;
uint32_t perm;
int lengths[MAX_PARAM];
} actions[] = {
{test, 't', 0, TEST, {0}},
{get, 'g', NO_ERROR, GET, {KEY_SIZE}},
{insert, 'i', NO_ERROR, INSERT, {KEY_SIZE, VALUE_SIZE}},
{delete, 'd', 0, DELETE, {KEY_SIZE}},
{exist, 'e', 0, EXIST, {KEY_SIZE}},
{saw, 's', 0, SAW, {KEY_SIZE}},
{reset, 'r', 0, RESET, {0}},
{password, 'p', 0, PASSWORD, {PASSWORD_SIZE, PASSWORD_SIZE}},
{lock, 'l', NO_ERROR, LOCK, {0}},
{unlock, 'u', LOCKED, UNLOCK, {PASSWORD_SIZE}},
{NULL, 0 , 0, 0, {0}},
};
I guess you can figure them out, if you want to.
2) You don't have the keystore_cli tool:
a) You might be able to use a keystore_cli binary from another rom
b) Use unix domain sockets to communicate with the keystore.
The socket is under /dev/socket/keystore.
To access this, you'd have to write a small c programm and use the socket(), write() syscalls.
Luckily. this is exactly what that "keystore unlocker" from the market does.
It comes with a small native executable located at
Code:
/data/data/ru.chunky.AutoKeystore/lib/libkeystorecmd-executable.so
which reads input to send to the socket from stdin.
The format is:
Code:
<code><length1><message1>...
Where <code> would be 'u' to unlock
<length> would be the length of the password as 16bit unsigned int
<message> would be the string representation of the password
In this example the password is "password", which is 8 characters long.
So the length would have to be \0000\0008 and the message to send to the socket
Code:
u\0000\0008password
Running
Code:
su -c "echo -e 'u\0000\0008password' | /data/data/ru.chunky.AutoKeystore/lib/libkeystorecmd-executable.so" 1000
should show a result of
Code:
1
in the commandline, if successful and the keystore should be unlocked.
it sounds brilliant!
Do you have any idea what is the problem with the app and actual su versions?
Awesome find man, shame is ICS fixed this bug. It just requires a pattern lock or pin lock. I wish we could find a workaround for this....
Sent from my HTC Rezound
stm999999999 said:
it sounds brilliant!
Do you have any idea what is the problem with the app and actual su versions?
Click to expand...
Click to collapse
Nope, no idea.
I worked around it like this (cyanogenmod):
In /data/local/userinit.sh I put
Code:
#!/system/bin/sh
nohup /data/local/keystoreunlock_delayed.sh > /dev/null 2> /dev/null &
and the file /data/local/keystoreunlock_delayed.sh contains:
Code:
#!/system/bin/sh
sleep 60
su -c 'keystore_cli u <password>' 1000
The 60 second delay makes sure the phone has already initialized the keystore.
It's a bit of a diry way to do it, but this way it works without any android app.
To test this on my device, I made a file /data/keystoreunlock_delayed.sh
#!/system/bin/sh
su -c 'keystore_cli u <password>' 1000
and execute it within root explorer. But nothing happens!?
I tried su -c 'keystore_cli u <password>' 1000 in terminal Emulator, I got permission denied. I have to do a "su" before, without any parameters, then superuser asks for permission, and then the long command worked.
stm999999999 said:
To test this on my device, I made a file /data/keystoreunlock_delayed.sh
#!/system/bin/sh
su -c 'keystore_cli u <password>' 1000
and execute it within root explorer. But nothing happens!?
Click to expand...
Click to collapse
I forgot the permission 0755. It was 0555.
Can I download keystore_cli somewhere so I can use this script?
I have /system/bin/keystore but not keystore_cli on the rooted 2.3.4 OTA. Using HTC Incredible and would like to use this workaround script.
EDIT: I now realize this is in the Rezound forum. I found this thread by Google search but couldn't find much else on keystore_cli other than zip extract logs.
hm, I do not use a Rezound, too. I have a Desire.
Are you sure, this file is not an integral part of android?
I found one version on dropbox: https://www2.dropbox.com/s/cuu6hm8dvi3jxh5/BI/system/bin/keystore_cli
but I cannot say anything about this file. If it is genuine and ok.
What about asking in an Incredible subforum?
AutoKeystore fixed
I've just resolved "newer su" issue with ru.chunky.AutoKeystore and added password-less VPN Wizard there.
I'm trying to make something easy here.
I've followed a guide to install Ubuntu (using Ubuntu Installer) and I now have a shell script.
When I have to start the server, I have to write:
Code:
su
cd /sdcard/ubuntu/
sh ubuntu.sh
Then I have to write in the screen resolution which I write 1190x720 (because of ICS buttons) and then press 2 for GNOME desktop.
So I write:
Code:
su
cd /sdcard/ubuntu/
sh ubuntu.sh
1190x720
2
Then for shutting it down, I have to write "exit".
I want to make an easy application that can do those 5 above steps so I don't have to write those 5 lines. I want the application to have 2 buttons. An START and STOP and then like a status bar which shows if I've started or stopped the server.
How will I be able to do that? Which language should I write it in?
I'm a noob at this, so please take it easy!
Thanks in advance!
You can create a script with those commands, and execute it with Script Manager (this is the easiest way).
If you wish to develop your own app, you'll need:
Basic Java and Android knowledge.
Android SDK, Eclipse and ADT Plugin for Eclipse.
RootTools Library (the easiest way to grant root access to your app and run commands as root).
It's difficult? Nope, add 2 buttons and a message to an app is very easy (using the tools that I listed above).
RoberGalarga said:
You can create a script with those commands, and execute it with Script Manager (this is the easiest way).
If you wish to develop your own app, you'll need:
Basic Java and Android knowledge.
Android SDK, Eclipse and ADT Plugin for Eclipse.
RootTools Library (the easiest way to grant root access to your app and run commands as root).
It's difficult? Nope, add 2 buttons and a message to an app is very easy (using the tools that I listed above).
Click to expand...
Click to collapse
Yes, thank you for answering.
I know about the SDK and Eclipse, but I can't get it to work on my phone.
Can you find me a working guide on how to execute that shell script from Java, please? Thanks
RootTools dude
RoberGalarga said:
RootTools dude
Click to expand...
Click to collapse
So basicly...
Code:
try {
List<String> output = RootTools.sendShell(command);
String[] commands = new String[] { su, cd /sdcard/ubuntu/, sh ubuntu.sh };
List<String> otherOutput = RootTools.sendShell(commands);
} catch (IOException e) {
// something went wrong, deal with it here
}
Guess that's what it's going to look like, aye?
Hi XDA developers community!
I think this question was not asked before, because it's too specific.
So here is the problem:
From the Terminal Emulator I am trying to start Poot like so:
Code:
am start -a android.intent.action.MAIN -n org.giantpune.Poot.Poot/android.intent.action.MAIN
and get this error message:
Code:
Error type 3
Error: Activity class {org.giantpune.Poot.Poot/android.intent.action.MAIN} does not exist.
I inspected the AndroidManifest.xml and looked for useful intent commands, but had no luck and even converted the .apk with dex2jar.
As I don't have any experience with Java, the sole purpose of decompiling it in the first place was an interesting intent entry on line 136 in the QtActivity.java file.
It is either located in org/kde/necessitas/origo/ as QtActivity.class, when converted with dex2jar.
Or in Poot-debug(W100)/smali/org/kde/necessitas/origo/ as QtActivity.smali, when decompiled with apktool.
What I am trying to achieve is not only starting the app from the console, but to make it run the action of the "Press here to poot" button.
The device is rooted, should that matter at all.
How can I achieve this and do I even need intent commands or not?
I hope you can help.
Bump
Can anybody help?
As nobody has answered, here is the information I was able to gather meanwhile:
According to a post (can't post link due to restriction) on Android Enthusiasts I need to enter a classname like this:
Code:
am start -a android.intent.action.MAIN -n <package_name>/<full_class_name>
But as there is no class name specified in the AndroidManifest.xml (Link located in first post above), I am not sure how this problem can be solved.
I entered different variations of the command:
Code:
am start -a android.intent.action.MAIN org.giantpune.Poot
Code:
am start org.giantpune.Poot/android.intent.action.MAIN
Code:
am start -a android.intent.action.LAUNCHER org.giantpune.Poot
Code:
am start org.giantpune.Poot/android.intent.action.LAUCHER
None of them worked.
Can someone answer this?