Jump to content
Sign in to follow this  
Chimaera

Pin number or something similar?

Recommended Posts

Hi guys

On a script for work we are wanting to add a pin number for want of a better word so that the techs can just put in 4 digit pin number to gain access to the program.

Its mainly for those that forget to take the software of the machine :(

I was wondering has this kind of thing been done before?, im assuming an array of some kind to hold the pins and put it at the top of the script etc and it checks against it etc

i searched but it seems to bring a lot of rubbish results for it, do you know where there are any simple examples?

Edited by Chimaera

Share this post


Link to post
Share on other sites

Yes so if the customer finds it after the idiot tech left it on the machine then they cant run it without the code kinda thing.

Just to prevent unauthorized use on a simple scale, the end users wont be hacking it or anything

Share this post


Link to post
Share on other sites

So right now the tech just runs the AutoIt application? You want to "PIN" protect this?


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

Is this kind of thing not one of the most basic in AutoIt?

If InputBox("Title","PIN") <> "4321" Then Exit MsgBox(0,"Duh","Fail")
;or loop through an array of pins
Edited by JohnOne

Share this post


Link to post
Share on other sites

Hmm never thought of Inputbox thx

#include <Array.au3>
Global $login = "1234|2345|3456|4567|5678|6789"
Global $alogin = StringSplit($login, "|")
 _ArrayDisplay( $alogin)

For $i = 1 To $alogin[0]
    If InputBox("Login", " Enter Your Pin ", "", "", 200, 130) <> $alogin[$i] Then
        Exit MsgBox(64, "Error", "Incorrect Pin", 2)
        ContinueLoop
    Else
        _Gui()
        ExitLoop
    EndIf
Next

Func _Gui()
    MsgBox(64, "GUI", "Gui Start")
EndFunc ; _Gui()

The only problem i have is it doesn't seem to use anything beyond the first password

Share this post


Link to post
Share on other sites

If InputBox("Login", " Enter Your Pin ", "", "", 200, 130) = $alogin[$i] Then

_Gui()

endif

Func _Gui()

MsgBox(64, "GUI", "Gui Start")

EndFunc ; _Gui()

get rid of else

Edited by JohnOne

Share this post


Link to post
Share on other sites

Your logic is not correct! You check only the 1st pin.

Try this:

#include <Array.au3>
Global $login = "1234|2345|3456|4567|5678|6789"
Global $alogin = StringSplit($login, "|")

$sInput = InputBox("Login", " Enter Your Pin ", "", "", 200, 130)

$bPIN = False
For $i = 1 To $alogin[0]
    If $sInput = $alogin[$i] Then
        $bPIN = True
        ExitLoop
    EndIf
Next

If Not $bPIN Then
    Exit MsgBox(64, "Error", "Incorrect Pin", 2)
Else
    _Gui()
    Exit
EndIf

Func _Gui()
    MsgBox(64, "GUI", "Gui Start")
EndFunc ; _Gui()

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

The loop seems needless from what I can tell. What about the good old fashioned StringInStr?

#include <Constants.au3>

Example()

Func Example()
    Local $sLoginString = '|1234|2345|3456|4567|5678|6789|'
    If StringInStr($sLoginString, '|' & InputBox('Login', ' Enter Your Pin ', '', '*4', 200, 130) & '|', Default) Then
        _GUI()
    Else
        MsgBox($MB_SYSTEMMODAL, '', 'An error occurred with entering the PIN code.')
    EndIf
EndFunc   ;==>Example

Func _GUI()
    MsgBox($MB_SYSTEMMODAL, '', 'GUI code is here.')
EndFunc   ;==>_GUI
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

....

#include <Constants.au3>

Example()

Func Example()
    Local $sLoginString = '1234|2345|3456|4567|5678|6789|'
    If StringInStr($sLoginString, InputBox('Login', ' Enter Your Pin ', '', '', 200, 130) & '|', Default) Then
        _GUI()
    Else
        MsgBox($MB_SYSTEMMODAL, '', 'An error occurred with entering the PIN code.')
    EndIf
EndFunc ;==>Example

Func _GUI()
    MsgBox($MB_SYSTEMMODAL, '', 'GUI code is here.')
EndFunc ;==>_GUI

InputBox and password - one of the parameters can be "", "*", "*4", or "#4" - for everyone's information.

As in the line:-

If StringInStr($sLoginString, InputBox('Login', ' Enter Your four (4) digit Pin ', '', '*4', 200, 130) & '|', Default) Then

Share this post


Link to post
Share on other sites

True. Thanks Malkey.

I updated the code above.

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

If the computers have network access, I would do something like this, so you don't have to update the executable if you add a new tech:

ini file somewhere on the network:

[Technicians]
4149=Bob
4150=Jim
4151=Sam

autoit script:

$PIN = InputBox("Log into my App", "Please enter your 4-digit pin", "", "*M4")
$val = IniRead(@DesktopDir & "\test.ini", "Technicians", $PIN, "")

 If $val <> "" Then
  MsgBox(0, "My App Accessed", "Welcome " & $val)
 Else
  MsgBox(0, "Error", "Incorrect PIN, please try again")
 EndIf

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  

×
×
  • Create New...