Modified lines: | 17, 27, 28, 77, 83, 87, 106, 131, 175, 181, 185, 186, 188, 194, 201 |
Removed line: | 3, 30, 31, 32, 33, 34, 90, 91, 92, 93, 94, 95, 103 |
Added line: | None |
CredentialCreator.au3 | Credentials.au3 | |||
---|---|---|---|---|
235 lines 10775 bytes Last modified : Tue Feb 7 10:49:12 2017 |
248 lines 11184 bytes Last modified : Tue Feb 7 10:54:04 2017 |
|||
1 | ; Created by Robert Salatka (known as Damein on AutoIt Forums) | 1 | ; Created by Robert Salatka (known as Damein on AutoIt Forums) | |
2 | ; Created 4-26-2016 | 2 | ; Created 4-26-2016 | |
3 | ; Update 02-07-2017 Correct initial use issues and move data to appdata folder. | |||
3 | 4 | |||
4 | #include <String.au3> | 5 | #include <String.au3> | |
5 | #include <Crypt.au3> | 6 | #include <Crypt.au3> | |
6 | #include <GUIConstantsEx.au3> | 7 | #include <GUIConstantsEx.au3> | |
7 | #include <GuiListView.au3> | 8 | #include <GuiListView.au3> | |
8 | #include <MsgBoxConstants.au3> | 9 | #include <MsgBoxConstants.au3> | |
9 | #include <EditConstants.au3> | 10 | #include <EditConstants.au3> | |
10 | 11 | |||
11 | 12 | |||
12 | Opt("GUIOnEventMode", 1) | 13 | Opt("GUIOnEventMode", 1) | |
13 | 14 | |||
14 | Global $List, $Status = 0, $MainGui, $EditGui | 15 | Global $List, $Status = 0, $MainGui, $EditGui | |
15 | Global $DecryptKey, $UsernameInput, $PasswordInput, $KeyInput, $FirstEntry = 0, $Permission = 0 | 16 | Global $DecryptKey, $UsernameInput, $PasswordInput, $KeyInput, $FirstEntry = 0, $Permission = 0 | |
16 | 17 | |||
17 | $CheckForKey = IniRead(@ScriptDir & "/Data/Login Credentials.ini", "Key", "Key", "NA") | 18 | $CheckForKey = IniRead(@AppDataDir & "/Cred_Data/Credentials.ini", "Key", "Key", "NA") | |
18 | If $CheckForKey = "NA" Then | 19 | If $CheckForKey = "NA" Then | |
19 | $GetNewKey = InputBox("Encryption Key", "You appear to not have created an encryption key to use with this software. Please do so before using the software!") | 20 | $GetNewKey = InputBox("Encryption Key", "You appear to not have created an encryption key to use with this software. Please do so before using the software!") | |
20 | If $GetNewKey = "" Then | 21 | If $GetNewKey = "" Then | |
21 | MsgBox(48, "Error", "No key input, please run the program again. You must use an encryption key for this program to work!") | 22 | MsgBox(48, "Error", "No key input, please run the program again. You must use an encryption key for this program to work!") | |
22 | Exit | 23 | Exit | |
23 | EndIf | 24 | EndIf | |
24 | $CheckInformation = MsgBox(4, "Encryption Key", "Do you wish to use this as your encryption key: " & $GetNewKey) | 25 | $CheckInformation = MsgBox(4, "Encryption Key", "Do you wish to use this as your encryption key: " & $GetNewKey) | |
25 | If $CheckInformation = 6 Then | 26 | If $CheckInformation = 6 Then | |
26 | $EncryptNewKey = _Crypt_EncryptData($GetNewKey, $GetNewKey, $CALG_RC4) | 27 | $EncryptNewKey = _Crypt_EncryptData($GetNewKey, $GetNewKey, $CALG_RC4) | |
27 | IniWrite(@ScriptDir & "/Data/Login Credentials.ini", "Key", "Key", $EncryptNewKey) | 28 | ; create directory if it does not exist | |
28 | MsgBox(0, "Encryption Key", "Encryption key has been saved!") | 29 | $DataDir = @AppDataDir & "/Cred_Data" | |
30 | If DirGetSize($DataDir) -1 Then | |||
31 | DirCreate($DataDir) | |||
32 | EndIf | |||
33 | IniWrite(@AppDataDir & "/Cred_Data/Credentials.ini", "Key", "Key", $EncryptNewKey) | |||
34 | MsgBox(0, "Encryption Key", "Encryption key has been saved!" ) | |||
29 | Else | 35 | Else | |
30 | MsgBox(48, "Encryption Key", "Encryption key creation has been cancelled! Please run the program again if you wish to!") | 36 | MsgBox(48, "Encryption Key", "Encryption key creation has been cancelled! Please run the program again if you wish to!") | |
31 | Exit | 37 | Exit | |
32 | EndIf | 38 | EndIf | |
33 | EndIf | 39 | EndIf | |
34 | 40 | |||
35 | _CreateMainGui() | 41 | _CreateMainGui() | |
36 | 42 | |||
37 | Func _CreateMainGui() | 43 | Func _CreateMainGui() | |
38 | $MainGui = GUICreate("Credential Creator", 400, 480) | 44 | $MainGui = GUICreate("Credential Creator", 400, 480) | |
39 | GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") | 45 | GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") | |
40 | 46 | |||
41 | GUICtrlCreateLabel("Username", 153, 110, 200, 40) | 47 | GUICtrlCreateLabel("Username", 153, 110, 200, 40) | |
42 | GUICtrlSetFont(-1, 16) | 48 | GUICtrlSetFont(-1, 16) | |
43 | 49 | |||
44 | $UsernameInput = GUICtrlCreateInput("", 10, 140, 380, 30, $ES_CENTER) | 50 | $UsernameInput = GUICtrlCreateInput("", 10, 140, 380, 30, $ES_CENTER) | |
45 | GUICtrlSetColor(-1, 0xe50000) | 51 | GUICtrlSetColor(-1, 0xe50000) | |
46 | GUICtrlSetFont(-1, 16) | 52 | GUICtrlSetFont(-1, 16) | |
47 | 53 | |||
48 | GUICtrlCreateLabel("Password", 153, 210, 200, 40) | 54 | GUICtrlCreateLabel("Password", 153, 210, 200, 40) | |
49 | GUICtrlSetFont(-1, 16) | 55 | GUICtrlSetFont(-1, 16) | |
50 | 56 | |||
51 | $PasswordInput = GUICtrlCreateInput("", 10, 240, 380, 30, $ES_CENTER) | 57 | $PasswordInput = GUICtrlCreateInput("", 10, 240, 380, 30, $ES_CENTER) | |
52 | GUICtrlSetColor(-1, 0xe50000) | 58 | GUICtrlSetColor(-1, 0xe50000) | |
53 | GUICtrlSetFont(-1, 16) | 59 | GUICtrlSetFont(-1, 16) | |
54 | 60 | |||
55 | GUICtrlCreateLabel("Encryption Key", 130, 310, 200, 40) | 61 | GUICtrlCreateLabel("Encryption Key", 130, 310, 200, 40) | |
56 | GUICtrlSetFont(-1, 16) | 62 | GUICtrlSetFont(-1, 16) | |
57 | 63 | |||
58 | $KeyInput = GUICtrlCreateInput("", 10, 340, 380, 30, $ES_CENTER) | 64 | $KeyInput = GUICtrlCreateInput("", 10, 340, 380, 30, $ES_CENTER) | |
59 | GUICtrlSetColor(-1, 0xe50000) | 65 | GUICtrlSetColor(-1, 0xe50000) | |
60 | GUICtrlSetFont(-1, 16) | 66 | GUICtrlSetFont(-1, 16) | |
61 | 67 | |||
62 | $AddCredential = GUICtrlCreateButton("Add Credentials", 10, 390, 185, 70) | 68 | $AddCredential = GUICtrlCreateButton("Add Credentials", 10, 390, 185, 70) | |
63 | GUICtrlSetOnEvent(-1, "_AddCredentials") | 69 | GUICtrlSetOnEvent(-1, "_AddCredentials") | |
64 | GUICtrlSetFont(-1, 12) | 70 | GUICtrlSetFont(-1, 12) | |
65 | 71 | |||
66 | $EditCredentials = GUICtrlCreateButton("Edit/Remove Credentials", 205, 390, 185, 70) | 72 | $EditCredentials = GUICtrlCreateButton("Edit/Remove Credentials", 205, 390, 185, 70) | |
67 | GUICtrlSetOnEvent(-1, "_CreateEditGui") | 73 | GUICtrlSetOnEvent(-1, "_CreateEditGui") | |
68 | GUICtrlSetFont(-1, 12) | 74 | GUICtrlSetFont(-1, 12) | |
69 | 75 | |||
70 | GUISetState() | 76 | GUISetState() | |
71 | EndFunc ;==>_CreateMainGui | 77 | EndFunc ;==>_CreateMainGui | |
72 | 78 | |||
73 | Func _AddCredentials() | 79 | Func _AddCredentials() | |
74 | $ReadUsername = GUICtrlRead($UsernameInput) | 80 | $ReadUsername = GUICtrlRead($UsernameInput) | |
75 | $ReadPassword = GUICtrlRead($PasswordInput) | 81 | $ReadPassword = GUICtrlRead($PasswordInput) | |
76 | $ReadEncryptionKey = GUICtrlRead($KeyInput) | 82 | $ReadEncryptionKey = GUICtrlRead($KeyInput) | |
77 | $ReadKey = IniRead(@ScriptDir & "/Data/Login Credentials.ini", "Key", "Key", "NA") | 83 | $ReadKey = IniRead(@AppDataDir & "/Cred_Data/Credentials.ini", "Key", "Key", "NA") | |
78 | $DecryptKey = _Crypt_DecryptData($ReadKey, $ReadEncryptionKey, $CALG_RC4) | 84 | $DecryptKey = _Crypt_DecryptData($ReadKey, $ReadEncryptionKey, $CALG_RC4) | |
79 | $TranslateKey = BinaryToString($DecryptKey) | 85 | $TranslateKey = BinaryToString($DecryptKey) | |
80 | If $ReadEncryptionKey = $TranslateKey Then | 86 | If $ReadEncryptionKey = $TranslateKey Then | |
81 | $CheckInformation = MsgBox(4, "Add Credentials", "Are you sure you wish to add the credentials for: " & $ReadUsername) | 87 | $CheckInformation = MsgBox(4, "Add Credentials", "Are you sure you wish to add the credentials for: " & $ReadUsername) | |
82 | If $CheckInformation = 6 Then | 88 | If $CheckInformation = 6 Then | |
83 | $ReadIni = IniReadSection(@ScriptDir & "/Data/Login Credentials.ini", "Credentials") | 89 | $ReadIni = IniReadSection(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials") | |
90 | ; Check for section initialized, if not assume it is now and set counter to 1 | |||
91 | If @error Then | |||
92 | $NextKey = 1 | |||
93 | Else | |||
94 | $NextKey = $ReadIni[0][0] + 1 | |||
95 | EndIf | |||
84 | ; Gives current count add 1 to add to INI | 96 | ; Gives current count add 1 to add to INI | |
85 | $EncryptNewUsername = _Crypt_EncryptData($ReadUsername, $ReadEncryptionKey, $CALG_RC4) | 97 | $EncryptNewUsername = _Crypt_EncryptData($ReadUsername, $ReadEncryptionKey, $CALG_RC4) | |
86 | $EncryptNewPassword = _Crypt_EncryptData($ReadPassword, $ReadEncryptionKey, $CALG_RC4) | 98 | $EncryptNewPassword = _Crypt_EncryptData($ReadPassword, $ReadEncryptionKey, $CALG_RC4) | |
87 | IniWrite(@ScriptDir & "/Data/Login Credentials.ini", "Credentials", $ReadIni[0][0] + 1, $EncryptNewUsername & "|" & $EncryptNewPassword) | 99 | IniWrite(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials", $NextKey , $EncryptNewUsername & "|" & $EncryptNewPassword) | |
88 | GUICtrlSetData($UsernameInput, "") | 100 | GUICtrlSetData($UsernameInput, "") | |
89 | GUICtrlSetData($PasswordInput, "") | 101 | GUICtrlSetData($PasswordInput, "") | |
90 | MsgBox(0, "Add Credentials", "Addition of credential " & $ReadUsername & " is complete!") | 102 | MsgBox(0, "Add Credentials", "Addition of credential " & $ReadUsername & " is complete!") | |
103 | ;Exit | |||
91 | Else | 104 | Else | |
92 | MsgBox(0, "Add Credentials", "Cancelling the addition of the credentials!") | 105 | MsgBox(0, "Add Credentials", "Cancelling the addition of the credentials!") | |
93 | EndIf | 106 | EndIf | |
94 | Else | 107 | Else | |
95 | MsgBox(48, "Error", "Encryption key is invalid. Please try again!") | 108 | MsgBox(48, "Error", "Encryption key is invalid. Please try again!") | |
96 | EndIf | 109 | EndIf | |
97 | EndFunc ;==>_AddCredentials | 110 | EndFunc ;==>_AddCredentials | |
98 | 111 | |||
99 | 112 | |||
100 | Func _CreateEditGui() | 113 | Func _CreateEditGui() | |
101 | GUISetState(@SW_DISABLE, $MainGui) | 114 | GUISetState(@SW_DISABLE, $MainGui) | |
102 | If $FirstEntry = 0 Then | 115 | If $FirstEntry = 0 Then | |
103 | MsgBox(48, "Edit Credentials", "Please note, to remove a credential from the database select the credential you wish to remove and click 'Edit Credentials'" & _ | 116 | MsgBox(48, "Edit Credentials", "Please note, to remove a credential from the database select the credential you wish to remove and click 'Edit Credentials'" & _ | |
104 | " then type in 'Blank' (without the quotation marks) as the new username and it will remove the credentials!") | 117 | " then type in 'Blank' (without the quotation marks) as the new username and it will remove the credentials!") | |
105 | $GetEncryptionKey = InputBox("Security Check", "Please input the correct encryption key!") | 118 | $GetEncryptionKey = InputBox("Security Check", "Please input the correct encryption key!") | |
106 | $ReadKey = IniRead(@ScriptDir & "/Data/Login Credentials.ini", "Key", "Key", "NA") | 119 | $ReadKey = IniRead(@AppDataDir & "/Cred_Data/Credentials.ini", "Key", "Key", "NA") | |
107 | $DecryptKey = _Crypt_DecryptData($ReadKey, $GetEncryptionKey, $CALG_RC4) | 120 | $DecryptKey = _Crypt_DecryptData($ReadKey, $GetEncryptionKey, $CALG_RC4) | |
108 | If $DecryptKey = $GetEncryptionKey Then | 121 | If $DecryptKey = $GetEncryptionKey Then | |
109 | MsgBox(0, "Security Check", "Decryption successful, welcome, " & @UserName) | 122 | MsgBox(0, "Security Check", "Decryption successful, welcome, " & @UserName) | |
110 | Else | 123 | Else | |
111 | MsgBox(48, "Error", "Encryption key is invalid please try again!") | 124 | MsgBox(48, "Error", "Encryption key is invalid please try again!") | |
112 | $Permission = 1 | 125 | $Permission = 1 | |
113 | EndIf | 126 | EndIf | |
114 | $FirstEntry = 1 | 127 | $FirstEntry = 1 | |
115 | EndIf | 128 | EndIf | |
116 | If $Permission = 0 Then | 129 | If $Permission = 0 Then | |
117 | $EditGui = GUICreate("Credential Editor", 400, 480) | 130 | $EditGui = GUICreate("Credential Editor", 400, 480) | |
118 | GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGui") | 131 | GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGui") | |
119 | $List = GUICtrlCreateListView("Username|Password", 10, 10, 380, 380) | 132 | $List = GUICtrlCreateListView("Username|Password", 10, 10, 380, 380) | |
120 | _GUICtrlListView_SetColumnWidth($List, 0, 190) | 133 | _GUICtrlListView_SetColumnWidth($List, 0, 190) | |
121 | _GUICtrlListView_SetColumnWidth($List, 1, 190) | 134 | _GUICtrlListView_SetColumnWidth($List, 1, 190) | |
122 | 135 | |||
123 | $EditButton = GUICtrlCreateButton("Edit Credentials", 10, 405, 180, 60) | 136 | $EditButton = GUICtrlCreateButton("Edit Credentials", 10, 405, 180, 60) | |
124 | GUICtrlSetOnEvent(-1, "_Edit") | 137 | GUICtrlSetOnEvent(-1, "_Edit") | |
125 | GUICtrlSetFont(-1, 16) | 138 | GUICtrlSetFont(-1, 16) | |
126 | 139 | |||
127 | $CloseButton = GUICtrlCreateButton("Close", 210, 405, 180, 60) | 140 | $CloseButton = GUICtrlCreateButton("Close", 210, 405, 180, 60) | |
128 | GUICtrlSetOnEvent(-1, "_CloseGUi") | 141 | GUICtrlSetOnEvent(-1, "_CloseGUi") | |
129 | GUICtrlSetFont(-1, 16) | 142 | GUICtrlSetFont(-1, 16) | |
130 | 143 | |||
131 | $ReadCredentialCount = IniReadSection(@ScriptDir & "/Data/Login Credentials.ini", "Credentials") | 144 | $ReadCredentialCount = IniReadSection(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials") | |
132 | If @error Then | 145 | If @error Then | |
133 | MsgBox(48, "Error", "No credentials are present. Disabling editting permission. Please rerun the program once you have added credentials to the database!") | 146 | MsgBox(48, "Error", "No credentials are present. Disabling editting permission. Please rerun the program once you have added credentials to the database!") | |
134 | GUICtrlSetState($EditButton, $GUI_DISABLE) | 147 | GUICtrlSetState($EditButton, $GUI_DISABLE) | |
135 | Else | 148 | Else | |
136 | For $i = 1 To $ReadCredentialCount[0][0] | 149 | For $i = 1 To $ReadCredentialCount[0][0] | |
137 | $SplitData = StringSplit($ReadCredentialCount[$i][1], "|") | 150 | $SplitData = StringSplit($ReadCredentialCount[$i][1], "|") | |
138 | $DecryptUserName = _Crypt_DecryptData($SplitData[1], $DecryptKey, $CALG_RC4) | 151 | $DecryptUserName = _Crypt_DecryptData($SplitData[1], $DecryptKey, $CALG_RC4) | |
139 | $DecryptPassword = _Crypt_DecryptData($SplitData[2], $DecryptKey, $CALG_RC4) | 152 | $DecryptPassword = _Crypt_DecryptData($SplitData[2], $DecryptKey, $CALG_RC4) | |
140 | $DecryptedUserName = BinaryToString($DecryptUserName) | 153 | $DecryptedUserName = BinaryToString($DecryptUserName) | |
141 | $DecryptedPassword = BinaryToString($DecryptPassword) | 154 | $DecryptedPassword = BinaryToString($DecryptPassword) | |
142 | $ListViewData = $DecryptedUserName & "|" & $DecryptedPassword | 155 | $ListViewData = $DecryptedUserName & "|" & $DecryptedPassword | |
143 | GUICtrlCreateListViewItem($ListViewData, $List) | 156 | GUICtrlCreateListViewItem($ListViewData, $List) | |
144 | Next | 157 | Next | |
145 | EndIf | 158 | EndIf | |
146 | 159 | |||
147 | GUISetState() | 160 | GUISetState() | |
148 | Else | 161 | Else | |
149 | GUISetState(@SW_ENABLE, $MainGui) | 162 | GUISetState(@SW_ENABLE, $MainGui) | |
150 | Sleep(100) | 163 | Sleep(100) | |
151 | WinActivate($MainGui) | 164 | WinActivate($MainGui) | |
152 | $Permission = 0 | 165 | $Permission = 0 | |
153 | $FirstEntry = 0 | 166 | $FirstEntry = 0 | |
154 | EndIf | 167 | EndIf | |
155 | EndFunc ;==>_CreateEditGui | 168 | EndFunc ;==>_CreateEditGui | |
156 | 169 | |||
157 | Func _Edit() | 170 | Func _Edit() | |
158 | $Status = 0 | 171 | $Status = 0 | |
159 | $GetSelected = ControlListView($EditGui, "", $List, "GetSelected") | 172 | $GetSelected = ControlListView($EditGui, "", $List, "GetSelected") | |
160 | $GetUserName = ControlListView($EditGui, "", $List, "GetText", $GetSelected) | 173 | $GetUserName = ControlListView($EditGui, "", $List, "GetText", $GetSelected) | |
161 | $GetPassword = ControlListView($EditGui, "", $List, "GetText", $GetSelected, 1) | 174 | $GetPassword = ControlListView($EditGui, "", $List, "GetText", $GetSelected, 1) | |
162 | While $Status = 0 | 175 | While $Status = 0 | |
163 | $NewUsername = InputBox("Edit Credentials", "Please input the new username you wish to apply!", $GetUserName) | 176 | $NewUsername = InputBox("Edit Credentials", "Please input the new username you wish to apply!", $GetUserName) | |
164 | $NewPassword = InputBox("Edit Credentials", "Please input the new password you wish to apply!", $GetPassword) | 177 | $NewPassword = InputBox("Edit Credentials", "Please input the new password you wish to apply!", $GetPassword) | |
165 | If $NewUsername = "" Or $NewPassword = "" Then | 178 | If $NewUsername = "" Or $NewPassword = "" Then | |
166 | MsgBox(48, "Error", "Username or password was not input. If you wish to remove the credentials remember to type 'Blank' in the boxes without the quoataions.") | 179 | MsgBox(48, "Error", "Username or password was not input. If you wish to remove the credentials remember to type 'Blank' in the boxes without the quoataions.") | |
167 | $Status = 0 | 180 | $Status = 0 | |
168 | EndIf | 181 | EndIf | |
169 | If $NewUsername > "" And $NewPassword > "" Then | 182 | If $NewUsername > "" And $NewPassword > "" Then | |
170 | $CheckInformation = MsgBox(4, "Edit Credentials", "Is this the information you wish to save?" & @CRLF & @CRLF & "Username: " & $NewUsername & @CRLF & _ | 183 | $CheckInformation = MsgBox(4, "Edit Credentials", "Is this the information you wish to save?" & @CRLF & @CRLF & "Username: " & $NewUsername & @CRLF & _ | |
171 | "Password: " & $NewPassword) | 184 | "Password: " & $NewPassword) | |
172 | If $CheckInformation = 6 Then | 185 | If $CheckInformation = 6 Then | |
173 | If $NewUsername = "Blank" Then | 186 | If $NewUsername = "Blank" Then | |
174 | 187 | |||
175 | $ReadIni = IniReadSection(@ScriptDir & "/Data/Login Credentials.ini", "Credentials") | 188 | $ReadIni = IniReadSection(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials") | |
176 | For $i = 1 To $ReadIni[0][0] | 189 | For $i = 1 To $ReadIni[0][0] | |
177 | $SplitData = StringSplit($ReadIni[$i][1], "|") | 190 | $SplitData = StringSplit($ReadIni[$i][1], "|") | |
178 | $DecryptUserName = _Crypt_DecryptData($SplitData[1], $DecryptKey, $CALG_RC4) | 191 | $DecryptUserName = _Crypt_DecryptData($SplitData[1], $DecryptKey, $CALG_RC4) | |
179 | $DecryptedUserName = BinaryToString($DecryptUserName) | 192 | $DecryptedUserName = BinaryToString($DecryptUserName) | |
180 | If $DecryptedUserName = $GetUserName Then | 193 | If $DecryptedUserName = $GetUserName Then | |
181 | IniDelete(@ScriptDir & "/Data/Login Credentials.ini", "Credentials", $i) | 194 | IniDelete(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials", $i) | |
182 | EndIf | 195 | EndIf | |
183 | Next | 196 | Next | |
184 | 197 | |||
185 | $ReadIni = IniReadSection(@ScriptDir & "/Data/Login Credentials.ini", "Credentials") | 198 | $ReadIni = IniReadSection(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials") | |
186 | IniDelete(@ScriptDir & "/Data/Login Credentials.ini", "Credentials") | 199 | IniDelete(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials") | |
187 | For $i = 1 To $ReadIni[0][0] | 200 | For $i = 1 To $ReadIni[0][0] | |
188 | IniWrite(@ScriptDir & "/Data/Login Credentials.ini", "Credentials", $i, $ReadIni[$i][1]) | 201 | IniWrite(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials", $i, $ReadIni[$i][1]) | |
189 | Next | 202 | Next | |
190 | Else | 203 | Else | |
191 | 204 | |||
192 | $EncryptNewUsername = _Crypt_EncryptData($NewUsername, $DecryptKey, $CALG_RC4) | 205 | $EncryptNewUsername = _Crypt_EncryptData($NewUsername, $DecryptKey, $CALG_RC4) | |
193 | $EncryptNewPassword = _Crypt_EncryptData($NewPassword, $DecryptKey, $CALG_RC4) | 206 | $EncryptNewPassword = _Crypt_EncryptData($NewPassword, $DecryptKey, $CALG_RC4) | |
194 | $ReadIni = IniReadSection(@ScriptDir & "/Data/Login Credentials.ini", "Credentials") | 207 | $ReadIni = IniReadSection(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials") | |
195 | For $i = 1 To $ReadIni[0][0] | 208 | For $i = 1 To $ReadIni[0][0] | |
196 | $SplitData = StringSplit($ReadIni[$i][1], "|") | 209 | $SplitData = StringSplit($ReadIni[$i][1], "|") | |
197 | $DecryptUserName = _Crypt_DecryptData($SplitData[1], $DecryptKey, $CALG_RC4) | 210 | $DecryptUserName = _Crypt_DecryptData($SplitData[1], $DecryptKey, $CALG_RC4) | |
198 | $DecryptedUserName = BinaryToString($DecryptUserName) | 211 | $DecryptedUserName = BinaryToString($DecryptUserName) | |
199 | If $DecryptedUserName = $GetUserName Then | 212 | If $DecryptedUserName = $GetUserName Then | |
200 | 213 | |||
201 | IniWrite(@ScriptDir & "/Data/Login Credentials.ini", "Credentials", $i, $EncryptNewUsername & "|" & $EncryptNewPassword) | 214 | IniWrite(@AppDataDir & "/Cred_Data/Credentials.ini", "Credentials", $i, $EncryptNewUsername & "|" & $EncryptNewPassword) | |
202 | ExitLoop | 215 | ExitLoop | |
203 | EndIf | 216 | EndIf | |
204 | 217 | |||
205 | Next | 218 | Next | |
206 | EndIf | 219 | EndIf | |
207 | 220 | |||
208 | MsgBox(0, "Edit Credentials", "Credentials have been changed!") | 221 | MsgBox(0, "Edit Credentials", "Credentials have been changed!") | |
209 | GUIDelete($EditGui) | 222 | GUIDelete($EditGui) | |
210 | _CreateEditGui() | 223 | _CreateEditGui() | |
211 | $Status = 1 | 224 | $Status = 1 | |
212 | Else | 225 | Else | |
213 | $Status = 0 | 226 | $Status = 0 | |
214 | EndIf | 227 | EndIf | |
215 | EndIf | 228 | EndIf | |
216 | WEnd | 229 | WEnd | |
217 | EndFunc ;==>_Edit | 230 | EndFunc ;==>_Edit | |
218 | 231 | |||
219 | Func _CloseGui() | 232 | Func _CloseGui() | |
220 | $FirstEntry = 0 | 233 | $FirstEntry = 0 | |
221 | GUIDelete($EditGui) | 234 | GUIDelete($EditGui) | |
222 | GUISetState(@SW_ENABLE, $MainGui) | 235 | GUISetState(@SW_ENABLE, $MainGui) | |
223 | Sleep(100) | 236 | Sleep(100) | |
224 | WinActivate($MainGui) | 237 | WinActivate($MainGui) | |
225 | EndFunc ;==>_CloseGui | 238 | EndFunc ;==>_CloseGui | |
226 | 239 | |||
227 | 240 | |||
228 | Func _Exit() | 241 | Func _Exit() | |
229 | Exit | 242 | Exit | |
230 | EndFunc ;==>_Exit | 243 | EndFunc ;==>_Exit | |
231 | 244 | |||
232 | 245 | |||
233 | While 1 | 246 | While 1 | |
234 | Sleep(10) | 247 | Sleep(10) | |
235 | WEnd | 248 | WEnd | |