gcue Posted April 21, 2016 Share Posted April 21, 2016 hello =) is there any way to get a variable's name as it is passed through a function? ie: $final_result = "4652" Get_Variable($final_result) Func Get_Variable($variable="") Endfunc how do i get "$final_result"? i know Get_Variable("$final_result", $final_result) would give me both the variable name and value but i'm trying to see if there's another way thanks in advance! jay97 1 Link to comment Share on other sites More sharing options...
guinness Posted April 21, 2016 Share Posted April 21, 2016 Why would you want to do that? There seems no logical reason in my book. jay97 and mLipok 1 1 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...
BrewManNH Posted April 21, 2016 Share Posted April 21, 2016 There is no other way that I am aware of, you'd have to write it yourself to tell you what variable you're passing. And as you've demonstrated, it's not that hard to do. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
gcue Posted April 21, 2016 Author Share Posted April 21, 2016 debugging purposes.. if i am printing out multiple variables - trying to get a clearer picture of what im looking at - instead of just results for multiple variables. Link to comment Share on other sites More sharing options...
InunoTaishou Posted April 21, 2016 Share Posted April 21, 2016 Global $iNum1 = 128 Global $iNum2 = 256 MsgBox(64, "Sum", "The sum is " & Add($iNum1, $iNum2, "$iNum1", "$iNum2")) Func Add($iVal1, $iVal2, $sName1 = "", $sName2 = "") ConsoleWrite($sName1 & " being added with " & $sName2 & @CRLF) Return $iVal1 + $iVal2 EndFunc Link to comment Share on other sites More sharing options...
nitekram Posted April 21, 2016 Share Posted April 21, 2016 I found this...might get you on the right track 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Trong Posted April 21, 2016 Share Posted April 21, 2016 If you can do that, it will be very easy to decompile AutoItScript. I do not like this! Regards, Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 21, 2016 Moderators Share Posted April 21, 2016 You, AutoIt is hardly the most secure language in the first place - I really do not feel that this functionality (were it ever to be incorporated) would make a lot of difference. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Trong Posted April 21, 2016 Share Posted April 21, 2016 (edited) So I would expect that someone will solve this issue and your script will never be safe again. Or feel free to if you feel it is unnecessary. I believe that you have never tried to decompiling few AutoIt programs. I do not want someone to edit my script without my permission. I did learn how to AutoIt work. It is easy to decompile. I choose the solution is use Obfuscator. Of course, nothing is safe absolutely. Discussions or actions that violate rules are not welcome. P/S: I said earlier that "deCompile" I mean "deObfuscator" Edited April 21, 2016 by You Regards, Link to comment Share on other sites More sharing options...
BrewManNH Posted April 21, 2016 Share Posted April 21, 2016 Seriously doubt anything written in AutoIt is going to ever be any more secure than anything written in any other language. Obfuscator's are NOT security, it's just changing variable/function names, no one cares what you called a variable, it's what the variable contains that's important. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Trong Posted April 21, 2016 Share Posted April 21, 2016 (edited) Yeah, I also believe it is not safe. But Obfuscator not just rename the variables and functions. My program when Obfuscated: NetworkAdapterInfo_Obfuscated.au3 I do not think anybody wants to decompile and deObfuscator it. Edited April 21, 2016 by VIP Execute($Variables) Regards, Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 21, 2016 Moderators Share Posted April 21, 2016 Everyone, This thread risk moving very quickly into dangerous territory - let us all take a deep breath and get back on topic. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
iamtheky Posted April 21, 2016 Share Posted April 21, 2016 (edited) $final_result = "4652" msgbox(0, '' , Get_Variable("4652")) Func Get_Variable($Value) return StringRegExp(fileread(@ScriptFullPath) , '(\$.*?) = "' & $Value & '"' , 3)[0] Endfunc And all the conversation about this adding an attack vector is nonsensical Edited April 21, 2016 by iamtheky stupid grammar ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
czardas Posted April 21, 2016 Share Posted April 21, 2016 (edited) It's a one time, one hit, wonder. LOL Edited April 21, 2016 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
iamtheky Posted April 21, 2016 Share Posted April 21, 2016 (edited) did i misunderstand the OP's request (again)? I used all my one hit wonder in celebration of 4/20 yesterday Edited April 21, 2016 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
gcue Posted April 21, 2016 Author Share Posted April 21, 2016 (edited) hi iamtheky, that only works if something like this statement exists.. $final_result = "4652" but wont work if something like this exists.. $final_result = stringreplace($string, "car", "") very creative try though! Edited April 21, 2016 by gcue Link to comment Share on other sites More sharing options...
czardas Posted April 21, 2016 Share Posted April 21, 2016 Indeed: plenty of problems here. Global $final_result = "1234" For $i = 0 To 1 WhatIs($final_result) Next Func WhatIs(ByRef $vThis) msgbox(0, '' , Get_Variable($vThis)) $vThis -= 1 EndFunc Func Get_Variable($Value) Local $aRet = StringRegExp(fileread(@ScriptFullPath) , '(\$.*?) = "' & $Value & '"' , 3) Return @error ? False : $aRet[0] Endfunc operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Trong Posted April 21, 2016 Share Posted April 21, 2016 Not work: Global $final_result = MyVariable() MsgBox(0, Get_Variable($final_result), Get_Variable("4652")) Func Get_Variable($Value) Local $aRet = StringRegExp(fileread(@ScriptFullPath) , '(\$.*?) = "' & $Value & '"' , 3) Return @error ? False : $aRet[0] Endfunc Func MyVariable() ;~ Return BinaryToString('0x34353632') Return "4652" EndFunc Regards, Link to comment Share on other sites More sharing options...
iamtheky Posted April 21, 2016 Share Posted April 21, 2016 Are we really listing all the ways it doesnt work? Instead of acknowledging that I aced an answer to Post #1 at slot #13, yall had nothing but bloviating about safety. Im about to include the scope creep at #16 ftw too. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
JohnOne Posted April 21, 2016 Share Posted April 21, 2016 GetTheVariableNameOfThis(StringSplit("word", "")) Func GetTheVariableNameOfThis($Value) MsgBox(0,0, VarGetType($Value)) Endfunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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