https://github.com/robinvandernoord/2fas-python
Unofficial implementation to run .2fas files locally via Python
https://github.com/robinvandernoord/2fas-python
2fas cli python
Last synced: 3 months ago
JSON representation
Unofficial implementation to run .2fas files locally via Python
- Host: GitHub
- URL: https://github.com/robinvandernoord/2fas-python
- Owner: robinvandernoord
- License: mit
- Created: 2024-01-17T16:58:06.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2026-01-14T10:12:27.000Z (5 months ago)
- Last Synced: 2026-01-14T14:21:31.005Z (5 months ago)
- Topics: 2fas, cli, python
- Language: Python
- Homepage:
- Size: 166 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 2fas Python
2fas-python is an unofficial implementation
of [2FAS - the Internet’s favorite open-source two-factor authenticator](https://2fas.com).
It consists of a core library in Python and a CLI tool.
## Installation
To install this project, use pip or pipx:
```bash
pip install 2fas
# or:
pipx install 2fas
```
## Usage
To see all available options, you can run:
```bash
2fas --help
```
If you simply run `2fas` or `2fas /path/to/file.2fas`, an interactive menu will show up.
If you only want a specific TOTP code, you can run `2fas ` or `2fas /path/to/file.2fas `.
Multiple services can be specified: `2fas [/path/to/file.2fas]`.
Fuzzy matching is applied to (hopefully) catch some typo's.
You can run `2fas --all` to generate codes for all TOTP in your `.2fas` file.
### Settings
```bash
# see all settings:
2fas --settings # shortcut: -s
# see a specific setting:
2fas --setting key
# update a setting:
2fas --setting key value
```
The `--settings`, `--setting` or `-s` flag can be used to read/write settings.
This can also be done from within the interactive menu.
`2fas` cli settings are stored in `~/.config/2fas.toml` and contains the following settings:
```toml
[tool.2fas]
files = [
"/some/path/to/file.2fas",
... # list of known files, used by 'set default file' in the settings menu
]
default_file = "/some/path/to/file.2fas" # which file to use when no .2fas file was explicitly passed?
auto_verbose = true # run every command as if --verbose was passed?
```
### As a Library
Please see the documentation of [lib2fas-python](https://github.com/robinvandernoord/lib2fas-python) for more details on
using this as a Python library.
## License
This project is licensed under the MIT License.