Jump to content
Sign in to follow this  
IanN1990

Crack My Password :)

Recommended Posts

IanN1990

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.

#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 by IanN1990

Share this post


Link to post
Share on other sites
guinness

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

Share this post


Link to post
Share on other sites
water

Was it written by you, guinness :huh:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
IanN1990

The top code is my work, The _GetHardwareID() is your work

Other 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 by IanN1990

Share this post


Link to post
Share on other sites
guinness

Was it written by you, guinness :huh:

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

Share this post


Link to post
Share on other sites
Melba23

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
IanN1990

@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 by IanN1990

Share this post


Link to post
Share on other sites
Melba23

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

But 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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
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
Sign in to follow this  

×