Skip to content

Commit

Permalink
Backport to python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
elias123tre committed Apr 19, 2021
1 parent c72976d commit 88742a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode
__pycache__
logins.js
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ python bitwarden.py

Then choose your Bitwarden json export (needs to be unencrypted :c ) and it will open a nice looking website presenting the duplicates in your browser.

## Requirements

- Python 3.7 at least
- Modern browser (tested with Firefox 88 and Chrome 86)

## Demonstration

![Demonstration](https://i.imgur.com/PlXPOCT.png)
4 changes: 2 additions & 2 deletions bitwarden.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

# %% Get items and folders from file
with open(filename, encoding="utf-8") as f:
data: dict[list[dict]] = json.load(f)
data = json.load(f)
folders = data.get("folders", [])
items = data.get("items", [])

Expand All @@ -42,7 +42,7 @@ def domains(entry):
def transform(url):
match = re.match(r"(\w+:\/\/)?([\w.]+)(\/?.*)", url)
if match:
return ".".join(match.group(2).removeprefix("www.").split(".")[-2:])
return ".".join(match.group(2).split(".")[-2:])
return ""
return set(filter(None, (transform(uri.get("uri")) for uri in entry.get("uris", []))))

Expand Down

0 comments on commit 88742a3

Please sign in to comment.