Skip to main content

Unofficial implementation of 2fas for Python (as a CLI tool)

Project description

2fas Python

2fas-python is an unofficial implementation of 2FAS - the Internet’s favorite open-source two-factor authenticator. It consists of a core library in Python and a CLI tool.

Installation

To install this project, use pip or pipx:

pip install 2fas
# or:
pipx install 2fas

Usage

To see all available options, you can run:

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 <service> or 2fas /path/to/file.2fas <service>. Multiple services can be specified: 2fas <service1> <service2> [/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

# 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:

[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 for more details on using this as a Python library.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

2fas-1.1.1.tar.gz (64.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

2fas-1.1.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file 2fas-1.1.1.tar.gz.

File metadata

  • Download URL: 2fas-1.1.1.tar.gz
  • Upload date:
  • Size: 64.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for 2fas-1.1.1.tar.gz
Algorithm Hash digest
SHA256 c779642c2339a4199c1da394a23c15de82edcfaebdf49ffccd75bfefc979ac83
MD5 59f3eda44fc77cab04ba7cc4741ead89
BLAKE2b-256 127df69d4cf5e3087449cc2eb6f02f6f91ae47bc421a32e0eb9f55729df31161

See more details on using hashes here.

File details

Details for the file 2fas-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: 2fas-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for 2fas-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3771262d6530716b56682c7d6e53ebbbd429650581967be1e918fe47a7c2dc94
MD5 475208ff212d860e31d3570447b3faf0
BLAKE2b-256 ace929305ef07a8bc385a01f9eaf27a622bff512282a29ce1e04f579ab36f417

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page