Brickoneer Posted August 7, 2007 Share Posted August 7, 2007 (edited) How can you make an autoit script self-destruct? Not as in close, as in erase itself, delete itself, blow itself into infinity never to return, etc. I don't know if this is even possible, but for a program that I'm making that could potentially hold/have access to some confidential material, I would like it to erase itself if someone was trying to access it illegitimately. (this could prevent brute-force entry if it ever got into the wrong hands, as well as some other not so nice things.) Ideas? Thanks in advance! Edited August 7, 2007 by Brickoneer Link to comment Share on other sites More sharing options...
dufran3 Posted August 7, 2007 Share Posted August 7, 2007 Well, first off, the script could not delete itself while running. So you would need a separate .exe to watch over it and perform that. Need more info to provide any help. Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 7, 2007 Share Posted August 7, 2007 From the Support Forum FAQ: 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 Be cautious, it WILL delete your script. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 7, 2007 Moderators Share Posted August 7, 2007 How can you make an autoit script self-destruct? Not as in close, as in erase itself, delete itself, blow itself into infinity never to return, etc.I don't know if this is even possible, but for a program that I'm making that could potentially hold/have access to some confidential material, I would like it to erase itself if someone was trying to access it illegitimately. (this could prevent brute-force entry if it ever got into the wrong hands, as well as some other not so nice things.)Ideas?Thanks in advance!That doesn't make much sense... if they are going to "brute force" it... and it deleted itself... what's to prevent them from getting another copy of it from where ever they got it in the first place (don't think that they will always get it directly from you). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dufran3 Posted August 7, 2007 Share Posted August 7, 2007 lol, true, the person brute forcing this could always create a script that makes a copy and tries the brute force on the copy, and when it deletes itself, do it again. All without touching the keyboard. :-( those sinnners~! Link to comment Share on other sites More sharing options...
Brickoneer Posted August 7, 2007 Author Share Posted August 7, 2007 (edited) That doesn't make much sense... if they are going to "brute force" it... and it deleted itself... what's to prevent them from getting another copy of it from where ever they got it in the first place (don't think that they will always get it directly from you).Thats assuming they knew it deleted itself. No one would know that except me. right? [edit] or I guess they could possibly Reverse Engineer it... though I don't know much about it. [edit 2] anyway... that piece of code you gave me mikehunt114 seems to work great. Thanks! Edited August 7, 2007 by Brickoneer Link to comment Share on other sites More sharing options...
John117 Posted August 7, 2007 Share Posted August 7, 2007 (edited) The best method I have seen was on a post commented on by weaponx Have the script add a delete request to the Scheduled Tasks app in windows for one minute from now. The script ends. Then it's deleted. BTW -He did this with one line of code. Edited August 7, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
John117 Posted August 7, 2007 Share Posted August 7, 2007 Here it is#Include <Date.au3>RunWait ("at " & _DateTimeFormat ( _DateAdd( 'n',1, _NowCalc()), 4) & ' cmd /c del "' & @ScriptDir & '\*.bmp"' )fromhttp://www.autoitscript.com/forum/index.ph...=scheduled+task Link to comment Share on other sites More sharing options...
rudi Posted December 6, 2007 Share Posted December 6, 2007 (edited) Thats assuming they knew it deleted itself. No one would know that except me. right? [edit] or I guess they could possibly Reverse Engineer it... though I don't know much about it. [edit 2] anyway... that piece of code you gave me mikehunt114 seems to work great. Thanks! What do you think about this approach: As stated before, a brute force attack will be possible easyly, so do NOT code your program to delete itself. Code it to just validate only the first 2 password entries. After two wrong password entries it will not check passwords any more, it will only look like it's accepting brute force tries infinite, but in reality it's just thowing one "password wrong" after another, even *IF* the correct password should have been specified... Edited December 6, 2007 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 6, 2007 Share Posted December 6, 2007 From the Support Forum FAQ: This is much easyer ... Exit Func OnAutoItExit() Local $iDelay = 2 Run(@ComSpec & ' /c ping -n ' & $iDelay & ' localhost > nul & del /f /q "' & @ScriptFullPath & '"', '', @SW_HIDE) EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
mikiutama Posted December 6, 2007 Share Posted December 6, 2007 hmm... just to add some more info... even deleted files can be recovered\ revived and they can then make copies and try it again.. the file need to be shred then deleted, probably using fileopen(@ScriptFullPath & @ScriptName, 2) if possible... (using second.exe maybe?) 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