Jump to content

Need An Example of This Please


Recommended Posts

I just want to use AutoIT to make a simple username/password database. For me to input any usernames and/or email and/or passwords.

It doesn't need to check the login or attempt to login. I just want to be able to open the program, input the information I want (aka un/email/pw) & it save it.

Simple. I've googled it, but always find only Q & A's to more complicated databases.

Any got an example AutoIT script I can see to get an idea?

Link to comment
Share on other sites

If you are doing this for serious business, use Keepass (2) instead of reinventing the wheel.

If you are just doing this for fun, look at the MySQLite UDF included in AutoIt.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

30 minutes ago, TheDcoder said:

If you are doing this for serious business, use Keepass (2) instead of reinventing the wheel.

If you are just doing this for fun, look at the MySQLite UDF included in AutoIt.

Ooh that's a new one, got a link? :)

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

4 minutes ago, JohnOne said:

Ooh that's a new one, got a link?

For Keepass? or for the MySQLite (_SQLite_* Functions) UDF?

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

And if all these are not simple enough for you, you could save them in a notepad..

...and if that's too simple have a look in my sig and use the FTP Connection thingy and rewrite it a little to save your stuff to an ini file.

Both of these suggestions are a very unsafe ways to save passwords and sensitive information.

 

Link to comment
Share on other sites

48 minutes ago, l3ill said:

And if all these are not simple enough for you, you could save them in a notepad..

and best way without any encryption :sweating:

@ThaRealiZt: Store in inifile, thats simple and use encryption.

Here a script that checks user and password against ini:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include  <Crypt.au3>
#Include <Array.au3>

$sSalt = "Most recent sig. I made"
$aCorrect=IniReadSection(@ScriptDir&"\PW_List.ini","User")
_ArrayDelete($aCorrect,0)

$hGUI = GUICreate("Login Check", 500, 140)
GUICtrlCreateLabel("Benutzername:", 5, 5, 85, 21)
$idInpUser = GUICtrlCreateInput("", 95, 5, 190, 21)
GUICtrlCreateLabel("Passwort:", 5, 35, 85, 21)
$idInpPW = GUICtrlCreateInput("123456789", 95, 35, 190, 21, $ES_PASSWORD) ; Input mit Passwort Style
$idBtnLogin = GUICtrlCreateButton("&Login", 5, 60, 490, 30)
GUISetState(@SW_SHOW)
$iLoginTrys = 0
$iMaxTrys = 5
While 1
    $LoginState = GUICtrlGetState($idBtnLogin)
    ;ermitteln welchen Status der Login-Button hat

    If GUICtrlRead($idInpPW) <> "" And GUICtrlRead($idInpUser) <> "" Then
        ;Wenn Passwort und Benutzer dann
        If BitAND($LoginState, $GUI_DISABLE) = $GUI_DISABLE Then GUICtrlSetState($idBtnLogin, $GUI_Enable)
        ;Wenn $LoginState nicht aktiv (also der Loginbutton nicht klickbar) ist dann Login-Button aktivieren
    Else
        ;entweder Passwort ider Benutzer sind nicht ausgefüllt
        If BitAND($LoginState, $GUI_Enable) = $GUI_Enable Then GUICtrlSetState($idBtnLogin, $GUI_DISABLE)
        ;Wenn $LoginState aktiv (also der Loginbutton klickbar) ist dann Login-Button deaktivieren
    EndIf
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idBtnLogin
            ;Loginbutton wurde geklickt
            $bCorect = False
            ;diese Boolsche Variable auf FALSCH setzen
            For $i = 0 To UBound($aCorrect) - 1
                If GUICtrlRead($idInpUser) = $aCorrect[$i][0] Then
                    ;wenn das Arrayelement gleich dem eingegebenen Benutzer ist dann
                    $bCorect = True
                    ;diese Boolsche Variable auf WAHR setzen
                    ExitLoop
                    ;Schleife verlassen
                EndIf
            Next
            If $bCorect Then
                ;Es wurde ein Benutzer mit Zugangsberechtigung eingegeben
                ConsoleWrite($aCorrect[$i][1] & @CRLF)
                $sPW = _Crypt_HashData(GUICtrlRead($idInpPW) & $sSalt, $CALG_MD5)
                ;das eingegebene Passwort zusammen mit dem "Salz" verschüsseln
                ConsoleWrite($sPW & @CRLF)
                If $sPW <> $aCorrect[$i][1] Then $bCorect = False
                ;der Schlüssel des eingebenen Passworts und der im Array hinterlegte Schlüssel
                ;für das Passwort stimmen nicht überein also $bCorrect auf FALSCH setzen
            EndIf
            If Not $bCorect Then
                ;entweder kein Benutzer mit Zugangsberechtigung
                ;oder ungültige Passworteingabe
                $iLoginTrys += 1
                ;Anzahl der Loginversuche um 1 erhöhen
                If $iLoginTrys > $iMaxTrys - 1 Then
                    ;Anzahl der maximal zuässigen Loginversuche wurde überschritten
                    MsgBox(16, $iMaxTrys & " falsche Loginversuche", "Computer wird für 15 Min. gesperrt", 0, $hGUI)
                    ;Ausgabe
                    Exit
                    ;deshalb Programm beenden
                Else
                    ;Anzahl der maximal zuässigen Loginversuche wurde nicht überschritten
                    MsgBox(48, "noch " & $iMaxTrys - $iLoginTrys & " Loginversuch(e)!", "danach wird der Computer für 15 Min. gesperrt", 0, $hGUI)
                    ;Anzeige der restichen Loginversuche
                EndIf
            Else
                ;Benutzer mit Zugangsberechtigung und gütiges Passwort wurden eingegeben
                MsgBox(64, "Login" & $iLoginTrys, "Sie haben sich erfolgreich angemeldet!", 0, $hGUI)
                GUIDelete()
                ;Gui löschen
                ExitLoop
                ;(GuiGetMsg-) Schleife verlassen
            EndIf
    EndSwitch
