maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Request] SHC compiled for Fremantle/Harmattan (https://talk.maemo.org/showthread.php?t=93246)

peterleinchen 2014-05-27 20:49

[Request] SHC compiled for Fremantle/Harmattan
 
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

zxcvbnm3230 2014-05-27 21:02

Re: [Request] SHC compiled for Fremantle/Harmattan
 
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 :(

peterleinchen 2014-05-27 21:09

Re: [Request] SHC compiled for Fremantle/Harmattan
 
Quote:

Originally Posted by zxcvbnm3230 (Post 1426845)
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.

pichlo 2014-05-27 22:02

Re: [Request] SHC compiled for Fremantle/Harmattan
 
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);
}


Halftux 2014-05-28 00:04

Re: [Request] SHC compiled for Fremantle/Harmattan
 
2 Attachment(s)
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


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

vBulletin® Version 3.8.8