MACSCRPT Archives

March 2013

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
jeff donovan <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 6 Mar 2013 22:36:44 -0500
Content-Type:
multipart/signed
Parts/Attachments:
text/plain (1068 bytes) , smime.p7s (2563 bytes)

On Mar 6, 2013, at 3:17 PM, SUBSCRIBE MACSCRPT Inyo55 <[log in to unmask]> wrote:

> Hey guys,
> I have a script that has to remotely do admin tasks on a Mac workstation.  To that end, the shell script command string in the script has the secret password for the admin account in plain text.  Is there anyway to hide this (other than locking the script)?
> 
> Many thanks,
> Bob R.

you could try encoding the password, then set your variable to the result

#!/bin/bash
clear
echo ""
echo -e "\033[35;48m password is encypted as cGFzc3dvcmQK \033[35;0m";
echo "----------------------------------------------";
PASS=cGFzc3dvcmQK

dPASS=$(echo $PASS | openssl enc -base64 -d )
echo $PASS
echo $dPASS


you have to setup the encrypted password and hard code the encryption, then you can use the Varibable $dPASS in your string.

I first set my password to ' password' end encrypted it. like so;


echo "password" | openssl enc -base64
cGFzc3dvcmQK

or another
 echo "frank" | openssl enc -base64
ZnJhbmsK

then you can decode with 
 echo "ZnJhbmsK" | openssl enc -base64 -d
frank


hope this helps
-j

ATOM RSS1 RSS2