pwrot 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pwrot-0.3.0/.github/workflows/ci.yml +34 -0
- pwrot-0.3.0/.gitignore +55 -0
- pwrot-0.3.0/CHANGELOG.md +31 -0
- pwrot-0.3.0/CONTRIBUTING.md +47 -0
- pwrot-0.3.0/LICENSE +21 -0
- pwrot-0.3.0/MANIFEST.in +12 -0
- pwrot-0.3.0/PKG-INFO +454 -0
- pwrot-0.3.0/README.md +419 -0
- pwrot-0.3.0/SECURITY.md +49 -0
- pwrot-0.3.0/docs/.nojekyll +0 -0
- pwrot-0.3.0/docs/404.html +25 -0
- pwrot-0.3.0/docs/assets/app.js +74 -0
- pwrot-0.3.0/docs/assets/styles.css +666 -0
- pwrot-0.3.0/docs/favicon.svg +6 -0
- pwrot-0.3.0/docs/index.html +293 -0
- pwrot-0.3.0/docs/robots.txt +4 -0
- pwrot-0.3.0/docs/sitemap.xml +8 -0
- pwrot-0.3.0/pyproject.toml +55 -0
- pwrot-0.3.0/requirements.txt +3 -0
- pwrot-0.3.0/setup.cfg +4 -0
- pwrot-0.3.0/setup.ps1 +40 -0
- pwrot-0.3.0/src/pwrot/__init__.py +3 -0
- pwrot-0.3.0/src/pwrot/__main__.py +4 -0
- pwrot-0.3.0/src/pwrot/agent.py +1321 -0
- pwrot-0.3.0/src/pwrot/audit.py +28 -0
- pwrot-0.3.0/src/pwrot/brave.py +84 -0
- pwrot-0.3.0/src/pwrot/browser.py +166 -0
- pwrot-0.3.0/src/pwrot/browser_store.py +835 -0
- pwrot-0.3.0/src/pwrot/cli.py +509 -0
- pwrot-0.3.0/src/pwrot/config.py +76 -0
- pwrot-0.3.0/src/pwrot/csv_store.py +140 -0
- pwrot-0.3.0/src/pwrot/discover.py +118 -0
- pwrot-0.3.0/src/pwrot/dom.py +274 -0
- pwrot-0.3.0/src/pwrot/gmail_imap.py +263 -0
- pwrot-0.3.0/src/pwrot/heuristics.py +311 -0
- pwrot-0.3.0/src/pwrot/llm.py +202 -0
- pwrot-0.3.0/src/pwrot/mail.py +139 -0
- pwrot-0.3.0/src/pwrot/models.py +81 -0
- pwrot-0.3.0/src/pwrot/recipes.py +304 -0
- pwrot-0.3.0/src/pwrot/report.py +41 -0
- pwrot-0.3.0/src/pwrot/security.py +74 -0
- pwrot-0.3.0/src/pwrot/totp.py +56 -0
- pwrot-0.3.0/src/pwrot/websearch.py +263 -0
- pwrot-0.3.0/src/pwrot.egg-info/PKG-INFO +454 -0
- pwrot-0.3.0/src/pwrot.egg-info/SOURCES.txt +64 -0
- pwrot-0.3.0/src/pwrot.egg-info/dependency_links.txt +1 -0
- pwrot-0.3.0/src/pwrot.egg-info/entry_points.txt +2 -0
- pwrot-0.3.0/src/pwrot.egg-info/requires.txt +8 -0
- pwrot-0.3.0/src/pwrot.egg-info/top_level.txt +1 -0
- pwrot-0.3.0/tests/test_agent.py +992 -0
- pwrot-0.3.0/tests/test_brave.py +233 -0
- pwrot-0.3.0/tests/test_browser_store.py +326 -0
- pwrot-0.3.0/tests/test_cli.py +31 -0
- pwrot-0.3.0/tests/test_config.py +56 -0
- pwrot-0.3.0/tests/test_csv_store.py +101 -0
- pwrot-0.3.0/tests/test_discover.py +128 -0
- pwrot-0.3.0/tests/test_gmail_imap.py +41 -0
- pwrot-0.3.0/tests/test_heuristics.py +235 -0
- pwrot-0.3.0/tests/test_llm.py +164 -0
- pwrot-0.3.0/tests/test_mail.py +108 -0
- pwrot-0.3.0/tests/test_models.py +41 -0
- pwrot-0.3.0/tests/test_recipes.py +253 -0
- pwrot-0.3.0/tests/test_report.py +48 -0
- pwrot-0.3.0/tests/test_security.py +57 -0
- pwrot-0.3.0/tests/test_totp.py +31 -0
- pwrot-0.3.0/tests/test_websearch.py +189 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
name: ${{ matrix.os }} / Python ${{ matrix.python }}
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, windows-latest]
|
|
18
|
+
python: ["3.10", "3.11", "3.12"]
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python }}
|
|
24
|
+
cache: pip
|
|
25
|
+
- name: Install
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install -U pip
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
- name: Lint
|
|
30
|
+
run: ruff check src tests
|
|
31
|
+
- name: Unit tests
|
|
32
|
+
run: python -m unittest discover -s tests
|
|
33
|
+
- name: Build package
|
|
34
|
+
run: python -m build
|
pwrot-0.3.0/.gitignore
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Secrets and machine-local state -- never commit these
|
|
2
|
+
.env
|
|
3
|
+
config.yaml
|
|
4
|
+
CONTEXT.md
|
|
5
|
+
HANDOFF.md
|
|
6
|
+
gh_token.txt
|
|
7
|
+
*.token
|
|
8
|
+
secrets/
|
|
9
|
+
output/
|
|
10
|
+
sites/
|
|
11
|
+
.browser-profile/
|
|
12
|
+
.brave-profile/
|
|
13
|
+
*.kdbx
|
|
14
|
+
*.key
|
|
15
|
+
*.pem
|
|
16
|
+
*.p12
|
|
17
|
+
*.pfx
|
|
18
|
+
|
|
19
|
+
# Credential exports and run artifacts
|
|
20
|
+
*.csv
|
|
21
|
+
!tests/fixtures/**/*.csv
|
|
22
|
+
*.log
|
|
23
|
+
*.sqlite
|
|
24
|
+
*.db
|
|
25
|
+
Login Data
|
|
26
|
+
Login Data-journal
|
|
27
|
+
Local State
|
|
28
|
+
*.png
|
|
29
|
+
!docs/**/*.png
|
|
30
|
+
|
|
31
|
+
# Reviewer/scratch artifacts
|
|
32
|
+
.review-tmp/
|
|
33
|
+
RELEASE_REVIEW.md
|
|
34
|
+
|
|
35
|
+
# Python
|
|
36
|
+
__pycache__/
|
|
37
|
+
*.py[cod]
|
|
38
|
+
.venv/
|
|
39
|
+
.venv*/
|
|
40
|
+
*.egg-info/
|
|
41
|
+
dist/
|
|
42
|
+
build/
|
|
43
|
+
.pytest_cache/
|
|
44
|
+
.ruff_cache/
|
|
45
|
+
.coverage
|
|
46
|
+
htmlcov/
|
|
47
|
+
.tox/
|
|
48
|
+
.mypy_cache/
|
|
49
|
+
.tools/
|
|
50
|
+
|
|
51
|
+
# Editors / OS
|
|
52
|
+
.idea/
|
|
53
|
+
.vscode/
|
|
54
|
+
.DS_Store
|
|
55
|
+
Thumbs.db
|
pwrot-0.3.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.0 — unreleased
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Opt-in human-assisted mode with a visible console pause and resume.
|
|
8
|
+
- Secret-free per-site navigation hints.
|
|
9
|
+
- Keyless web-search fallback and bounded same-site discovery.
|
|
10
|
+
- Human-assisted and automatic recovery of the change-password page.
|
|
11
|
+
|
|
12
|
+
### Security
|
|
13
|
+
|
|
14
|
+
- Learned recipe URLs are reduced to an allowlisted account/security path; all
|
|
15
|
+
queries, fragments, userinfo, emails, UUIDs and opaque tokens are removed.
|
|
16
|
+
- LLM-bound element text, ARIA, titles and placeholders are sanitized; form
|
|
17
|
+
values are never read, page text is opt-in, and non-loopback endpoints require
|
|
18
|
+
explicit approval.
|
|
19
|
+
- Reset, login and forgot-password links are rejected when they leave the
|
|
20
|
+
account's own site, including redirects and LLM-selected navigation.
|
|
21
|
+
- JSON reports are masked by default. Plaintext reports require
|
|
22
|
+
`--include-passwords`.
|
|
23
|
+
- Public examples disable browser-store sync, remote LLM use, and off-site
|
|
24
|
+
navigation by default.
|
|
25
|
+
|
|
26
|
+
## 0.2.0
|
|
27
|
+
|
|
28
|
+
- Cross-platform Chromium password-store synchronization.
|
|
29
|
+
- Gmail OTP and reset-link support.
|
|
30
|
+
- Deterministic heuristics with optional local Ollama fallback.
|
|
31
|
+
- CSV rotation reports, audit log, screenshots, and dry-run mode.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Development setup
|
|
4
|
+
|
|
5
|
+
```powershell
|
|
6
|
+
git clone <repository-url>
|
|
7
|
+
cd pwrot
|
|
8
|
+
python -m venv .venv
|
|
9
|
+
.\.venv\Scripts\Activate.ps1
|
|
10
|
+
python -m pip install -U pip
|
|
11
|
+
pip install -e ".[dev]"
|
|
12
|
+
playwright install chromium
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
On macOS or Linux, use `source .venv/bin/activate`.
|
|
16
|
+
|
|
17
|
+
## Checks
|
|
18
|
+
|
|
19
|
+
```powershell
|
|
20
|
+
ruff check src tests
|
|
21
|
+
python -m unittest discover -s tests
|
|
22
|
+
python -m build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Run only synthetic, offline tests. Never run `pwrot run --live` against a real
|
|
26
|
+
account while developing.
|
|
27
|
+
|
|
28
|
+
## Security rules for contributions
|
|
29
|
+
|
|
30
|
+
- Use only synthetic credentials and reserved domains such as `example.com`.
|
|
31
|
+
- Never commit a real CSV, browser profile, screenshot, report, `.env`, reset
|
|
32
|
+
link, OTP, cookie, or API key.
|
|
33
|
+
- Do not add code that bypasses CAPTCHA, MFA, OS reauthentication, or browser
|
|
34
|
+
security prompts.
|
|
35
|
+
- Keep credentials on the account's own site.
|
|
36
|
+
- Do not weaken the recipe sanitizer, LLM redaction, or remote-endpoint guard.
|
|
37
|
+
- Add regression tests for any change involving URLs, secrets, browser stores,
|
|
38
|
+
email, or page snapshots.
|
|
39
|
+
|
|
40
|
+
## Pull requests
|
|
41
|
+
|
|
42
|
+
Include:
|
|
43
|
+
|
|
44
|
+
- the problem and the chosen approach
|
|
45
|
+
- tests that would fail before the change
|
|
46
|
+
- any privacy or security impact
|
|
47
|
+
- confirmation that no live-account testing was performed
|
pwrot-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pwrot contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pwrot-0.3.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include CONTRIBUTING.md
|
|
5
|
+
include SECURITY.md
|
|
6
|
+
include pyproject.toml
|
|
7
|
+
include requirements.txt
|
|
8
|
+
include setup.ps1
|
|
9
|
+
include .gitignore
|
|
10
|
+
recursive-include tests *.py
|
|
11
|
+
recursive-include .github *.yml
|
|
12
|
+
recursive-include docs *
|
pwrot-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pwrot
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Assisted CSV password-rotation agent: browser login, email OTP/link, verification
|
|
5
|
+
Author: pwrot contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://abhishekkgarala.github.io/pwrot/
|
|
8
|
+
Project-URL: Repository, https://github.com/abhishekkgarala/pwrot
|
|
9
|
+
Project-URL: Issues, https://github.com/abhishekkgarala/pwrot/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/abhishekkgarala/pwrot/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: password-rotation,playwright,security,automation
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Security
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: playwright>=1.44
|
|
28
|
+
Requires-Dist: PyYAML>=6.0
|
|
29
|
+
Requires-Dist: cryptography>=42
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
33
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# pwrot — assisted password-rotation agent
|
|
37
|
+
|
|
38
|
+
**Website:** https://abhishekkgarala.github.io/pwrot/
|
|
39
|
+
|
|
40
|
+
`pwrot` reads a CSV of logins, opens each site in a real browser, signs in, walks
|
|
41
|
+
the change-password flow, optionally fetches an OTP or reset link from Gmail,
|
|
42
|
+
sets a new password, verifies the change, and writes the result to a rotated
|
|
43
|
+
CSV.
|
|
44
|
+
|
|
45
|
+
It is intended for **accounts you own or are explicitly authorized to manage**.
|
|
46
|
+
The default is a dry run; `--live` is required to change anything.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
CSV ──► agent ──► Playwright browser ──► site
|
|
50
|
+
│ ▲
|
|
51
|
+
│ └── Gmail IMAP (optional: OTP / reset link / confirmation)
|
|
52
|
+
▼
|
|
53
|
+
<name>-rotated.csv + run.json + audit.jsonl + screenshots/
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The deterministic heuristics use field names, autocomplete hints, button text,
|
|
57
|
+
and page structure. An optional local Ollama model can choose which visible
|
|
58
|
+
element matches a goal. CAPTCHAs, SMS codes, OS prompts, and missing TOTP seeds
|
|
59
|
+
are **not** bypassed: the row is marked `needs human`, a screenshot is saved, and
|
|
60
|
+
the run continues.
|
|
61
|
+
|
|
62
|
+
## Read this first (safety)
|
|
63
|
+
|
|
64
|
+
- **`--live` is required to change anything.** Without it, `run` is a dry run
|
|
65
|
+
that only reads the CSV. `plan` is always a dry run.
|
|
66
|
+
- **The rotated CSV contains plaintext passwords.** JSON reports are masked by
|
|
67
|
+
default; `--include-passwords` stores plaintext old/new passwords in the
|
|
68
|
+
report and should be used only in a private location.
|
|
69
|
+
- **Screenshots may contain account data, email addresses, or OTPs.** Keep
|
|
70
|
+
`output/` private and delete it when no longer needed.
|
|
71
|
+
- **Only use this on accounts you own.** Automated password changes may violate
|
|
72
|
+
a site's terms and can trigger a lockout. Test with a throwaway account first.
|
|
73
|
+
- **The agent does not solve CAPTCHAs or bypass MFA.** Those rows are reported
|
|
74
|
+
for manual completion, or paused in `--assist` mode.
|
|
75
|
+
- Banks, payment providers, government sites, the inbox account used for OTPs,
|
|
76
|
+
and password-manager logins are skipped by default.
|
|
77
|
+
- Start with a small `--limit` until you trust the heuristics on your sites.
|
|
78
|
+
|
|
79
|
+
## Requirements
|
|
80
|
+
|
|
81
|
+
- Python 3.10+
|
|
82
|
+
- Windows 10/11, macOS, or Linux
|
|
83
|
+
- Chrome, Edge, Brave, or Playwright's bundled Chromium
|
|
84
|
+
- Optional: [Ollama](https://ollama.com) for the unfamiliar-page fallback
|
|
85
|
+
- Optional: a Gmail account with 2-Step Verification and an App Password
|
|
86
|
+
(needed for sites that send OTPs or reset links)
|
|
87
|
+
|
|
88
|
+
## Install
|
|
89
|
+
|
|
90
|
+
```powershell
|
|
91
|
+
git clone <repository-url>
|
|
92
|
+
cd pwrot
|
|
93
|
+
python -m venv .venv
|
|
94
|
+
.\.venv\Scripts\Activate.ps1
|
|
95
|
+
python -m pip install -U pip
|
|
96
|
+
pip install -e .
|
|
97
|
+
playwright install chromium
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
On macOS or Linux:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python3 -m venv .venv
|
|
104
|
+
source .venv/bin/activate
|
|
105
|
+
python -m pip install -U pip
|
|
106
|
+
pip install -e .
|
|
107
|
+
playwright install chromium
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or run `./setup.ps1` on Windows, which installs the package and creates the
|
|
111
|
+
virtual environment. Create `config.yaml` and `.env` manually as described below.
|
|
112
|
+
|
|
113
|
+
## Configure
|
|
114
|
+
|
|
115
|
+
Create `config.yaml` and `.env` in the project directory. Do not commit either
|
|
116
|
+
file. Add secrets to `.env`, for example:
|
|
117
|
+
|
|
118
|
+
```env
|
|
119
|
+
GMAIL_APP_PASSWORD=
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Then put the settings below in `config.yaml`. A minimal setup:
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
csv:
|
|
126
|
+
path: "C:/Users/you/Downloads/Passwords.csv"
|
|
127
|
+
output: null # null = <name>-rotated.csv next to the input
|
|
128
|
+
|
|
129
|
+
rotation:
|
|
130
|
+
new_password:
|
|
131
|
+
length: 24
|
|
132
|
+
symbols: true
|
|
133
|
+
delay_between_sites_seconds: 5
|
|
134
|
+
max_sites_per_run: 0 # 0 = every row
|
|
135
|
+
|
|
136
|
+
safety:
|
|
137
|
+
only_domains: [] # if set, ONLY these domains are touched
|
|
138
|
+
skip_domains:
|
|
139
|
+
- "*bank*"
|
|
140
|
+
- "*.gov"
|
|
141
|
+
skip_email_account: true
|
|
142
|
+
skip_password_manager: true
|
|
143
|
+
|
|
144
|
+
gmail:
|
|
145
|
+
enabled: true
|
|
146
|
+
address: "you@example.com"
|
|
147
|
+
app_password_env: GMAIL_APP_PASSWORD
|
|
148
|
+
folder: "INBOX"
|
|
149
|
+
|
|
150
|
+
llm:
|
|
151
|
+
enabled: false # safe deterministic default
|
|
152
|
+
base_url: "http://localhost:11434/v1"
|
|
153
|
+
model: "qwen3.5:4b"
|
|
154
|
+
include_page_text: false
|
|
155
|
+
allow_remote: false
|
|
156
|
+
|
|
157
|
+
browser:
|
|
158
|
+
headless: false
|
|
159
|
+
slow_mo_ms: 50
|
|
160
|
+
timeout_ms: 30000
|
|
161
|
+
profile_dir: ".browser-profile"
|
|
162
|
+
channel: chrome # chrome | msedge | null (bundled chromium)
|
|
163
|
+
|
|
164
|
+
passwords:
|
|
165
|
+
sync: false # opt in to writing the browser password store
|
|
166
|
+
browser: auto
|
|
167
|
+
user_data_dir: null
|
|
168
|
+
profile: "Default"
|
|
169
|
+
|
|
170
|
+
report:
|
|
171
|
+
path: "output/run.json"
|
|
172
|
+
|
|
173
|
+
logging:
|
|
174
|
+
audit_path: "output/audit.jsonl"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### CSV input
|
|
178
|
+
|
|
179
|
+
Required columns: `url`, `password`. A `username` (or `email`) column is used to
|
|
180
|
+
sign in; a `totp_secret` column is optional. Unknown columns are preserved.
|
|
181
|
+
|
|
182
|
+
```csv
|
|
183
|
+
name,url,username,password,note
|
|
184
|
+
Example,https://www.example.com/login,me@example.com,old-secret,hello
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Header aliases are accepted (`origin`/`website` for `url`, `email`/`login` for
|
|
188
|
+
`username`, `pass` for `password`, `otp`/`2fa` for `totp_secret`).
|
|
189
|
+
|
|
190
|
+
The input CSV is never modified. New passwords are written to
|
|
191
|
+
`<name>-rotated.csv` or an explicit output path.
|
|
192
|
+
|
|
193
|
+
### Gmail
|
|
194
|
+
|
|
195
|
+
1. Enable 2-Step Verification on the Google account.
|
|
196
|
+
2. Google Account → Security → App passwords → create one for "Mail".
|
|
197
|
+
3. Put it in `.env` as `GMAIL_APP_PASSWORD=...` and set `gmail.address`.
|
|
198
|
+
|
|
199
|
+
The client opens the mailbox **read-only**, so it never marks mail as read. If
|
|
200
|
+
OTP mail is filtered into another tab, set `gmail.folder: "[Gmail]/All Mail"`.
|
|
201
|
+
|
|
202
|
+
If Gmail is disabled or unreachable, sites that require an OTP are reported as
|
|
203
|
+
`needs human`; everything else still runs.
|
|
204
|
+
|
|
205
|
+
### Local model fallback
|
|
206
|
+
|
|
207
|
+
```powershell
|
|
208
|
+
ollama pull qwen3.5:4b
|
|
209
|
+
ollama serve
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The fallback only chooses which visible element matches a goal. It never types
|
|
213
|
+
or invents passwords, and it is capped by `llm.max_calls_per_site`.
|
|
214
|
+
|
|
215
|
+
Privacy controls:
|
|
216
|
+
|
|
217
|
+
- Form values are never included in prompts.
|
|
218
|
+
- Sensitive controls (passwords, OTP, code, token, recovery, payment, PIN) are
|
|
219
|
+
redacted.
|
|
220
|
+
- Visible text, ARIA labels, titles, and placeholders are sanitized for URLs,
|
|
221
|
+
email addresses, UUIDs, long tokens, and numeric identifiers.
|
|
222
|
+
- Page text is excluded unless `llm.include_page_text: true`; when enabled it
|
|
223
|
+
passes through the same sanitizer.
|
|
224
|
+
- Only `localhost`, loopback IP literals, and IPv6 `::1` are treated as local.
|
|
225
|
+
Other endpoints are refused unless `llm.allow_remote: true`.
|
|
226
|
+
|
|
227
|
+
Keep the model local unless you have reviewed what data leaves the machine.
|
|
228
|
+
|
|
229
|
+
### Browser
|
|
230
|
+
|
|
231
|
+
The default launches a dedicated profile in `.browser-profile/`, so sessions
|
|
232
|
+
persist between runs. To reuse a Chrome you already started:
|
|
233
|
+
|
|
234
|
+
```powershell
|
|
235
|
+
chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\chrome-pwrot"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Then set `browser.attach_url: "http://127.0.0.1:9222"`.
|
|
239
|
+
|
|
240
|
+
Keep `headless: false`: CAPTCHA and OS prompts need a visible window.
|
|
241
|
+
|
|
242
|
+
### Browser password manager sync
|
|
243
|
+
|
|
244
|
+
`pwrot` can write rotated passwords into a Chromium-family browser's built-in
|
|
245
|
+
password manager: Chrome, Edge, Brave, Chromium, Vivaldi, and Opera, on Windows,
|
|
246
|
+
macOS, and Linux.
|
|
247
|
+
|
|
248
|
+
- Set `passwords.sync: true` only after reading the security notes.
|
|
249
|
+
- Leave `passwords.user_data_dir: null` to auto-detect the profile folder.
|
|
250
|
+
- **Close the browser completely** before a live run. Chromium locks and caches
|
|
251
|
+
`Login Data`; a running browser can overwrite the change.
|
|
252
|
+
- If the browser is open, the rotation still succeeds and the run prints a
|
|
253
|
+
reminder; sync later with `sync-passwords`.
|
|
254
|
+
|
|
255
|
+
```powershell
|
|
256
|
+
# show every detected store and its profiles
|
|
257
|
+
pwrot sync-passwords --list
|
|
258
|
+
|
|
259
|
+
# after a live run, sync rows marked "updated" in an unmasked report
|
|
260
|
+
pwrot sync-passwords --report output/run.json
|
|
261
|
+
|
|
262
|
+
# target a specific browser and CSV
|
|
263
|
+
pwrot sync-passwords --browser chrome --csv "C:/Users/you/Downloads/Chrome Passwords.csv"
|
|
264
|
+
|
|
265
|
+
# preview the matches without writing
|
|
266
|
+
pwrot sync-passwords --browser brave --csv "..." --dry-run
|
|
267
|
+
|
|
268
|
+
# wait until the browser is closed, then sync
|
|
269
|
+
pwrot sync-passwords --browser edge --csv "..." --wait
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The sync matches a saved login by **host + username**, writes the new password
|
|
273
|
+
into `Login Data`, backs the database up first, and verifies the write by
|
|
274
|
+
decrypting it. Restart the browser afterwards.
|
|
275
|
+
|
|
276
|
+
How the password is encrypted depends on the OS:
|
|
277
|
+
|
|
278
|
+
| OS | Format | Key source |
|
|
279
|
+
|---|---|---|
|
|
280
|
+
| Windows | `v10`, AES-256-GCM | DPAPI-protected `os_crypt.encrypted_key` in `Local State` |
|
|
281
|
+
| macOS | `v10`, AES-128-CBC | "Safe Storage" password from the login Keychain (PBKDF2-SHA1, 1003 iterations) |
|
|
282
|
+
| Linux | `v10`, AES-128-CBC | Secret Service via `secret-tool`, or the `peanuts` fallback (PBKDF2-SHA1, 1 iteration) |
|
|
283
|
+
|
|
284
|
+
Trade-off: recent Chrome/Brave on Windows store new passwords with app-bound
|
|
285
|
+
encryption (`v20`). Only the browser itself can create `v20` entries, so the
|
|
286
|
+
sync writes legacy `v10` entries. The browser still reads them, but they are not
|
|
287
|
+
app-bound. Prefer `--report` (only rows that were just rotated) over `--csv`
|
|
288
|
+
(which rewrites every matching row).
|
|
289
|
+
|
|
290
|
+
The password-manager **UI** can be locked behind Windows Hello or a similar
|
|
291
|
+
reauthentication gate. The sync does not try to bypass that UI; it updates the
|
|
292
|
+
encrypted store directly.
|
|
293
|
+
|
|
294
|
+
## Use it
|
|
295
|
+
|
|
296
|
+
```powershell
|
|
297
|
+
# validate config, CSV, browser, model, Gmail, and detected password stores
|
|
298
|
+
pwrot doctor
|
|
299
|
+
|
|
300
|
+
# inspect what would happen without changing anything
|
|
301
|
+
pwrot plan --limit 3
|
|
302
|
+
|
|
303
|
+
# make a small live run first
|
|
304
|
+
pwrot run --live --limit 1
|
|
305
|
+
|
|
306
|
+
# render the report with plaintext passwords only when explicitly needed
|
|
307
|
+
pwrot run --live --include-passwords
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Useful flags: `--csv PATH`, `--out PATH`, `--site DOMAIN` (repeatable),
|
|
311
|
+
`--limit N`, `--mask`, `--include-passwords`, `-c other-config.yaml`.
|
|
312
|
+
|
|
313
|
+
### Human-assisted mode
|
|
314
|
+
|
|
315
|
+
The default run is unattended. Add `--assist` when a site needs a CAPTCHA, an
|
|
316
|
+
SMS code, or an unusual page:
|
|
317
|
+
|
|
318
|
+
```powershell
|
|
319
|
+
pwrot run --live --assist --site example.com
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
When a row hits a blocker, pwrot keeps the browser open at that page and waits
|
|
323
|
+
in the console:
|
|
324
|
+
|
|
325
|
+
- Solve only the blocker (CAPTCHA, SMS/email code, or navigate to the right page).
|
|
326
|
+
- **Do not type or save the new password yourself.** pwrot still generates,
|
|
327
|
+
fills, submits and verifies it.
|
|
328
|
+
- Press **Enter** when ready, or type `s` to skip the row.
|
|
329
|
+
|
|
330
|
+
Each assist is recorded in `sites/assist-recipes.json` (URLs and control
|
|
331
|
+
descriptions only, never passwords or codes). On later runs pwrot logs the
|
|
332
|
+
saved tip and tries the recorded page before its own guesses.
|
|
333
|
+
|
|
334
|
+
`--assist` must run in a normal terminal, not detached or redirected. Set
|
|
335
|
+
`assist.enabled: true` in `config.yaml` to make it the default.
|
|
336
|
+
|
|
337
|
+
### Finding the change-password page automatically
|
|
338
|
+
|
|
339
|
+
Before a row becomes `needs human`, pwrot tries to discover the right page:
|
|
340
|
+
|
|
341
|
+
1. A page learned in `--assist` mode (`sites/assist-recipes.json`).
|
|
342
|
+
2. A keyless web search (`websearch:` in `config.yaml`). It tries Bing's RSS
|
|
343
|
+
endpoint first, then DuckDuckGo.
|
|
344
|
+
3. The built-in URL guesses (`/settings/security`, `/change-password`, ...).
|
|
345
|
+
4. The site's own navigation (`discovery.crawl_site`). It follows same-site
|
|
346
|
+
links whose text or URL mentions account, security, settings or password,
|
|
347
|
+
up to `max_pages`. Logout, delete, deactivate and unsubscribe links are
|
|
348
|
+
always excluded.
|
|
349
|
+
|
|
350
|
+
Search engines block bots unpredictably, so the search step is best-effort and
|
|
351
|
+
may return nothing. That is harmless: the site crawl and built-in guesses still
|
|
352
|
+
run. Off-site results are never used to enter credentials. They are opened
|
|
353
|
+
read-only only when `websearch.allow_external_navigation: true`; the setting
|
|
354
|
+
defaults to `false` when omitted.
|
|
355
|
+
|
|
356
|
+
Email reset links and “Sign in” links are followed only when they resolve to the
|
|
357
|
+
account’s own domain or a parent/subdomain covered by the same-site rule. An
|
|
358
|
+
off-site reset or login link stops the row at `needs human` instead of sending
|
|
359
|
+
credentials elsewhere.
|
|
360
|
+
|
|
361
|
+
A URL that works is saved to `sites/assist-recipes.json`. Persisted navigation
|
|
362
|
+
keeps the site origin and only allowlisted account/security path segments such
|
|
363
|
+
as `/account/security`. Query strings, fragments, userinfo, encoded emails,
|
|
364
|
+
UUIDs, opaque tokens, and any unknown path segment reduce the saved hint to a
|
|
365
|
+
safe prefix or the origin.
|
|
366
|
+
|
|
367
|
+
## Output
|
|
368
|
+
|
|
369
|
+
- **`<name>-rotated.csv`** — the original headers plus new passwords. The input
|
|
370
|
+
CSV is never modified. Treat this file as a secret.
|
|
371
|
+
- **`output/run.json`** — one record per row: status, reason, verification, and
|
|
372
|
+
screenshot path. Passwords are masked unless `--include-passwords` is used.
|
|
373
|
+
- **`output/audit.jsonl`** — secrets-free action log.
|
|
374
|
+
- **`output/screenshots/`** — captures for rows that need a human or failed.
|
|
375
|
+
Treat these as sensitive.
|
|
376
|
+
|
|
377
|
+
Statuses: `updated`, `needs human`, `failed`, `skipped`, `dry run`.
|
|
378
|
+
|
|
379
|
+
A row is marked `updated` only when the site shows a success message or a
|
|
380
|
+
confirmation email arrives, and the new password is then written to the rotated
|
|
381
|
+
CSV. Unverified changes are reported as `needs human`.
|
|
382
|
+
|
|
383
|
+
Exit codes: `0` all rows handled, `1` config/CSV/precondition error, `2` at least
|
|
384
|
+
one row needs a human or failed, `130` interrupted.
|
|
385
|
+
|
|
386
|
+
## How it works
|
|
387
|
+
|
|
388
|
+
1. Open the CSV `url`.
|
|
389
|
+
2. If a login form is present, fill the username/email and old password, submit,
|
|
390
|
+
and detect a failed sign-in.
|
|
391
|
+
3. Find a change-password entry point (learned page, search result, same-site
|
|
392
|
+
account/security link, or common URL) and open the form.
|
|
393
|
+
4. Fill old/new/confirm fields, submit, and answer an email OTP, TOTP code or
|
|
394
|
+
emailed reset link when required.
|
|
395
|
+
5. Confirm success on the page or in the inbox, then record the new password.
|
|
396
|
+
6. Skip CAPTCHA/SMS/unknown-TOTP rows with a screenshot and continue. With
|
|
397
|
+
`--assist`, keep the page open and wait for a human instead.
|
|
398
|
+
|
|
399
|
+
## Limitations / troubleshooting
|
|
400
|
+
|
|
401
|
+
- **Unfamiliar pages:** the deterministic pass may miss a custom widget; the
|
|
402
|
+
local model gets one chance per step. If it still cannot proceed, the row is
|
|
403
|
+
reported instead of guessed at.
|
|
404
|
+
- **CAPTCHA / device approval / security questions:** completed manually. With
|
|
405
|
+
`--assist` pwrot pauses on the page; otherwise it marks the row `needs human`.
|
|
406
|
+
- **Wrong password in the CSV:** the row is reported as `needs human`; fix the
|
|
407
|
+
CSV and re-run that site.
|
|
408
|
+
- **Search engines are unreliable:** DuckDuckGo/Google may show bot checks and
|
|
409
|
+
Bing may return generic results. This does not block the site crawl or the
|
|
410
|
+
built-in guesses.
|
|
411
|
+
- **Some sites cannot be automated:** tenant portals and app-only settings may
|
|
412
|
+
still require manual work.
|
|
413
|
+
|
|
414
|
+
## Project layout
|
|
415
|
+
|
|
416
|
+
```
|
|
417
|
+
src/pwrot/
|
|
418
|
+
cli.py command line: run | plan | doctor | sync-passwords
|
|
419
|
+
config.py config.yaml loader
|
|
420
|
+
csv_store.py CSV read/write and header aliases
|
|
421
|
+
models.py Credential / AccountResult / Status
|
|
422
|
+
dom.py Playwright page wrapper + element snapshot + recorder
|
|
423
|
+
heuristics.py login, password, OTP, CAPTCHA and success detection
|
|
424
|
+
llm.py OpenAI-compatible client with prompt redaction
|
|
425
|
+
agent.py per-account state machine and safety rules
|
|
426
|
+
recipes.py secret-free per-site hints learned in --assist mode
|
|
427
|
+
websearch.py keyless search clients (Bing RSS, DuckDuckGo) + ranking
|
|
428
|
+
discover.py same-site account/security link discovery
|
|
429
|
+
mail.py Gmail OTP / reset-link / confirmation polling
|
|
430
|
+
gmail_imap.py read-only IMAP + extraction helpers
|
|
431
|
+
browser.py Playwright launch or CDP attach
|
|
432
|
+
browser_store.py Chromium Login Data sync for every browser/OS
|
|
433
|
+
brave.py compatibility shim; defaults to Brave
|
|
434
|
+
security.py password generation, masking, redaction
|
|
435
|
+
totp.py TOTP generation
|
|
436
|
+
report.py JSON summary
|
|
437
|
+
audit.py append-only JSONL trail
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
## Development
|
|
441
|
+
|
|
442
|
+
```powershell
|
|
443
|
+
pip install -e ".[dev]"
|
|
444
|
+
ruff check src tests
|
|
445
|
+
python -m unittest discover -s tests
|
|
446
|
+
python -m build
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
See `CONTRIBUTING.md` and `SECURITY.md`. Never use a real account while
|
|
450
|
+
developing, and never include real credentials in a test or bug report.
|
|
451
|
+
|
|
452
|
+
## License
|
|
453
|
+
|
|
454
|
+
MIT. See `LICENSE`.
|