Jump to content

How to delete the variables after used?


Recommended Posts

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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

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

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 by hiepkhachsg
Link to comment
Share on other sites

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

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

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 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

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 here
RegExp tutorial: enough to get started
PCRE 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

  • Moderators

@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

  • Moderators

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

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...