IanN1990 Posted February 1, 2013 Posted February 1, 2013 (edited) This was simply an idea i came up with this morning. In the past i have seen a few topics of people asking how can they hide passwords, the normal answer being encrypting it. Ofc if a script is decomplied, then u can just decript the password. So i wrote this. expandcollapse popup#include <Crypt.au3> #include <String.au3> $Input = StringRegExpReplace(_StringToHex(InputBox("Password Prompt", "Enter Password", "", "*", 125, 125, @DesktopWidth/2-125, @DesktopHeight/2-125)), "[^0-9]", '') $Key = StringRegExpReplace(_GetHardwareID(7), "[^0-9]", '') If StringTrimRight($Input * $key, 5) = '4.4603447081791' Then ConsoleWrite('You cracked my password :(') Else ConsoleWrite('Better Luck Next Time' & @CRLF) EndIf ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetHardwareID ; Description ...: Generates a unique hardware identifier (ID) for the local computer. ; Syntax ........: _GetHardwareID([$iFlags = Default]) ; Parameters ....: $iFlags - [optional] The flags that specifies what information would be used to generate ID. ; This parameter can be one or more of the following values. ; ; $UHID_MB (0) ; Uses information about your motherboard. This flag is used by default regardless of whether specified or not. ; ; $UHID_BIOS (1) ; Uses information about the BIOS. ; ; $UHID_CPU (2) ; Uses information about the processor(s). ; ; $UHID_HDD (4) ; Uses information about the installed hard drives. Any change in the configuration disks will change ID ; returned by this function. Taken into account only non-removable disks. ; ; $UHID_All (7) ; The sum of all the previous flags. Default is $UHID_MB (0). ; ; $fIs64Bit - [optional] Search the 64-bit section of the registry. Default is dependant on AutoIt bit version. ; Note: 64-bit can't be searched when running the 32-bit version of AutoIt. ; Return values..: Success - The string representation of the ID. @extended returns the value that contains a combination of flags ; specified in the $iFlags parameter. If flag is set, appropriate information is received successfully, ; otherwise fails. The function checks only flags that were specified in the $iFlags parameter. ; Failure - Empty string and sets @error to non-zero. ; Author.........: guinness with the idea by Yashied (_WinAPI_UniqueHardwareID - WinAPIEx.au3) ; Modified ......: Additional suggestions by SmOke_N. ; Remarks .......: The constants above can be found in APIConstants.au3. It also requires Crypt.au3 to be included. ; Example........: Yes ; =============================================================================================================================== Func _GetHardwareID($iFlags = Default, $fIs64Bit = Default) Local $sBit = '' If @AutoItX64 Then $sBit = '64' EndIf If Not ($fIs64Bit = Default) Then $sBit = '' ; Reset to 32-bit. If $fIs64Bit And @AutoItX64 Then $sBit = '64' ; Use 64-bit if $fIs64Bit is True and AutoIt is a 64-bit process. EndIf EndIf If $iFlags = Default Then $iFlags = 0 EndIf Local $aSystem[4] = [3, 'Identifier', 'VideoBiosDate', 'VideoBiosVersion'], _ $iResult = 0, _ $sHKLM = 'HKEY_LOCAL_MACHINE' & $sBit, $sOutput = '', $sText = '' For $i = 1 To $aSystem[0] $sOutput &= RegRead($sHKLM & '\HARDWARE\DESCRIPTION\System\', $aSystem[$i]) Next $sOutput &= @CPUArch $sOutput = StringStripWS($sOutput, 8) If BitAND($iFlags, 0x0001) Then ; $UHID_BIOS Local $aBIOS[6] = [5, 'BaseBoardManufacturer', 'BaseBoardProduct', 'BaseBoardVersion', 'BIOSVendor', 'BIOSReleaseDate'] $sText = '' For $i = 1 To $aBIOS[0] $sText &= RegRead($sHKLM & '\HARDWARE\DESCRIPTION\System\BIOS\', $aBIOS[$i]) Next $sText = StringStripWS($sText, 8) If $sText Then $iResult += 0x0001 $sOutput &= $sText EndIf EndIf If BitAND($iFlags, 0x0002) Then ; $UHID_CPU Local $aProcessor[5] = [4, 'ProcessorNameString', '~MHz', 'Identifier', 'VendorIdentifier'] $sText = '' For $i = 1 To $aProcessor[0] $sText &= RegRead($sHKLM & '\HARDWARE\DESCRIPTION\System\CentralProcessor\0\', $aProcessor[$i]) Next For $i = 1 To $aProcessor[0] $sText &= RegRead($sHKLM & '\HARDWARE\DESCRIPTION\System\CentralProcessor\1\', $aProcessor[$i]) Next $sText = StringStripWS($sText, 8) If $sText Then $iResult += 0x0002 $sOutput &= $sText EndIf EndIf If BitAND($iFlags, 0x0004) Then ; $UHID_HDD $sText = '' Local $aDrives = DriveGetDrive('FIXED') If @error = 0 Then For $i = 1 To $aDrives[0] $sText &= DriveGetSerial($aDrives[$i]) Next EndIf $sText = StringStripWS($sText, 8) If $sText Then $iResult += 0x0004 $sOutput &= $sText EndIf EndIf Local $sHash = StringTrimLeft(_Crypt_HashData($sOutput, $CALG_MD5), 2) If $sHash = '' Then Return SetError(4, 0, '') EndIf Return SetExtended($iResult, StringRegExpReplace($sHash, '(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})', '\{\1-\2-\3-\4-\5\}')) EndFunc ;==>_GetHardwareID So, is anyone able to crack this and figure out my password? *Edit. I do ask no one flames this topic, i know secuirty topics are normally disliked due to the amount over time and the generally fruitfulless of them I also know if someone decomplies a script, they can simply remove any secuirty lines such as the "if" statement so it just runs but that is not the purpose Its to hide a password, so even if they get the script and can make it work. They dont get private data, at lest in theory **Edit. If someone does figure out how to crack it, dont say how you did it Just post the password proving u have Edited February 1, 2013 by IanN1990
guinness Posted February 1, 2013 Posted February 1, 2013 (edited) Please would you kindly link to where you got that code please. Also retain the header that came with that function too, in case someone doesn't understand how to interpret the function. Edited February 1, 2013 by guinness 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
water Posted February 1, 2013 Posted February 1, 2013 Was it written by you, guinness My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
IanN1990 Posted February 1, 2013 Author Posted February 1, 2013 (edited) The top code is my work, The _GetHardwareID() is your workOther functions are Autoit based. I would of perfered using _WinAPi_Hardware ID but installing WinApiEx is a little complex ^^ So i searched for the forums and found ur function in someone elses post. I cant remember the the topic it was in though, sry Edited February 1, 2013 by IanN1990
guinness Posted February 1, 2013 Posted February 1, 2013 Was it written by you, guinness _GetHardwareID() was, but it was loosely based on the idea by Yashied and his API-like function (uses WMI.) I only asked for the link not because I want recognition even though it's polite,) but so people can check for updates if they come across this post in the future. 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
Moderators Melba23 Posted February 1, 2013 Moderators Posted February 1, 2013 IanN1990,As your password check is based on the ID returned by your machine I very much doubt that anyone will be able to crack your password. You are essentially using a one time pad which is generally regarded as uncrackable. However, it does mean that this script will only work on your machine - unless you alter the result of the check for each different machine on which it is to be run. Alas, I completely agree with your comment about this check being worthless in reality as a decompiled script could easily bypass the check. But I am rather at a loss to understand your other comment about "They dont get private data, at lest in theory" - what data are we talking about? Nothing in that script is secure - other than the user-inserted password itself. 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
IanN1990 Posted February 1, 2013 Author Posted February 1, 2013 (edited) @Melba23 Truth be told i wasn't expecting this kind of result, as the general view is secuirty isn't worth it because everyone can bypass it. I just had the idea this , did the research and with the helpfile put the idea into pratice. My first attempt, failed a little because it was this. $Input &= $Key Meaning the "Password", contains the input from the password and the system key. I figured smart people could take the password, strip out the "key" part and from whats left figure out the password. Ego why i made this new one, as the password is a product of the two, and u know nethier. I figured it would be hard to revese engine the password. Though i never expected it to be this full proft. So first part was just an idea, and learning The second part is. Lets say i have a RunAs command, to lauch a program with Admin rights. It would require my password. Meaning if someone got a hold of my exe, they could decomplie it, and get my system password. Thats what i mean by privite info *Thats the only example i could think off the top of my head, but i am sure others might thing of more creative uses for it. Edited February 1, 2013 by IanN1990
Moderators Melba23 Posted February 2, 2013 Moderators Posted February 2, 2013 Lets say i have a RunAs command, to lauch a program with Admin rights. It would require my password. Meaning if someone got a hold of my exe, they could decomplie it, and get my system password. Thats what i mean by privite infoBut you cannot hide the password inside the script. The user will still need to enter it manually as AutoIt (like pretty much all other langugages) is not secure against determined hackers and trying to store passwords in any form inside your script is to be discouraged - even if encrypted as the decryption code is necessarily inside the script as well! The best you can do is do is what you have done and make the password check independent of the actual password. You could do much the same sort of thing by hashing the user input and seeing if it matches a hash of the password stored within the script - and this would be machine-independent to boot. Please do not take my comments as belittling your efforts. All I am trying to do is point out that you should not ever put the actual data into the script if you want it to remain secret. 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
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