Notices


Reply
Thread Tools
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#1
Hey,

another little request from my side.
Could any kind soul try to compile SHC (a converter from shell script to C program) for Harmattan and also Fremantle.
Main purpose I want this to have is to have some shell scripts calling devel-su (hereby containing my root password as plain text). I found no other possibility to hide the text of a sh script to a user (which should have the right to execute).

Here are the sources.
TIA
__________________
SIM-Switcher, automated SIM switching with a Double (Dual) SIM adapter
--
Thank you all for voting me into the Community Council 2014-2016!

Please consider your membership / supporting Maemo e.V. and help to spread this by following/copying this link to your TMO signature:
[MC eV] Maemo Community eV membership application, http://talk.maemo.org/showthread.php?t=94257

editsignature, http://talk.maemo.org/profile.php?do=editsignature
 
zxcvbnm3230's Avatar
Posts: 132 | Thanked: 224 times | Joined on Dec 2013
#2
Actually, you can use this command:
Code:
echo <your-devel-su-password> | devel-su -c "<command-here>"
So, if you want to do, for instance, apt-get update and your root password is 'rootme', you simply type this:
Code:
echo rootme | devel-su -c "apt-get update"
-----
shame on me, seems, that's not what you are looking for, i was inattentive reading your post, sorry

Last edited by zxcvbnm3230; 2014-05-27 at 21:09.
 
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#3
Originally Posted by zxcvbnm3230 View Post
Actually, you can use this command:
Code:
echo <your-devel-su-password> | devel-su -c "<command-here>"
Exactly this I do want to hide (NOT want it in plain shell script), as this opens up my root password (which is definitely not 'rootme') readable to (dumb smartphone) user.
__________________
SIM-Switcher, automated SIM switching with a Double (Dual) SIM adapter
--
Thank you all for voting me into the Community Council 2014-2016!

Please consider your membership / supporting Maemo e.V. and help to spread this by following/copying this link to your TMO signature:
[MC eV] Maemo Community eV membership application, http://talk.maemo.org/showthread.php?t=94257

editsignature, http://talk.maemo.org/profile.php?do=editsignature
 

The Following User Says Thank You to peterleinchen For This Useful Post:
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#4
Code:
#include <stdio.h>

void decode_password (const char *src, char *dst)
{
  // Does not need to be terribly complex or safe:
  // the main goal is to hide the decoded password
  // from plain sight and that is achieved
}

int main (void)
{
  static const char encoded[] = "!£$%^&*()_+@";
  char decoded[256];
  char buffer[512];

  decode_password(encoded, decoded);
  sprintf(buffer, "echo \"%s\" | devel-su -c foo", decoded);
  return system(buffer);
}
__________________
Русский военный корабль, иди нахуй!
 

The Following User Says Thank You to pichlo For This Useful Post:
Halftux's Avatar
Posts: 862 | Thanked: 2,511 times | Joined on Feb 2012 @ Germany
#5
So I compiled the sources and I try to make the example "match" but it is obvious that you need a c compiler ("cc" command") on your phone.
You can have a try.

Edit: What is your command for the c compiler? gcc? then you need to export CC=gcc
Attached Files
File Type: deb shc_3_8_9_armel_maemo.deb (14.8 KB, 168 views)
File Type: deb shc_3.8.9_armel_harmattan.deb (16.7 KB, 170 views)

Last edited by Halftux; 2014-05-28 at 00:28.
 

The Following 2 Users Say Thank You to Halftux For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 02:48.