Skip to main content

Battle.net Authenticator routines in Python.

Project description

Using the command-line tool

bna is a command line interface to the python-bna library. It can store and manage multiple authenticators, as well as create new ones.

Two things to remember:
  • Using an authenticator on the same computer as the one you’re playing on is not secure.

  • It is impossible (without knowing the secret) to import an existing authenticator

Configuration is stored in ~/.config/bna/bna.conf. You can pass a different config directory with –config=~/.bna.conf for example.

Creating a new authenticator

$ bna --new

If you do not already have an authenticator, it will be set as default. You can pass –set-default otherwise.

Getting an authentication token

$ bna
01234567
$ bna EU-1234-1234-1234
76543210

Getting a serial’s restore code

$ bna --restore-code
Z45Q9CVXRR
$ bna --restore EU-1234-1234-1234 ABCDE98765
Restored serial EU-1234-1234-1234

Using the python-bna library

Requesting a new authenticator

import bna
try:
        # region is EU or US
        # note that EU authenticators are valid in the US, and vice versa
        serial, secret = bna.request_new_serial("US")
except bna.HTTPError as e:
        print("Could not connect:", e)

Getting a token

# Get and print a token
token, time_remaining = bna.get_token(secret=secret)
print(token)

# print a new token every time the previous one expires
from time import sleep
while True:
        token, time_remaining = bna.get_token(secret=secret)
        print(token)
        sleep(time_remaining)

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

bna-4.0.1.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file bna-4.0.1.tar.gz.

File metadata

  • Download URL: bna-4.0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bna-4.0.1.tar.gz
Algorithm Hash digest
SHA256 92404ac5856242a75df8dff69c0d122f6cb5c59cd7e545fba1a58e44fbd4831e
MD5 eeb27c259599d98e71e8f268577eb7a6
BLAKE2b-256 bb5575b5d3d84d95f8e4737b6b2094a2d5dedceaf115450599fd30e86174ab21

See more details on using hashes here.

Supported by

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