Sign in to follow this  
Followers 0
civilcalc

Copy Protection

8 posts in this topic

Ok, i have made a script that i want to protect from unauthorised distribution. I have added a function that generates a code based on the serial of the users C drive.

I now want to add the following script

CODE

; 30 Day Trial

; Author MSLx Fanboy

#include<date.au3>

#include<string.au3>

If RegRead("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu") = "" Then

RegWrite("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu", "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName))

SetError(0)

EndIf

$startdate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu"), @ComputerName)

If _DateDiff("D", $startdate, _NowCalc()) > 30 Then

MsgBox(0, "*XPClean Menu*", "You're registration period has expired.")

Exit

EndIf

To add a 30 day trial period, then the user should obtain the unlock code by sending me the code generated from thier serial number.

I am fine up to here.

What i want to know is, is this method fairly safe?? Is it crackable easily?? I know you guys could probably crack it in a few minutes, if not seconds. But for average joe is he going to know where to start?? i believe the above code hides a reg file, that will not disappear if the script is removed. Would someone be able to tell this code has been added, and be able to alter it?? also, if the user changes the date and time on the windows clock, does this trick the computer into thinking the trial has not expired???

Any views or advice would be greatly received, I am fairly new to autoit, but fairly good with it to a point.

Thanks in advance

David

Share this post


Link to post
Share on other sites



Hi,

you could also give a try using LoginWrapper or runOnlyOnThis. Have a look at my sig.

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

Share this post


Link to post
Share on other sites

You're a genius Larry! :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You're a genius Larry! :(

HI,

yes very nice script. But from my point of view it only prevents the user to run the exe twice. I can copy the exe and execute it as often as I wish. :)

So long,

Mega

Edited 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

Share this post


Link to post
Share on other sites

You could rewrite the exe to only run functionally if it's in a certain place.

I.E. write the workingdir on first run, then read it on second run - If they're not in the same place, viola, it's been copied.

(I would use UID's, though - To make sure they're on the same computer, not same place)


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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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 <> StringLeft(MacAddress(),4) Then
    MsgBox(4096,"Self Modifying EXE","This is the first time you have run me." & @LF & _
            @LF & "I am now going to rewrite myself.")
    FileWrite($tempfile,StringTrimRight($buffer,8) & StringLeft(MacAddress(),4) & StringRight($buffer,8))
    Run("""" & $tempfile & """ """ & @ScriptFullPath & """")
Else
    MsgBox(4096,"","This is the same computer! (ID is " & StringLeft(MacAddress(),4) & ")")
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

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

I might turn this into a UDF (:

Edited 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

Share this post


Link to post
Share on other sites

You can rewrite your EXE using beta... You have to be creative to theorize a way of turning that ability into copy protection... but compile this code and run it twice (using latest beta)...

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 <> "$$$$" Then
    MsgBox(4096,"Self Modifying EXE","This is the first time you have run me." & @LF & _
            @LF & "I am now going to rewrite myself.")
    FileWrite($tempfile,StringTrimRight($buffer,8) & "$$$$" & StringRight($buffer,8))
    Run("""" & $tempfile & """ """ & @ScriptFullPath & """")
Else
    MsgBox(4096,"","Modified")
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

There is a position at FileLength - 8 where you can store information...

Lar.

Hi Larry,

Can the position at (FileLength - 8) store only 4 characters? Or can it store more?

Thanks

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0