Jump to content



Photo

Password Saver (Secure!)


  • Please log in to reply
11 replies to this topic

#1 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 09 September 2010 - 05:10 PM

Hi!
I use different passwords and usernames for a bunch of stuff.
Sometimes I go to a website and then forget what the password or username was ;).
So I made this. It's a simple but neat program that saves your username and password under a title.
Note:
-There's no login button, the script just goes on when the input contains the correct password. (a login button isn't necessary in my opinion)
-This program stores all usernames and passwords (encrypted though) in: @AppDataDir&'\userlist.txt'
-It stores all questions and answers in @AppDataDir&'\questionlist.txt'
-When you forgot your password and make a mistake filling out the fields, you can't use the program for an hour.



Here it is:
AutoIt         
#cs ----------------------------------------------------------------------------  AutoIt Version: 3.3.6.1  Author:         Ludocus  Script Function:     Password saver #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <String.au3> #include <GuiListBox.au3> #include <File.au3> #include <Array.au3> $_Passwords = '' $_Usernames = '' $_Titles = '' $_Userlist = @AppDataDir&'\userlist.txt' $_Questionlist = @AppDataDir&'\Questionlist.txt' $_Banfile = @TempDir&'\Banfile.txt' if FileExists($_Banfile) Then     $_Splitz = StringSplit(FileRead($_Banfile), ' ', 1)     if $_Splitz[1] = @YDAY Then         if $_Splitz[2] > @HOUR then             Exit         EndIf     EndIf EndIf global $_RandomQuestions[5] = ['A cat, a piano or a dolphin?', 'How long is your private jet?', '((400-98+291)/2)*8.5 = ?', 'Are you taking over the world right now?', 'A duck, a hawk and a bear. Pick the odd one out'] if not FileExists($_Userlist) or not FileExists($_Questionlist) Then     $_FirstSteps = GUICreate("Password Saver, first steps", 315, 396, 193, 125)     $_Label1 = GUICtrlCreateLabel("Welcome to Password Saver", 80, 8, 141, 17)     $_PassInput3 = GUICtrlCreateInput("", 88, 64, 121, 21)     $_Label2 = GUICtrlCreateLabel("Please enter a password:", 88, 40, 123, 17, $ES_PASSWORD)     $_Label3 = GUICtrlCreateLabel("These are some questions for when you forget you password:", 16, 104, 293, 17)     $_Label4 = GUICtrlCreateLabel("1:", 70, 142, 13, 17)     $_Question1Input = GUICtrlCreateInput("Question 1", 88, 128, 121, 21)     $_Answer1Input = GUICtrlCreateInput("Answer 1", 88, 152, 121, 21)     $_Label5 = GUICtrlCreateLabel("2:", 70, 198, 13, 17)     $_Question2Input = GUICtrlCreateInput("Question 2", 88, 184, 121, 21)     $_Answer2Input = GUICtrlCreateInput("Answer 2", 88, 208, 121, 21)     $_Label6 = GUICtrlCreateLabel("3:", 70, 254, 13, 17)     $_Question3Input = GUICtrlCreateInput("Question 3", 88, 240, 121, 21)     $_Answer3Input = GUICtrlCreateInput("Answer 3", 88, 264, 121, 21)     $_Label7 = GUICtrlCreateLabel("When you forget your password you will be asked 3 fake questions and one of the three you just filled out, when you are asked a fake one, just enter nothing. When it is a question you just filled out, answer it.", 16, 304, 271, 55)     $_SaveBut = GUICtrlCreateButton("Save", 120, 368, 75, 25, 0)     GUISetState(@SW_SHOW)         While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit                     Case $_SaveBut             $_Password1 = GUICtrlRead($_PassInput3)             $_Question1 = GUICtrlRead($_Question1Input)             $_Answer1 = GUICtrlRead($_Answer1Input)             $_Question2 = GUICtrlRead($_Question2Input)             $_Answer2 = GUICtrlRead($_Answer2Input)             $_Question3 = GUICtrlRead($_Question3Input)             $_Answer3 = GUICtrlRead($_Answer3Input)             if $_Password1 <> '' and $_Question1 <> '' and $_Answer1 <> '' and $_Question2 <> '' and $_Answer2 <> '' and $_Question3 <> '' and $_Answer3 <> '' Then                 FileWrite($_Userlist, _StringEncrypt(1, $_Password1, 'secrez'))                 FileWrite($_Questionlist, _StringEncrypt(1, $_Question1, 'quisz')&' <-=-> '&_StringEncrypt(1, $_Answer1, 'quisz')&@CRLF&_StringEncrypt(1, $_Question2, 'quisz')&' <-=-> '&_StringEncrypt(1, $_Answer2, 'quisz')&@CRLF&_StringEncrypt(1, $_Question3, 'quisz')&' <-=-> '&_StringEncrypt(1, $_Answer3, 'quisz'))                 msgbox(32, 'Succes', 'Data saved!')                 GUIDelete($_FirstSteps)                 ExitLoop             Else                 msgbox(16, 'Fail', 'Please fill out every field')             EndIf     EndSwitch WEnd Else     $_Password1 = _StringEncrypt(0, FileReadLine($_Userlist, 1), 'secrez') EndIf $_Width1 = 170 $_Height1 = 80 $_PasswordGUI = GUICreate("Pass Save", $_Width1, $_Height1, _Mid($_Width1), _Mid('', $_Height1)) $_PassLabel1 = GUICtrlCreateLabel("Please enter password:", 24, 8, 114, 17) $_PassInput1 = GUICtrlCreateInput("", 24, 30, 121, 21, $ES_PASSWORD) $_ForgotBut = GUICtrlCreateButton('I forgot', 60, 55, 50, 25) GUISetState(@SW_SHOW) While 1     if GUICtrlRead($_PassInput1) = $_Password1 then         GUIDelete($_PasswordGUI)         exitloop     EndIf     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit                     Case $_ForgotBut             GUIDelete($_PasswordGUI)             _ForgotPass()     EndSwitch     sleep(50) WEnd $_Width2 = 320 $_Height2 = 175 $_MainGUI = GUICreate("Password Saver", $_Width2, $_Height2, _Mid($_Width2), _Mid('', $_Height2)) $_List = GUICtrlCreateList("", 0, 0, 140, 180) $_TitleLabel = GUICtrlCreateLabel("Title:", 155, 5, 55, 17) $_TitleInput = GUICtrlCreateInput("", 155, 22, 150, 21) $_UsernameLabel = GUICtrlCreateLabel("Username:", 155, 48, 55, 17) $_UsernameInput = GUICtrlCreateInput("", 155, 65, 150, 21) $_PassLabel2 = GUICtrlCreateLabel("Password:", 155, 95, 53, 17) $_PassInput2 = GUICtrlCreateInput("", 155, 112, 150, 21) $_AddChangeBut = GUICtrlCreateButton('Add', 140, 142, 45, 23) $_NewBut = GUICtrlCreateButton('New', 185, 142, 45, 23) GUICtrlSetState(-1, $GUI_DISABLE) $_CopyBut = GUICtrlCreateButton('Copy', 230, 142, 45, 23) GUICtrlSetState(-1, $GUI_DISABLE) $_DelBut = GUICtrlCreateButton('Del', 275, 142, 45, 23) GUICtrlSetState(-1, $GUI_DISABLE) _LoadList() GUISetState(@SW_SHOW) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit                     Case $_List             $_ReadList = GUICtrlRead($_List)             if $_ReadList <> '' Then                 $_Curnum = _ArraySearch($_Titles, $_ReadList)                 GUICtrlSetData($_AddChangeBut, 'Change')                 GUICtrlSetState($_NewBut, $GUI_ENABLE)                 GUICtrlSetState($_CopyBut, $GUI_ENABLE)                 GUICtrlSetState($_DelBut, $GUI_ENABLE)                 GUICtrlSetData($_TitleInput, $_ReadList)                 GUICtrlSetData($_UsernameInput, $_Usernames[$_Curnum])                 GUICtrlSetData($_PassInput2, $_Passwords[$_Curnum])             EndIf                     Case $_AddChangeBut             if GUICtrlRead($_AddChangeBut) = 'Add' Then                 $_Username = GUICtrlRead($_UsernameInput)                 $_Password = GUICtrlRead($_PassInput2)                 $_Title = GUICtrlRead($_TitleInput)                 if $_Username = '' or $_Password = '' or $_Title = '' Then                     msgbox(16, 'Fail', 'Please enter a username and a password')                 Else                     $_Username = _StringEncrypt(1, $_Username, 'secrez1')                     $_Password = _StringEncrypt(1, $_Password, 'secrez2')                     $_Split = StringSplit(FileRead($_Userlist), @CRLF, 1)                     if $_Split[$_Split[0]] = '' Then                         FileWrite($_Userlist, $_Title&' <-=-> '&$_Username&' <-=-> '&$_Password)                     Else                         FileWrite($_Userlist, @CRLF&$_Title&' <-=-> '&$_Username&' <-=-> '&$_Password)                     EndIf                 EndIf                 _LoadList()             Else                 $_Username = GUICtrlRead($_UsernameInput)                 $_Password = GUICtrlRead($_PassInput2)                 $_Title = GUICtrlRead($_TitleInput)                 if $_Username = '' or $_Password = '' or $_Title = '' Then                     msgbox(16, 'Fail', 'Please enter a username and a password')                 Else                     $_Usernamez = _StringEncrypt(1, $_Username, 'secrez1')                     $_Passwordz = _StringEncrypt(1, $_Password, 'secrez2')                     _FileWriteToLine($_Userlist, $_Curnum+1, $_Title&' <-=-> '&$_Usernamez&' <-=-> '&$_Passwordz, 1)                     _LoadList()                     GUICtrlSetData($_UsernameInput, $_Username)                     GUICtrlSetData($_PassInput2, $_Password)                     GUICtrlSetData($_TitleInput, $_Title)                 EndIf             EndIf                 Case $_NewBut             GUICtrlSetState($_NewBut, $GUI_DISABLE)             GUICtrlSetState($_CopyBut, $GUI_DISABLE)             GUICtrlSetState($_DelBut, $GUI_DISABLE)             GUICtrlSetData($_AddChangeBut, 'Add')             GUICtrlSetData($_UsernameInput, '')             GUICtrlSetData($_PassInput2, '')             GUICtrlSetData($_TitleInput, '')                     Case $_CopyBut             If ClipPut('Title: '&GUICtrlRead($_TitleInput)&@CRLF&'Username: '&GUICtrlRead($_UsernameInput)&@CRLF&'Password: '&GUICtrlRead($_PassInput2)&@CRLF&@CRLF&'Password Saver © Ludocus') Then                 msgbox(32, 'Information copied', 'Your information has been copied to the clipboard'&@CRLF&@CRLF&'Press CTRL+V somewhere to view it')             Else                 msgbox(16, 'Error', 'Something went wrong.'&@CRLF&'The information is not copied to your clipboard')             EndIf                     Case $_DelBut             $_Split2 = StringSplit(FileRead($_Userlist), @CRLF, 1)             $_NewText = $_Split2[1]             For $i = 2 to $_Split2[0]                 If $i <> ($_Curnum+1) then $_NewText &= @CRLF&$_Split2[$i]             Next             FileDelete($_Userlist)             FileWrite($_Userlist, $_NewText)             GUICtrlSetState($_NewBut, $GUI_DISABLE)             GUICtrlSetState($_CopyBut, $GUI_DISABLE)             GUICtrlSetState($_DelBut, $GUI_DISABLE)             GUICtrlSetData($_AddChangeBut, 'Add')             GUICtrlSetData($_UsernameInput, '')             GUICtrlSetData($_PassInput2, '')             GUICtrlSetData($_TitleInput, '')             _LoadList()     EndSwitch WEnd Func _ForgotPass()     if not FileExists($_Questionlist) then return 0     $_Split1 = StringSplit(FileRead($_Questionlist), @CRLF, 1)     $_Split3 = StringSplit($_Split1[Random(1, 3, 1)], ' <-=-> ', 1)     $_Quest = _StringEncrypt(0, $_Split3[1], 'quisz')     $_Answ = _StringEncrypt(0, $_Split3[2], 'quisz')     $_Ran = Random(0, 4, 1)     Do         $_Ran2 = Random(0, 4, 1)     Until $_Ran2 <> $_Ran     global $_Quests[3] = [$_Quest, $_RandomQuestions[$_Ran], $_RandomQuestions[$_Ran2]]     $_R = Random(0, 2, 1)     Do         $_R2 = Random(0, 2, 1)     Until $_R2 <> $_R     Do         $_R3 = Random(0, 2, 1)     Until $_R3 <> $_R and $_R3 <> $_R2     $_Succes = 0     $GUI = GUICreate("Password Saver", 322, 319, 193, 125)     $_Label1 = GUICtrlCreateLabel("Please fill out all fields.", 104, 8, 109, 17)     if $_Quests[$_R] = $_Quest then $_Real = 1     $_Label2 = GUICtrlCreateLabel($_Quests[$_R], 16, 40, 292, 17)     $_Quest1Input = GUICtrlCreateInput("", 16, 64, 121, 21)     if $_Quests[$_R2] = $_Quest then $_Real = 2     $_Label3 = GUICtrlCreateLabel($_Quests[$_R2], 16, 104, 292, 17)     $_Quest2Input = GUICtrlCreateInput("", 16, 128, 121, 21)     if $_Quests[$_R3] = $_Quest then $_Real = 3     $_Label4 = GUICtrlCreateLabel($_Quests[$_R3], 16, 160, 292, 17)     $_Quest3Input = GUICtrlCreateInput("", 16, 184, 121, 21)     $_Label5 = GUICtrlCreateLabel("Please enter a new password:", 16, 224, 292, 17)     $_NewPassInput = GUICtrlCreateInput("", 16, 248, 121, 21)     $_ResetBut = GUICtrlCreateButton("Reset", 120, 288, 75, 25, 0)     GUISetState(@SW_SHOW)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 Exit                             Case $_ResetBut                 If GUICtrlRead(Execute('$_Quest'&$_Real&'Input')) = $_Answ Then                     if $_Real = 1 Then                         if GUICtrlRead($_Quest2Input) = '' and GUICtrlRead($_Quest3Input) = '' Then                             $_Succes = 1                         Else                             $_Succes = -1                         EndIf                     ElseIf $_Real = 2 Then                         if GUICtrlRead($_Quest1Input) = '' and GUICtrlRead($_Quest3Input) = '' Then                             $_Succes = 1                         Else                             $_Succes = -1                         EndIf                     ElseIf $_Real = 3 Then                         if GUICtrlRead($_Quest1Input) = '' and GUICtrlRead($_Quest2Input) = '' Then                             $_Succes = 1                         Else                             $_Succes = -1                         EndIf                     EndIf                 Else                     $_Succes = -1                 EndIf         EndSwitch         If $_Succes = 1 Then             $_Password1 = GUICtrlRead($_NewPassInput)             _FileWriteToLine($_Userlist, 1, _StringEncrypt(1, $_Password1, 'secrez'), 1)             msgbox(32, 'Succes', 'Your password has been reset!')             GUIDelete($GUI)             ExitLoop         ElseIf $_Succes = -1 Then             FileWrite($_Banfile, @YDAY&' '&@HOUR+1)             msgbox(16, 'Fail', 'For security reasons you are not allowed to use this program for 1 hour.')             exit         EndIf     WEnd EndFunc Func _LoadList()     _GUICtrlListBox_ResetContent($_List)     $_Text = StringSplit(FileRead($_Userlist), @CRLF, 1)     if $_Text[0] = 1 then return ''     global $_Passwords[$_Text[0]]     global $_Usernames[$_Text[0]]     global $_Titles[$_Text[0]]     For $i = 2 to $_Text[0]         if $_Text[$i] = '' then return 0         $_String = StringSplit($_Text[$i], ' <-=-> ', 1)         _GUICtrlListBox_AddString($_List, $_String[1])         $_Titles[$i-1] = $_String[1]         $_Usernames[$i-1] = _StringEncrypt(0, $_String[2], 'secrez1')         $_Passwords[$i-1] = _StringEncrypt(0, $_String[3], 'secrez2')     Next EndFunc Func _Mid($sWidth='', $sHeight='')     If $sWidth <> '' and $sHeight <> '' Then         local $sMid[2] = [(@DesktopWidth/2)-($sWidth/2), (@DesktopHeight/2)-($sHeight/2)]         return $sMid     ElseIf $sWidth <> '' Then         return (@DesktopWidth/2)-($sWidth/2)     Else         return (@DesktopHeight/2)-($sHeight/2)     EndIf EndFunc


