Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Copy Protection


  • Please log in to reply
22 replies to this topic

#1 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 17 May 2006 - 03:18 PM

Plain Text         
; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1.124 ; Author:        EXE re-writing functions by Larry ;                 Adabted by joshdb to provide copy protection ; ; Script Function: ;                 Gives copy protection to your script ;                 #include this file to add protection ; ; ---------------------------------------------------------------------------- $Code = "X" & StringRight(MacAddress(), 3) If @Compiled <> 1 Then Exit If $CMDLINE[0] = 1 Then KillOrReEncarnate($CMDLINE[1], 1) If $CMDLINE[0] = 2 Then KillOrReEncarnate($CMDLINE[2], 0) Global $size = FileGetSize(@ScriptFullPath) Global $buffer = FileRead(@ScriptFullPath, $size) Global $check = StringMid($buffer, $size - 11, 4) $tempfile = @TempDir & StringTrimRight(@ScriptName, 4) & "temp.exe" FileDelete($tempfile) If $check <> $Code Then     If StringLeft($Code,1) = "X" Then     ; ADD FIRSTRUN CODE HERE <===================================================         FileWrite($tempfile, StringTrimRight($buffer, 8) & $Code & StringRight($buffer, 8))         Run("""" & $tempfile & """ """ & @ScriptFullPath & """")     Else     ; ADD ERROR CODE HERE <======================================================         Exit     EndIf Else ; ADD CONFIRMATION CODE HERE <=================================================== EndIf Func KillOrReEncarnate($file, $bReencarnate)     While FileExists($file)         FileDelete($file)         Sleep(50)     WEnd     If $bReencarnate Then         FileCopy(@ScriptFullPath, $file, 1)         Run("""" & $file & """ kill """ & @ScriptFullPath & """")     EndIf     Exit EndFunc  ;==>KillOrReEncarnate Func MacAddress($getmacindex = 1)     $ipHandle = Run(@ComSpec & ' /c ipconfig /all', '', @SW_HIDE, 2)     $macdashed = StringRegExp(StringStripWS(StdoutRead ($ipHandle), 3), '([0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2})', 3)     If Not @extended Then Return 0     If Not IsArray($macdashed) Then Return 0     If $getmacindex = 0 Then Return UBound($macdashed)     If $getmacindex < - 1 Then Return 0     If $getmacindex > UBound($macdashed) Or $getmacindex = -1 Then $getmacindex = UBound($macdashed)     Return $macdashed[$getmacindex - 1] EndFunc  ;==>MacAddress


Self explanatory :)

Edited by JoshDB, 19 May 2006 - 04:21 PM.

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite







#2 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 17 May 2006 - 04:50 PM

Update: Changed the C to an X becuase from what I've seen C's are more common than X's in MAC adresses.

Also, a note: You must compile the script that #includes Protect.au3 with the latest beta!

Cheers,
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

#3 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,203 posts

Posted 17 May 2006 - 05:17 PM

maybe to make things easier for the original scriptor, you could place this at the top of your script

If @compiled <> 1 then Return

that way they can run/test/edit thier own script without yours creating a problem

just an idea

8)

Edited by Valuater, 17 May 2006 - 05:17 PM.

Posted Image

Clic The Pic!!!


#4 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 17 May 2006 - 08:14 PM

Oh sure, never even thought of that.

Thanks, edited the top :)
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

#5 Knight

Knight

    Prodigy

  • Active Members
  • PipPipPip
  • 155 posts

Posted 17 May 2006 - 08:38 PM

can you explain a little further what exactly you mean by copy protection?

Thanks.

#6 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 18 May 2006 - 03:52 AM

After compilation, the program can be run once before being 'set' so that it can only run on the computer it was first run on. It does this by re-writing part of the EXE.

I think that sums it up...
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

#7 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,850 posts

Posted 18 May 2006 - 01:48 PM

Hi,

doesn't work for me. It always prints out "This exe is copy-protected!".

What I'm doing wrong?

I put this at top of the script.

Protect() MsgBox(64, "Test", "Hello World Mega")


So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#8 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 18 May 2006 - 02:19 PM