WEnd
;hier der zuschützende Skriptteil
;here your code

and here the script to create inifile:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include  <Crypt.au3>

$hGUI = GUICreate("Passwordcreator", 500, 170)
GUICtrlCreateLabel("Benutzername:", 5, 5, 85, 21)
$idInpUser = GUICtrlCreateInput("", 95, 5, 190, 21)
GUICtrlCreateLabel("Passwort:", 5, 35, 85, 21)
$idInpPW = GUICtrlCreateInput("", 95, 35, 190, 21)
GUICtrlCreateLabel("PW bestätigen:", 5, 65, 85, 21)
$idInpPW2 = GUICtrlCreateInput("", 95, 65, 190, 21) ; Input mit Passwort Style...
$idBtnCreate = GUICtrlCreateButton("&Passwort erzeugen", 5, 98, 490, 70)
GUISetState(@SW_SHOW)
$sSalt = "Most recent sig. I made"

While 1
    $CreateState = GUICtrlGetState($idBtnCreate)
    ;ermitteln welchen Status der Create-Button hat
    $sPW1 =  GUICtrlRead($idInpPW)
    $sPW2 = GUICtrlRead($idInpPW2)
    If $sPW1        = $sPW2 And StringLen($sPW1) > 3 And GUICtrlRead($idInpUser) <> ""  Then
        ;Wenn beide Passworteingaben übereinstimmen und das PW  mind. 4stellig ist und ein Benutzer eingegeben dann
        If BitAND($CreateState, $GUI_DISABLE) = $GUI_DISABLE Then GUICtrlSetState($idBtnCreate, $GUI_Enable)
        ;Wenn $CreateState nicht aktiv (also der Createbutton nicht klickbar) ist dann Create-Button aktivieren
    Else
        ;ansonsten
        If BitAND($CreateState, $GUI_Enable) = $GUI_Enable Then GUICtrlSetState($idBtnCreate, $GUI_DISABLE)
        ;Wenn $CreateState aktiv (also der Createbutton klickbar) ist dann Create-Button deaktivieren
    EndIf
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idBtnCreate
            ;Createbutton wurde geklickt
            $sPass=_Crypt_HashData(GUICtrlRead($idInpPW) & $sSalt, $CALG_MD5)
            IniWrite(@ScriptDir&"\PW_List.ini","User",GUICtrlRead($idInpUser),$sPass)
    EndSwitch
WEnd

 

Edited by AutoBert
Link to comment
Share on other sites

Bruce Schneier's Password Safe is pretty good as well and fully trustworthy.

Now if you insist on making one yourself, you can just  use an encrypted SQLite database by using system.data.sqlite DLL in place of the standard sqlite3.dll version without changing anything. All you have to do is create a little GUI to ask for the DB password and issue the following SQL command before anything else after opening the connection:

$result = _SQLite_Exec($hDB, "pragma key = '" & $sDbPassword & "'")

This way your DB file is completely encrypted by a strong algorithm and will look like a random series of meaningless bytes to anyone not knowing your master password. You can then store whatever you want in plaintext without risk of that content being read by some Eve.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...