Sign in to follow this  
Followers 0
Queener

3 attempts

5 posts in this topic

Not sure if this is how you really phrase it (Self Destruction), but was wondering if it's possible to code it to allow user to use the executable file 3 times only. If the 3rd time reached, the executable no longer works. Even if the executable is transferred to another computer, it won't work if the 3rd tries is attempted. 

From what I can see and what I might be facing is, the executable has to at least identify the pc, write a note/reg to know how many times it tried. But this method if transferred to another computer; it counts from 0 again.

So I would assuming a server-sided would need to get involve. The executable file will need to be assigned with a unique id or serial number. Once it verified with the server of how many attempts it did; it will then lock the executable.

If anybody know of a better way or simplier ways; let me know.

So for example on how I want this code to be

[security count open]

[if opened count =< 3 then]

[run the given commands/code]

[else]

[mgs "3rd time attempt has reached"]

[exit]


Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hmmm, interesting. Ok here is my idea:

$sPassword = "password"
$i = 0

While 1
    $sCheckPass = InputBox("MyTool", "Please enter the password:", "", "*")
    If Not StringInStr($sCheckPass, $sPassword) Then 
        $i += 1
        If $i >= 3 Then 
            Run("DestroyScript.exe " & @ScriptFullPath & " password")
            Exit
        EndIf
        ContinueLoop
    EndIf                
    ExitLoop
WEnd

DestroyScript.exe:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Crypt.au3>

If $CmdLine[0] < 1 Then
    ConsoleWrite(@ScriptName & @CRLF & "Usage:" & @CRLF & @ScriptName & " <full path to file> <password>" & @CRLF)
    Exit
EndIf

DestroyScript()

Func DestroyScript()

    $sFileToDestroy = $CmdLine[1]
    $sPassword = _Crypt_DeriveKey($CmdLine[2], $CALG_AES_256)

    If ProcessExists($sFileToDestroy) Then ProcessClose($sFileToDestroy)
    _Crypt_EncryptFile($sFileToDestroy, $sFileToDestroy & ".enc", $sPassword, $CALG_AES_256)
    FileDelete($sFileToDestroy)
    FileMove($sFileToDestroy & ".enc", $sFileToDestroy)

EndFunc
Edited by 0xdefea7

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I would agree with JohnOne on this one. Nice example from 0xdefea7, but if you want a robust solution you're going to have to do something external to the system - registry entries, ini files, Event Viewer entries, all can be tracked down and deleted.

I have not used it personally, but have heard Valuater's XProTec suggested before, might be something to look into:

'?do=embed' frameborder='0' data-embedContent>>

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

very useful 0xdefea7 and JLogan3o13 info. Interesting; didn't know XProTec exist. Thanks for the info :D

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

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