Welcome, Guest. Please login or register.

Author Topic: Compiler for AmigaDOS scripts?  (Read 8572 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Compiler for AmigaDOS scripts?
« on: August 18, 2004, 04:37:53 PM »
@Matt

That would seem a more obvious solution. Any kind of compiled AmigaDOS script would ultimately have to call DOS commands etc and someone would be able to pull the thing apart anyway, unless he actually intends to include the DOS commands he uses into the exe that is. However, I would be doubtful of the legality of that.

My advice would be to simpy write ones own simple scripting language that can be compiled into a binary form readable by some simple interpreter. It could create its own process and IO and call system dos commands if that is essential (via C's system() function or whatever).
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Compiler for AmigaDOS scripts?
« Reply #1 on: August 18, 2004, 04:41:04 PM »
@Thomas

Aye, there is that :-)

One could also encrypt a string with a simple proggy so the included constant is encrypted. It can be decoded at runtime and Execute() an as you describe. That way its virtually immune to basic reverse engineering.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Compiler for AmigaDOS scripts?
« Reply #2 on: August 18, 2004, 07:54:33 PM »
Quote

AMIGA-FAN wrote:
>>> However I would be doubtful of the legality of that.

Legality? If you can put together simple DOS commands or whatever and build a complex shell-script that you can use without copyright issues, why would you not be able to do the same thing from within an executable file, i.e. a binary, obtained by just compiling this script? You are just making use of DOS commands/external programs that you are eligible to use as a owner of the AmigaOS. At least this is my opinion.


Sure, as long as the DOS commands you use are not *physically* included into the binary of your executable.

This would mean your executable contains object code you have no right to redistribute.

Making a compiled script that simply calls dos commands from their usual location (in other words exactly like a normal script) would be fine.

As Thomas suggests, you could simply have the script as a string constant within a C program and execute it. If you want to ensure nobody can reverse engineer (by viewing a hex dump of your exe and seeing the string inside), you could encrypt your scripts with a small program and then use the encrypted data in your executable. It would decrypt the text back to a normal string and then execute it.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Compiler for AmigaDOS scripts?
« Reply #3 on: August 18, 2004, 11:50:28 PM »
@Piru

Well sure, but I did only say "basic" reverse engineering (somewhere) ;-) It would at least eliminate the problem of hex editors and so on.

On the face of it, there is no way to absolutely safeguard code from a determined reverse engineering effort. Even if you wrote your own dos interpreter so you didnt have to call Execute(), people could simply reverse engineer the program itself to find out what it does.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Compiler for AmigaDOS scripts?
« Reply #4 on: August 19, 2004, 07:07:46 PM »
@Amiga-Fan

As stated, there is no way to counter a concerted reverse engineering attempt. All you can do is to make it more or less difficult.

Accidental changes to a script are trivial to prevent. Thomas' suggestion of putting the dos script into a C string and executing it from within your compiled binary is a very practical way to accomplish this.

To prevent casual "I wonder how this script works?" attempts, encrypting the string (and decrypting at runtime) would suffice.

This is possibly a better approach than Rexxecute since you don't have to rewrite your dos scripts in Arexx. Also, good as Rexxecute is, it is not truly a compiler - as far as I know, at least - it simply wraps arexx scripts into an executable loader in much the same way as we are describing here. There was something on aminet ages ago (written itself in arexx) that did pretty much the same thing. I can't for the life of me remember what it was called, however.

Lastly, someone with the required expertise and determination to find out how any code works, will. You simply cannot prevent this.
int p; // A