Enjoy! :)
Please comment

Edited by ludocus, 10 September 2010 - 02:17 PM.






#2 monter

monter

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 09 September 2010 - 05:47 PM

-This program stores all usernames and passwords (encrypted though) in: @AppDataDir&'\userlist.txt'


1. If someone will find my file "userlist.txt" and will look inside - he sees my master password to Password Saver in plain text ;)
2. When I click on existing item the button "Add" changes to "Change" - it's smart, but after changing, if I want to add new item I have to relaunch the script.
monter.FMFull programs:LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking ČharCönvěr - character set converter.CDTray - automated opening/closing the RecentFolders - managing recently used folder list with combobox.AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.

#3 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,162 posts

Posted 09 September 2010 - 06:41 PM

Nice idea, but for a sensitive purpose as this is, I'll stick to KeePass.

#4 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 09 September 2010 - 07:31 PM

@monter:
Thnx for the comment. I fixt those things and added buttons for del, copy and new.

@KaFu:
Thnx, you do that.

Edited by ludocus, 09 September 2010 - 07:32 PM.


#5 monter

monter

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 09 September 2010 - 10:47 PM

It's much better now ;)
I'm thinking about reminding procedure in case if the user forgets master password.
Maybe during first use (If Not FileExist @AppDataDir & '\userlist.txt') we should make few additional testing questions e.g.:
1. your birthday date
2. your mum's name
3. your city name
4. your favourite writer... etc.

