hiepkhachsg Posted April 10, 2016 Share Posted April 10, 2016 Hi all, i wonder how to delete the variables after used in my script? I just found the delete object function only. Does anyone know it, pls advice. Thanks. Link to comment Share on other sites More sharing options...
guinness Posted April 10, 2016 Share Posted April 10, 2016 Do you know what a variable actually is? To remove the data the variable contains just set to 0 or an empty string. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
hiepkhachsg Posted April 10, 2016 Author Share Posted April 10, 2016 Hi, i do not mean changing or deletetting content in a variable. I mean deleting the memory address of variable (or the pointer to the variable). I know when a variable is declared, the program or Windows will create a memory address for this variable, so you can call and use this variable at anytime. A man can base on this memory address of the variable to debug & see what happened or was in it before. I don't want they reverting follow this to debug, so i want to delete this immediately after used, disappearing without trace. Link to comment Share on other sites More sharing options...
AutoBert Posted April 10, 2016 Share Posted April 10, 2016 from Helpfile: Quote Scope A variable's scope is controlled by when and how you declare the variable. If you declare a variable at the start of your script and outside any functions it exists in the global scope and can be read or changed from anywhere in the script. If you declare a variable inside a function it is in local scope and can only be used within that same function. Variables created inside functions are auJasperatically destroyed when the function ends. By default when variables are declared using Dim or assigned in a function they have local scope unless there is a global variable of the same name (in which case the global variable is reused). This can be altered by using the Local and Global keywords to declare variables and force the scope you want. Btw. Leo and i don't know the word "auJasperatically" should be automatically? Link to comment Share on other sites More sharing options...
hiepkhachsg Posted April 10, 2016 Author Share Posted April 10, 2016 (edited) I know what is global or local. I mean here is free memory address of a variable. For example, if you declare a global variable, it will remain exist during the program running unless you exit program. During that time, a man can hook this address, read memory, control, change or see what happen with this variable. The same with local while a function is running. For the simply understand, i give a example here : when need, i declare a global variable, use it, after use immediately delete that variable. And if i re-use that variable (for example, assign new content to that variable) , there will be a warning "variable is used before declare", program don't know what a variable is! That variable seem did not exist and used. Edited April 10, 2016 by hiepkhachsg Link to comment Share on other sites More sharing options...
AutoBert Posted April 10, 2016 Share Posted April 10, 2016 When you like to have small memory usage of your script, use in funcs local variables, thats the statement i would give by quoting helpfile, as you can't delete a variable. Or put all data like CtrlIDs in array's: element can be deleted. Link to comment Share on other sites More sharing options...
hiepkhachsg Posted April 10, 2016 Author Share Posted April 10, 2016 First is for free up memories. Second is for the security matter. Some my variable content security info so i don't want it exist a long time with program, so i want delete it after used. Now, i know can not delete it (Really?!). I will change direction to other ways. Thanks. Link to comment Share on other sites More sharing options...
reb Posted April 10, 2016 Share Posted April 10, 2016 12 hours ago, guinness said: Do you know what a variable actually is? To remove the data the variable contains just set to 0 or an empty string. Why would this not work? It seems like your "security info" would not exist but only the new values placed there. MEASURE TWICE - CUT ONCE Link to comment Share on other sites More sharing options...
hiepkhachsg Posted April 11, 2016 Author Share Posted April 11, 2016 You don't know hack so you don't understand. They can base on memory address to trace back again what relative before! That's all. Link to comment Share on other sites More sharing options...
AutoBert Posted April 11, 2016 Share Posted April 11, 2016 It will be easier to find the wanted data in script as finding in memory. Link to comment Share on other sites More sharing options...
hiepkhachsg Posted April 11, 2016 Author Share Posted April 11, 2016 If data is binary & encrypted, which way is easier ? Up to your thinking. Topic closes here. Thanks. Link to comment Share on other sites More sharing options...
binhnx Posted April 11, 2016 Share Posted April 11, 2016 (edited) So do you know hack? Are there something different from set the variable to 0 (which is, in AutoIt, also free the memory in which that variable is stored) and delete the variable pointer and memory (which is, also clean the memory)? When a hacker find the pointer, even you deleted it (the pointer only), she can read the memory pointed by it. Just free the memory as soon as you are done and you are safe. When you still operate with the variable you still expose the variable to hacker. All we can do is minimize the chance, we cannot prevent them. Edited April 11, 2016 by binhnx 99 little bugs in the code 99 little bugs! Take one down, patch it around 117 little bugs in the code! Link to comment Share on other sites More sharing options...
hiepkhachsg Posted April 11, 2016 Author Share Posted April 11, 2016 Yes, i know a little about hack. I had did it a long time ago, so i want clear it in memory without tracing. Link to comment Share on other sites More sharing options...
jchd Posted April 11, 2016 Share Posted April 11, 2016 Overwrite your variables over their full used size with random gribberish, then reassign 0 to them as soon as possible. Don't reassign strings to "" since that doesn't actually free the used space. Now that doesn't prevent spying by a determined opponent; there is nothing that can 100% prevent snoopping. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 11, 2016 Moderators Share Posted April 11, 2016 @hiepkhachsg you have received a number of answers to your question. If these are not sufficient, please provide more information of exactly what you are trying to do, and why simply overwriting the variable's value won't work. Be forewarned, if this slides into a "how to protect my script from hacking/decompilation/etc." discussion, it is going to be locked, as that question has been asked and answered too many times to count. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
hiepkhachsg Posted April 12, 2016 Author Share Posted April 12, 2016 (edited) I think that's enough. Topic's closed here (2nd time ). Thanks for all. Edited April 12, 2016 by hiepkhachsg Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 12, 2016 Moderators Share Posted April 12, 2016 Topics don't close unless deemed necessary by the moderating team, you may modify the title in your original post with [Solved] to let users know you received the answer(s) you were looking for. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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