I don't see why it wouldn't be working besides the StringInStr functions, as I've never used it before.

Are you compiling before trying your code out?
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

#9 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,850 posts

Posted 18 May 2006 - 02:29 PM

I don't see why it wouldn't be working besides the StringInStr functions, as I've never used it before.

Are you compiling before trying your code out?


HI,

sure I compiled it. And started the exe file. But no chance to reach the "main code", it always jumps out with the Error MsgBox mentioned above.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#10 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 18 May 2006 - 02:32 PM

Confirmed, it's not working.

Wait 10 mins, I'll have it going strong :)
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

#11 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 18 May 2006 - 02:33 PM

GAH it was in the @Compiled...

I had <> 1 instead of = 1

EDIT: I've updated the code o nthe first post. Sorry for that!

Edited by JoshDB, 18 May 2006 - 02:34 PM.

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

#12 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,850 posts

Posted 18 May 2006 - 02:40 PM

GAH it was in the @Compiled...

I had <> 1 instead of = 1

EDIT: I've updated the code o nthe first post. Sorry for that!


Hi,

now it looks better to me. :) I'll have to change a few things, but the idea is great.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#13 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,850 posts

Posted 18 May 2006 - 02:57 PM

Hi,

now it looks better to me. :) I'll have to change a few things, but the idea is great.

So long,

Mega


HI!

No, the problem isn't solved. Don't halloo till you're out of the wood! :(

If you check for If @compiled = 1 then Return your func will do nothing, I suppose.

So long,

Mega

Edit: You have to test your script. It doesn't work. :">

Edited by th.meger, 18 May 2006 - 03:01 PM.

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#14 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,203 posts

Posted 18 May 2006 - 03:57 PM

GAH it was in the @Compiled...

I had <> 1 instead of = 1

EDIT: I've updated the code o nthe first post. Sorry for that!



per help

@compiled
Returns 1 if script is a compiled executable; otherwise, returns 0.


so... the test script i gave you should have been correct

8)

Posted Image

Clic The Pic!!!


#15 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,850 posts

Posted 18 May 2006 - 07:38 PM

per help

@compiled
Returns 1 if script is a compiled executable; otherwise, returns 0.


so... the test script i gave you should have been correct

8)


Hi Valuater,

yeah you idea is great and will work. The problem is, the script itself does not what it should. :)

JoshDB has to test and change a little bit. Maybe I'll try to fix it myself.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#16 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 19 May 2006 - 04:19 PM

Alright, it works now. The first version worked, wierd.

Anyways, just #include the file. It'll pass the #include if a confirmation occurs, if it's the firstrun or an error occurs the program will quit.
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

#17 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,203 posts

Posted 19 May 2006 - 04:52 PM

does it work if the file is copied to a different computer??

meger had mentioned this originally wtih larry's post


8)

Posted Image

Clic The Pic!!!


#18 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,850 posts

Posted 19 May 2006 - 06:50 PM

does it work if the file is copied to a different computer??

meger had mentioned this originally wtih larry's post
8)


Hi,

that is what I expected. You compile the script run it one time. It adds a specific information and won't run on another pc. (In this case, because the mac is differnet)

But it prints out first run, even when I had run it on another pc before.

So, I still doesn't do what I expected. :)

So long,

Mega

@Larry is it poosible to increase the size of the things to add? I want to add @ScriptFullPath, so that if you copy the exe after first run it won't work anymore.

Scripts & functions Organize Includes Let Scite organize the include files *new

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times


#19 JoshDB

JoshDB

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 19 May 2006 - 11:18 PM

You can change $code to get your desired results. As for the length, I don't know, but you CAN use this:

$Code = "X" & StringRight(@ScriptFullPath, 3)

It's very unlikely that the last 3 digits of any given path will be the same.
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

#20 Hello12345

Hello12345

    Seeker

  • Active Members
  • 46 posts

Posted 01 June 2006 - 10:27 PM

I have no idea what happens?
what do i need to change and to what please help? :D


what is this

$Code = "X" & StringRight(@ScriptFullPath, 3)

Edited by Hello12345, 01 June 2006 - 10:28 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users