1

I'd like to use Applescript to connect to my remote website. However, I don't like the idea of having my password/username in my script in plain text. Is there anyway to encode a password in a local script on my computer?

Thank you,

Eric

Eric
  • 1,209
  • 1
  • 17
  • 34
  • 1
    Look at this: http://stackoverflow.com/questions/604634/how-can-i-encrypt-or-hide-passwords-in-a-perl-script – kol Jan 30 '13 at 19:48
  • 1
    I just answered this today for someone, see my post here http://stackoverflow.com/questions/14598849/how-to-overwrite-the-asking-for-authentication-when-running-an-admin-shell-scrip – regulus6633 Jan 30 '13 at 20:24
  • Thank you both for responding! Both posts responses were helpful, especially reulus6633's. – Eric Jan 30 '13 at 20:54

1 Answers1

0

Well you're not the first one that asks this question but you have to ask yourself some questions. Like who is gonna use it and from who do I need to protect it.

Step 1: To make sure that your code is protected you should save two different kind of AppleScripts. The first one is for you, and you only. This version is compiled but be able to open with Script editor again so you can see the source code. The second is a run only script which is much like the first version but your not able to open it in Script editor again as a document to view it's source code.

step 2: The second thing you don't want is that there is static text about user credentials because, even if it's compiled, you can see static text. Normally you won't see them but when the user credential is an mail address it's an easy find. But before we solve this issue, do you think someone is clever enough to find the user credentials from compiled AppleScript code? If so then the easiest way of encoding is adding a certain value to Unicode values:

property eusn : "¨®¦ÅÞÞÍÉ»ÅÞÞÍÉ"
property epwd : "ÔÅ××ÛÓÖÈ"

set usn to simpleDecryption(eusn)
set pwd to simpleDecryption(epwd)

on simpleEncryption(_str)
    set x to id of _str
    repeat with c in x
        set contents of c to c + 100
    end repeat
    return string id x
end simpleEncryption

on simpleDecryption(_str)
    set x to id of _str
    repeat with c in x
        set contents of c to c - 100
    end repeat
    return string id x
end simpleDecryption

Store statics as encrypted strings and when its needed, decrypt them. Remember that properties are persistent, unlike local variables, so don't store plain data in properties in your case.

dj bazzie wazzie
  • 3,472
  • 18
  • 23