These questions should be mixed with other "fake" questions (not appeared during test)
If anybody would answer on fake question - the program would be blocked for few hours.
And after this time - another set of fake questions and one true (of course answer should be the same as during first use/setup).
-------------
Make another small fix - after adding first item buttons "New", "Copy", "Del" are still disabled.
Maybe it would be better to organize buttons like: "New" (always enabled), "Edit", "Copy", "Del" (these 3 buttons disabled if none exists or none selected)
monter.FMFull programs:LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking ČharCönvěr - character set converter.CDTray - automated opening/closing the RecentFolders - managing recently used folder list with combobox.AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.

#6 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 10 September 2010 - 02:16 PM

Ok I did exactly what you said and it's a nice little extra secure thing.

Make another small fix - after adding first item buttons "New", "Copy", "Del" are still disabled.
Maybe it would be better to organize buttons like: "New" (always enabled), "Edit", "Copy", "Del" (these 3 buttons disabled if none exists or none selected)

Those are supposed to be disabled, because you haven't selected an item.

#7 kaotkbliss

kaotkbliss

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,106 posts

Posted 10 September 2010 - 02:31 PM

I was going to try this but ended up looking at keepass instead...
Not sure if I'm going to use it though.

Only because of a suggestion I am about to make that I find extremely important to me

