Jump to content

Self Destroying Executable - Is there a way?


SXGuy
 Share

Recommended Posts

Im currently wrtiting an autoit script which checks the user's HardwareID amongst other things, for validation, in regards to whether the user has rights to install/run the application.

But what i would like to know, if there is any way the application can terminate itself and delete its self if it doesnt match a user's HardwareID to the one the application is set to run on?

So basically, the application checks the users HardwareID before it runs or installs, if theres not a match, sets a note to destroy itself before terminating?

Edited by SXGuy
Link to comment
Share on other sites

Straight from the FAQs page, this should help with the auto delete part of the script.

Q12. How can I have the script delete itself?

A1. The following code can delete a running script.

WARNING: Make a copy of your script before calling this function!!!

Func _SelfDelete($iDelay = 0)
    Local $sCmdFile
    FileDelete(@TempDir & "\scratch.bat")
    $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _
            & ':loop' & @CRLF _
            & 'del "' & @ScriptFullPath & '"' & @CRLF _
            & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
            & 'del ' & @TempDir & '\scratch.bat'
    FileWrite(@TempDir & "\scratch.bat", $sCmdFile)
    Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE)
EndFunc

Edit: spelling errors

Edited by schilbiz
Link to comment
Share on other sites

Im currently wrtiting an autoit script which checks the user's HardwareID amongst other things, for validation, in regards to whether the user has rights to install/run the application.

But what i would like to know, if there is any way the application can terminate itself and delete its self if it doesnt match a user's HardwareID to the one the application is set to run on?

So basically, the application checks the users HardwareID before it runs or installs, if theres not a match, sets a note to destroy itself before terminating?

...aaaaand if he runs it from a CD? Or a USB stick with a ReadOnly switch? What difference does deleting the executable make? :P

Still, there are plenty of options to leave a command shell running a batch file that deletes the script or some such. Or you could leave a RunOnce task behind. Or you could put a RunOnce task in the scheduler, etc.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Maybe you could write a script that will use the laser in the cd drive to burn through the disk, rendering it useless.

Hehe that would be a great idea :P

Oh My, look what I got.

What do you got?

The new CD of Monkeys in Space.

WOW!

Come lets play it.

*Putting it in*

BZROEM

Wow dude.

Some laser burned my CD.

*Cries*

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Maybe you could write a script that will use the laser in the cd drive to burn through the disk, rendering it useless.

Put it in the shark tank -- the one that has sharks with frick'n...

Well, you get the idea.

:P

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...