GithubHelp home page GithubHelp logo

geoffodonnell / powershell-otpauth-module Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 54 KB

One Time Password Authentication Tools for PowerShell

License: MIT License

C# 83.73% PowerShell 16.27%
2fa authenticator google otp powershell

powershell-otpauth-module's Introduction

powershell-otpauth-module

CI/CD PSGallery version

Overview

This module provides command line access to OTP codes managed by Google Authenticator (or other applications). Users can exports credentials via QR codes, import credentials using these images, and generate OTP codes in a PowerShell terminal window.

Installation

This module is published to PSGallery, therefore it can be installed with the following command:

PS> Install-Module -Name OtpAuth -Verbose

Note, after installing the module call Import-Module to load it into the current session.

Beta Releases

Beta releases are published to the GitHub Packages Registry:

Getting Started

Setting up the credential store

This module can be configured to manage credentials. Credentials are persisted in the credential store, which stores data in a KeePass database using pt.KeePassLibStd. To setup the credential store, call Initialize-OtpAuthCredentialStore and enter and confirm a password. In subsequent sessions, use Open-OtpAuthCredentialStore to make the credentials accessible.

PS C:\Users\admin> Initialize-OtpAuthCredentialStore
Set password for the new credential store.
Enter password: ********
Confirm password: ********

Created credential store: 'C:\Users\admin\AppData\Local\.otpauth\credentials.kdbx'

It is not neccessary to use the credential store to obtain a credential object for generating OTP codes.

Usage Examples

Importing credentials

Credentials can be imported from QR Code image exports from Google Authenticator (and others).

PS C:\Users\admin> Import-OtpAuthCredential -Path ".\test.png"

Id        : 31987bd3-3941-4719-b984-8e26003e90e5
Name      : user@example.com
Secret    : KeePassLib.Security.ProtectedString
Issuer    : Example
Algorithm : SHA1
Digits    : Six
Type      : TOTP
Counter   : 0
Created   : 3/21/2024 7:07:20 PM +00:00
Updated   : 3/21/2024 7:07:20 PM +00:00

The above command returns one or multiple credential objects.

Storing credentials in the credential store

Once the credential store has been initialized and opened, credentials can be directly imported from QR Code images.

PS C:\Users\admin> Import-OtpAuthCredential -Path ".\test.png" | Save-OtpAuthCredential

Generating OTP code

Once the credential store has been initialized and opened, credentials can be retrieved and used to generate OTP codes.

PS C:\Users\admin> Get-OtpAuthCredential -Issuer "Example" | Get-OtpAuthCode
894034

Build

Prerequisites

  • .NET 8 SDK
  • PowerShell 7.4

Local

Clone this repository and execute build-and-load.ps1 in a PowerShell window to build the module and import it into the current session. By default, when building locally the module is named OtpAuth.Local.

Pipelines

powershell-outauth-module build pipelines use GitHub Actions workflows.

License

powershell-outauth-module is licensed under a MIT license except for the exceptions listed below. See the LICENSE file for details.

Exceptions

None.

Disclaimer

Nothing in the repository constitutes professional and/or financial advice. Use this module at your own risk.

powershell-otpauth-module's People

Contributors

geoffodonnell avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.