6 posts in this topic

zalomalo 2

he gave me an idea and i did another one for autodelete for some compiled scripts i dont want to execute out of his intended directory (privileges stuff). Thanks

; #FUNCTION# ====================================================================================================================; Name .......: __AutoSelfDelete; Author: Zalomalo, inspired in guinness's _SelfRename.; Description.: AutoDelete executing script because unauthorized bad conditions (bad finemame, wrong path, etc.).; The purpose is it autodelete as fast as possible and force relog session after return this function, and exiting.; Is assumed the script is running compiled (exe), and all conditions have been set before.; Do no error comprobations since have no sense for this purposes.; Parameters: $iDelay [optional] An integer value for the delay to wait (in seconds) before beging trying to delete the executable.; Return values: Success - Returns the PID of the bat file.; Failure - Returns 0 & sets @error to non-zero; -------------------------------------------------------------------------------------------------------------------------------Func__AutoSelfDelete($iDelay=1)IfNotStringInStr(@ScriptName,'.exe',2)ThenReturnLocal$sTmpBat=@TempDir&'\TmpFile.bat'WhileFileExists($sTmpBat)$sTmpBat=@TempDir&'\TmpFile'&Chr(Random(65,122,1))&'.bat'WEndLocalConst$sTmpBatData='@ECHO OFF'&@CRLF_&'PING -n '&Int($iDelay)&' -w 1000 127.0.0.1>nul'&@CRLF_&'TASKKILL /PID '&@AutoItPID&' /F'&@CRLF_; The script must have been exited allready, just by the case&'DEL /F /Q "'&@AutoItExe&'"'&@CRLF_&'DEL /F /Q "'&@TempDir&'\*.bat"'LocalConst$hfBat=FileOpen($sTmpBat,2)FileWrite($hfBat,$sTmpBatData)FileClose($hfBat)ReturnRun($sTmpBat,@TempDir,@SW_HIDE)EndFunc;==>__AutoSelfDelete

Share this post

Link to post

Share on other sites

zalomalo 2

Guinnness's one is _SelfRename(). Well, the purpose is totally diferent. Mine is much more simpler and faster because the needs. I put the context where i going to using it, (autodeleting the script, relog windows sesion without any track) so you can realise:

Sign in

Similar Content

Afternoon!
Just a quick one as this has dawned on me recently when creating a little program. When calling an executable I've created like Run(otherapp.exe) from within my executable is there a best practice to ensure things have gone smoothly? So for example, should I monitor the PID to ensure it runs and closes within an acceptable timeframe? Or within my other executable should I do EXITs in a certain way after functions and return codes etc?
Could be a silly question but thought I'd ask.

Hello,
I compiled a script I made that takes a command line parameter (the version of a .msi installer) when launched. The script was compiled with the /console option. The script (.au3) works fine but the executable returns the following error:
Error: array variable has incorrect number of subscripts or subscript dimension range exceeded

How to retrieve the target executable path from a process.
My system is effected with IMG001.exe virus and I remove the folders created by it daily but still it is creating the folders everytime I login to my PC.
My Antivirus is not detecting it.

So I thought to create a process in AutoIT to check for the process name IMG001.exe and retrieve the process target exe to a log file, so that I can track where it is putting these files.
With ProcessExists ( "process" ) , i can get the process ID.
But how to get the target location of the executable of the process.??