If someone could find a way to import passwords that have already been saved by windows.
I have a number of saved passwords but don't remember all the sites, passwords, or even all the usernames I signed up with.

If a password utility can get these automatically and add them to the list then I would be one happy camper ;)
Posted Image010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My first project Allin1 Program launcherBill CalculatorGot <Insert problem here>?There's an AutoIt script for that!

#8 monter

monter

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 10 September 2010 - 02:50 PM

It's much better now ;)
Q's & A's look pretty cool.
You could hide input passwords with asterisks by default and add the button "show/hide". It would be more safe (someone can stand behind you at that time) :)
monter.FMFull programs:LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking ČharCönvěr - character set converter.CDTray - automated opening/closing the RecentFolders - managing recently used folder list with combobox.AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.

#9 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 10 September 2010 - 03:18 PM

Thnx Monter
Yeh I could do that. Although I don't think it's necessary.

For dummie's:
Do not open this program when a password stealer is watching behind you

#10 spudw2k

spudw2k

    i dunno what i'm doing

  • Active Members
  • PipPipPipPipPipPip
  • 1,147 posts

Posted 10 September 2010 - 09:35 PM

Looks neat and useful, but I'd like to see a much stronger encryption algo than RC4. Perhaps AES?

#11 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,816 posts

Posted 11 September 2010 - 01:43 AM

I was going to try this but ended up looking at keepass instead...
Not sure if I'm going to use it though.

Only because of a suggestion I am about to make that I find extremely important to me

If someone could find a way to import passwords that have already been saved by windows.
I have a number of saved passwords but don't remember all the sites, passwords, or even all the usernames I signed up with.

If a password utility can get these automatically and add them to the list then I would be one happy camper ;)

kaotkbliss, take a look at Lastpass, I use it for all the logins I use on any browser. As far as I know, it can only import the passwords saved by IE and FF, but once they are imported, they're available for use. The site is extremely secure, it's so secure that even the site owners can't access your passwords or any of the information saved on it.

How to ask questions the smart way!

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#12 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 11 September 2010 - 04:15 PM

@spudw2k:
Thnx!
I'll look at it




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users