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 creating new authenticator #13

Closed Dreiundachzig closed 7 years ago

Dreiundachzig commented 7 years ago

When I try to create a new authenticator I get the following error

Traceback (most recent call last):
  File "/usr/local/bin/bna", line 235, in <module>
    main()
  File "/usr/local/bin/bna", line 232, in main
    authenticator = Authenticator(sys.argv[1:])
  File "/usr/local/bin/bna", line 39, in __init__
    self.queryNewAuthenticator(args)
  File "/usr/local/bin/bna", line 145, in queryNewAuthenticator
    serial, secret = bna.requestNewSerial(self.args.region)
  File "/usr/local/lib/python2.7/dist-packages/bna.py", line 102, in requestNewSerial
    response = decrypt(enroll(e, host)[8:], otp)
  File "/usr/local/lib/python2.7/dist-packages/bna.py", line 64, in enroll
    return getServerResponse(data, host, path)
  File "/usr/local/lib/python2.7/dist-packages/bna.py", line 53, in getServerResponse
    conn.request("POST", path, data)
  File "/usr/lib/python2.7/httplib.py", line 1039, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1073, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1035, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 879, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 841, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 822, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
socket.error: [Errno 111] Connection refused
jleclanche commented 7 years ago

You appear to be using Python 2.7. That might be the issue. bna is only compatible with 3.3+.

Another issue might be a temporary connection error with the Battle.net servers.

Dreiundachzig commented 7 years ago

Thanks, using version 3.4 the script worked. Unfortunately the generated qr code does not work with Authy. It took me some time to figure out where the problem was. With another generator I managed to add it to Authy. Thanks for your script

jleclanche commented 7 years ago

Really? Interesting. I'll see if it works with FreeOTP; if it does, it's an Authy issue.