mirror of
https://github.com/quexten/goldwarden.git
synced 2024-09-11 19:17:33 +03:00
This commit is contained in:
commit
e23b63d1a2
2
.github/workflows/PKGBUILD
vendored
2
.github/workflows/PKGBUILD
vendored
@ -12,7 +12,7 @@ sha256sums=('57555dab4afd4fc60785e8ad34f41932988b4cd2ce130daaa719625a0e455481')
|
|||||||
|
|
||||||
prepare(){
|
prepare(){
|
||||||
cd "$pkgname-$pkgver"
|
cd "$pkgname-$pkgver"
|
||||||
mkdir -p build/
|
mkdir -p build/ cmd/
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
@ -61,12 +61,12 @@ go install github.com/quexten/goldwarden@latest
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Setup and Usage
|
### Setup and Usage
|
||||||
To get started, follow the instructions provided in the wiki https://github.com/quexten/goldwarden/cli/wiki/Getting-Started.
|
To get started, follow the instructions provided in the wiki [https://github.com/quexten/goldwarden/cli/wiki/Getting-Started](https://github.com/quexten/goldwarden/wiki/Getting-Started).
|
||||||
For instructions on specific features, also consult the wiki page for the feature.
|
For instructions on specific features, also consult the wiki page for the feature.
|
||||||
|
|
||||||
### Contributing
|
### Contributing
|
||||||
Interested in contributing a feature or bug-fix? Great! Here is some information on how to set up your development environment:
|
Interested in contributing a feature or bug-fix? Great! Here is some information on how to set up your development environment:
|
||||||
|
|
||||||
https://github.com/quexten/goldwarden/cli/wiki/Setting-up-the-Development-Environment
|
https://github.com/quexten/goldwarden/wiki/Setting-up-the-Development-Environment
|
||||||
|
|
||||||
After that, create a PR. If you encounter any issues, feel free to open a discussion thread.
|
After that, create a PR. If you encounter any issues, feel free to open a discussion thread.
|
||||||
|
0
gui/goldwarden_ui_main.py
Normal file → Executable file
0
gui/goldwarden_ui_main.py
Normal file → Executable file
@ -47,15 +47,45 @@ class GoldwardenLoginApp(Adw.Application):
|
|||||||
|
|
||||||
def on_login(self):
|
def on_login(self):
|
||||||
email = self.email_row.get_text()
|
email = self.email_row.get_text()
|
||||||
client_id = self.client_id_row.get_text()
|
client_id = self.client_id_row.get_text().strip()
|
||||||
client_secret = self.client_secret_row.get_text()
|
client_secret = self.client_secret_row.get_text().strip()
|
||||||
server = self.server_row.get_text()
|
server = self.server_row.get_text()
|
||||||
goldwarden.set_url(server)
|
try:
|
||||||
|
goldwarden.set_server(server)
|
||||||
|
except:
|
||||||
|
print("set server failed")
|
||||||
|
dialog = Adw.MessageDialog.new(self.window,
|
||||||
|
"Failed to set server",
|
||||||
|
"The server you entered is invalid, please try again.",
|
||||||
|
)
|
||||||
|
dialog.add_response("ok", "Dismiss")
|
||||||
|
dialog.present()
|
||||||
|
return
|
||||||
|
|
||||||
if client_id != "":
|
if client_id != "":
|
||||||
goldwarden.set_client_id(client_id)
|
goldwarden.set_client_id(client_id)
|
||||||
if client_secret != "":
|
if client_secret != "":
|
||||||
goldwarden.set_client_secret(client_secret)
|
goldwarden.set_client_secret(client_secret)
|
||||||
goldwarden.login_with_password(email, "")
|
|
||||||
|
try:
|
||||||
|
goldwarden.login_with_password(email, "")
|
||||||
|
except Exception as e:
|
||||||
|
if "errorbadpassword" in str(e):
|
||||||
|
dialog = Adw.MessageDialog.new(self.window, "Bad Password", "The username or password you entered is incorrect.")
|
||||||
|
dialog.add_response("ok", "Dismiss")
|
||||||
|
dialog.present()
|
||||||
|
return
|
||||||
|
if "errorcaptcha" in str(e):
|
||||||
|
dialog = Adw.MessageDialog.new(self.window, "Unusual traffic error", "Traffic is unusual, please set up api client id and client secret.")
|
||||||
|
dialog.add_response("ok", "Dismiss")
|
||||||
|
dialog.present()
|
||||||
|
return
|
||||||
|
if "errortotp" in str(e):
|
||||||
|
dialog = Adw.MessageDialog.new(self.window, "TOTP Invalid", "The TOTP code you entered is invalid.")
|
||||||
|
dialog.add_response("ok", "Dismiss")
|
||||||
|
dialog.present()
|
||||||
|
return
|
||||||
|
|
||||||
self.window.close()
|
self.window.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -69,8 +69,13 @@ class GoldwardenQuickAccessApp(Adw.Application):
|
|||||||
auto_type_combo = state & Gdk.ModifierType.CONTROL_MASK and state & Gdk.ModifierType.SHIFT_MASK
|
auto_type_combo = state & Gdk.ModifierType.CONTROL_MASK and state & Gdk.ModifierType.SHIFT_MASK
|
||||||
copy_combo = state & Gdk.ModifierType.CONTROL_MASK and not state & Gdk.ModifierType.SHIFT_MASK
|
copy_combo = state & Gdk.ModifierType.CONTROL_MASK and not state & Gdk.ModifierType.SHIFT_MASK
|
||||||
|
|
||||||
|
if not len(self.filtered_logins) > 0:
|
||||||
|
return
|
||||||
|
|
||||||
# totp code
|
# totp code
|
||||||
if keyval == Gdk.KEY_t or keyval == Gdk.KEY_T:
|
if keyval == Gdk.KEY_t or keyval == Gdk.KEY_T:
|
||||||
|
if self.filtered_logins[self.selected_index]["totp"] == "":
|
||||||
|
return
|
||||||
if auto_type_combo:
|
if auto_type_combo:
|
||||||
self.run_autotype(totp.totp(self.filtered_logins[self.selected_index]["totp"]))
|
self.run_autotype(totp.totp(self.filtered_logins[self.selected_index]["totp"]))
|
||||||
if copy_combo:
|
if copy_combo:
|
||||||
@ -154,15 +159,34 @@ class GoldwardenQuickAccessApp(Adw.Application):
|
|||||||
|
|
||||||
for i in self.filtered_logins:
|
for i in self.filtered_logins:
|
||||||
action_row = Adw.ActionRow()
|
action_row = Adw.ActionRow()
|
||||||
action_row.set_title(i["name"])
|
if "name" in i:
|
||||||
action_row.set_subtitle(i["username"])
|
action_row.set_title(i["name"])
|
||||||
|
else:
|
||||||
|
action_row.set_title("[no name]")
|
||||||
|
if "username" in i:
|
||||||
|
action_row.set_subtitle(i["username"])
|
||||||
|
action_row.username = i["username"]
|
||||||
|
else:
|
||||||
|
action_row.set_subtitle("[no username]")
|
||||||
|
action_row.username = "[no username]"
|
||||||
|
if "password" in i:
|
||||||
|
action_row.password = i["password"]
|
||||||
|
else:
|
||||||
|
action_row.password = "[no password]"
|
||||||
|
if "uri" in i:
|
||||||
|
action_row.uri = i["uri"]
|
||||||
|
else:
|
||||||
|
action_row.uri = "[no uri]"
|
||||||
|
if "uuid" in i:
|
||||||
|
action_row.uuid = i["uuid"]
|
||||||
|
else:
|
||||||
|
action_row.uuid = "[no uuid]"
|
||||||
|
if "totp" in i:
|
||||||
|
action_row.totp = i["totp"]
|
||||||
|
else:
|
||||||
|
action_row.totp = ""
|
||||||
action_row.set_icon_name("dialog-password")
|
action_row.set_icon_name("dialog-password")
|
||||||
action_row.set_activatable(True)
|
action_row.set_activatable(True)
|
||||||
action_row.password = i["password"]
|
|
||||||
action_row.username = i["username"]
|
|
||||||
action_row.uuid = i["uuid"]
|
|
||||||
action_row.uri = i["uri"]
|
|
||||||
action_row.totp = i["totp"]
|
|
||||||
self.results_list.append(action_row)
|
self.results_list.append(action_row)
|
||||||
|
|
||||||
# select the nth item
|
# select the nth item
|
||||||
|
@ -70,8 +70,10 @@ def set_notification_url(url):
|
|||||||
def set_vault_url(url):
|
def set_vault_url(url):
|
||||||
send_authenticated_command(f"config set-vault-url {url}")
|
send_authenticated_command(f"config set-vault-url {url}")
|
||||||
|
|
||||||
def set_url(url):
|
def set_server(url):
|
||||||
send_authenticated_command(f"config set-url {url}")
|
result = send_authenticated_command(f"config set-server {url}")
|
||||||
|
if result.strip() != "Done":
|
||||||
|
raise Exception("Failed to set server")
|
||||||
|
|
||||||
def get_environment():
|
def get_environment():
|
||||||
result = send_authenticated_command(f"config get-environment")
|
result = send_authenticated_command(f"config get-environment")
|
||||||
@ -81,16 +83,19 @@ def get_environment():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def set_client_id(client_id):
|
def set_client_id(client_id):
|
||||||
send_authenticated_command(f"config set-client-id \"{client_id}\"")
|
return send_authenticated_command(f"config set-client-id {client_id}")
|
||||||
|
|
||||||
def set_client_secret(client_secret):
|
def set_client_secret(client_secret):
|
||||||
send_authenticated_command(f"config set-client-secret \"{client_secret}\"")
|
return send_authenticated_command(f"config set-client-secret {client_secret}")
|
||||||
|
|
||||||
def login_with_password(email, password):
|
def login_with_password(email, password):
|
||||||
result = send_authenticated_command(f"vault login --email {email}")
|
result = send_authenticated_command(f"vault login --email {email}")
|
||||||
if not "Logged in" in result:
|
if "Login failed" in result and "username or password" in result.lower():
|
||||||
return "badpass"
|
raise Exception("errorbadpassword")
|
||||||
return "ok"
|
if "Login failed" in result and ("error code 7" in result.lower() or "error code 6" in result.lower()):
|
||||||
|
raise Exception("errorcaptcha")
|
||||||
|
if "Login failed" in result and "two-factor" in result.lower():
|
||||||
|
raise Exception("errortotp")
|
||||||
|
|
||||||
def login_passwordless(email):
|
def login_passwordless(email):
|
||||||
send_authenticated_command(f"vault login --email {email} --passwordless")
|
send_authenticated_command(f"vault login --email {email} --passwordless")
|
||||||
|
Loading…
Reference in New Issue
Block a user