jleclanche / python-bna

Python implementation of the mobile Blizzard Authenticator (TOTP)
https://eu.battle.net/support/en/article/24520
MIT License
250 stars 38 forks source link

Error when executing "bna" #1

Closed nozatabul closed 12 years ago

nozatabul commented 12 years ago

I'm using python 2.6.5 on ubuntu 10.04

Executing the following bna -n && bna with an empty config file gives the following error:

Traceback (most recent call last):
  File "/usr/local/bin/bna", line 217, in <module>
    main()
  File "/usr/local/bin/bna", line 214, in main
    authenticator = Authenticator(sys.argv[1:])
  File "/usr/local/bin/bna", line 68, in __init__
    self._secret = unhexlify(self._secret)
TypeError: a2b_hex() argument 1 must be string or read-only buffer, not bytearray

Making the following change at line 65:

seems to fix the issue.

jleclanche commented 12 years ago

Im not seeing this with python2.7:

% python2.7 /home/adys/bin/bna -n && python2.7 /home/adys/bin/bna   
Success. Your new serial is: US-1207-2748-3777
22934181

The fix breaks on python3, so I added a check for python < 2.7 for it. Thank you.