JoshDB Posted May 17, 2006 Share Posted May 17, 2006 (edited) expandcollapse popup; ---------------------------------------------------------------------------- ; ; 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 May 19, 2006 by JoshDB 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 Link to comment Share on other sites More sharing options...
JoshDB Posted May 17, 2006 Author Share Posted May 17, 2006 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 Link to comment Share on other sites More sharing options...
Valuater Posted May 17, 2006 Share Posted May 17, 2006 (edited) 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 May 17, 2006 by Valuater Link to comment Share on other sites More sharing options...
JoshDB Posted May 17, 2006 Author Share Posted May 17, 2006 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 Link to comment Share on other sites More sharing options...
Knight Posted May 17, 2006 Share Posted May 17, 2006 can you explain a little further what exactly you mean by copy protection? Thanks. Link to comment Share on other sites More sharing options...
JoshDB Posted May 18, 2006 Author Share Posted May 18, 2006 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 Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 18, 2006 Share Posted May 18, 2006 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 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 Link to comment Share on other sites More sharing options...
JoshDB Posted May 18, 2006 Author Share Posted May 18, 2006 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 Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 18, 2006 Share Posted May 18, 2006 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 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 Link to comment Share on other sites More sharing options...
JoshDB Posted May 18, 2006 Author Share Posted May 18, 2006 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 Link to comment Share on other sites More sharing options...
JoshDB Posted May 18, 2006 Author Share Posted May 18, 2006 (edited) 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 May 18, 2006 by JoshDB 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 Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 18, 2006 Share Posted May 18, 2006 GAH it was in the @Compiled...I had <> 1 instead of = 1EDIT: 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 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 Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 18, 2006 Share Posted May 18, 2006 (edited) Hi,now it looks better to me. I'll have to change a few things, but the idea is great. So long,MegaHI!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,MegaEdit: You have to test your script. It doesn't work. :"> Edited May 18, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files 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 Link to comment Share on other sites More sharing options...
Valuater Posted May 18, 2006 Share Posted May 18, 2006 GAH it was in the @Compiled...I had <> 1 instead of = 1EDIT: 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 correct8) Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 18, 2006 Share Posted May 18, 2006 per help@compiled Returns 1 if script is a compiled executable; otherwise, returns 0. so... the test script i gave you should have been correct8)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 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 Link to comment Share on other sites More sharing options...
JoshDB Posted May 19, 2006 Author Share Posted May 19, 2006 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 Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 does it work if the file is copied to a different computer?? meger had mentioned this originally wtih larry's post 8) Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 19, 2006 Share Posted May 19, 2006 does it work if the file is copied to a different computer??meger had mentioned this originally wtih larry's post8)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 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 Link to comment Share on other sites More sharing options...
JoshDB Posted May 19, 2006 Author Share Posted May 19, 2006 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 Link to comment Share on other sites More sharing options...
Hello12345 Posted June 1, 2006 Share Posted June 1, 2006 (edited) I have no idea what happens? what do i need to change and to what please help? what is this $Code = "X" & StringRight(@ScriptFullPath, 3) Edited June 1, 2006 by Hello12345 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now