Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Vlad Glagolev (38fc7c9a1b0ed9a8a1550a3946c584b2215e85b3)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Vlad Glagolev <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Vlad Glagolev (38fc7c9a1b0ed9a8a1550a3946c584b2215e85b3)
  • Date: Thu, 27 Jul 2017 14:52:15 +0000

GIT changes to master grimoire by Vlad Glagolev <stealth AT sourcemage.org>:

ChangeLog | 2
python-pypi/bna/DEPENDS | 1
python-pypi/bna/DETAILS | 21 ++++++
python-pypi/bna/HISTORY | 2
python-pypi/bna/PRE_BUILD | 6 +
python-pypi/bna/python2.patch | 132
++++++++++++++++++++++++++++++++++++++++++
6 files changed, 164 insertions(+)

New commits:
commit 38fc7c9a1b0ed9a8a1550a3946c584b2215e85b3
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

bna: new spell, Battle.net Authenticator routines in Python

diff --git a/ChangeLog b/ChangeLog
index be4496e..029c86c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2017-07-27 Vlad Glagolev <stealth AT sourcemage.org>
* python-pypi/pyotp: new spell, Python One-Time Password library
+ * python-pypi/bna: new spell, Battle.net Authenticator routines in
+ Python

2017-07-24 Treeve Jelbert <treeve AT sourcemage.org>
* disk/libbytesize: added
diff --git a/python-pypi/bna/DEPENDS b/python-pypi/bna/DEPENDS
new file mode 100755
index 0000000..6de4242
--- /dev/null
+++ b/python-pypi/bna/DEPENDS
@@ -0,0 +1 @@
+. "${SECTION_DIRECTORY}/PY_DEPENDS"
diff --git a/python-pypi/bna/DETAILS b/python-pypi/bna/DETAILS
new file mode 100755
index 0000000..8bbf6aa
--- /dev/null
+++ b/python-pypi/bna/DETAILS
@@ -0,0 +1,21 @@
+ SPELL=bna
+ VERSION=4.1.0
+ SOURCE="${SPELL}-${VERSION}.tar.gz"
+ SOURCE_URL[0]=https://pypi.org/packages/source/b/${SPELL}/${SOURCE}
+
SOURCE_HASH=sha512:31f56c56d63631548e171b9e5c6fba3b0289e683d9196b9cdd1ec0d7a7b0a21e014c91f1d421c7f6e61c3957991442aa276ffec948dcaf7cb7f9451ed33bf4d6
+SOURCE_DIRECTORY="${BUILD_DIRECTORY}/${SPELL}-${VERSION}"
+ WEB_SITE=https://github.com/jleclanche/python-bna
+ LICENSE[0]=MIT
+ ENTERED=20170727
+ KEYWORDS="otp totp auth battle.net"
+ SHORT="Battle.net Authenticator routines in Python"
+cat << EOF
+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
+EOF
diff --git a/python-pypi/bna/HISTORY b/python-pypi/bna/HISTORY
new file mode 100644
index 0000000..1fe46ed
--- /dev/null
+++ b/python-pypi/bna/HISTORY
@@ -0,0 +1,2 @@
+2017-07-27 Vlad Glagolev <stealth AT sourcemage.org>
+ * DEPENDS, DETAILS, PRE_BUILD, python2.patch: created spell, version
4.1.0
diff --git a/python-pypi/bna/PRE_BUILD b/python-pypi/bna/PRE_BUILD
new file mode 100755
index 0000000..a5d52c2
--- /dev/null
+++ b/python-pypi/bna/PRE_BUILD
@@ -0,0 +1,6 @@
+default_pre_build &&
+cd "${SOURCE_DIRECTORY}" &&
+
+if is_depends_enabled ${SPELL} python; then
+ patch -p0 < "${SPELL_DIRECTORY}/python2.patch"
+fi
diff --git a/python-pypi/bna/python2.patch b/python-pypi/bna/python2.patch
new file mode 100644
index 0000000..9e74f9d
--- /dev/null
+++ b/python-pypi/bna/python2.patch
@@ -0,0 +1,132 @@
+--- bin/bna.orig
++++ bin/bna
+@@ -4,7 +4,7 @@
+ import sys
+ from argparse import ArgumentParser
+ from binascii import hexlify, unhexlify
+-from configparser import ConfigParser
++from ConfigParser import ConfigParser
+ sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),
os.path.pardir))
+ import bna
+
+@@ -100,7 +100,7 @@
+ sys.stderr.write("Error: %s\n" % (msg))
+ exit(1)
+
+- def print(self, msg):
++ def printm(self, msg):
+ print(msg)
+
+ def add_serial(self, serial, secret):
+@@ -122,7 +122,7 @@
+ self.config.remove_option("bna", "default_serial")
+
+ self.writeConfig()
+- self.print("Successfully deleted serial %s" %
(bna.prettify_serial(serial)))
++ self.printm("Successfully deleted serial %s" %
(bna.prettify_serial(serial)))
+
+ def restore_serial(self, serial, code):
+ serial = bna.normalize_serial(serial)
+@@ -131,19 +131,19 @@
+
+ secret = bna.restore(serial, code)
+ self.add_serial(serial, hexlify(secret).decode("ascii"))
+- self.print("Restored serial %s" %
(bna.prettify_serial(serial)))
++ self.printm("Restored serial %s" %
(bna.prettify_serial(serial)))
+
+ def list_serials(self):
+ default = self.get_default_serial()
+ total = 0
+ for serial in self._serials():
+ if serial == default:
+- self.print("%s (default)" % (serial))
++ self.printm("%s (default)" % (serial))
+ else:
+- self.print(serial)
++ self.printm(serial)
+ total += 1
+
+- self.print("%i items" % (total))
++ self.printm("%i items" % (total))
+
+ def query_new_authenticator(self):
+ try:
+@@ -156,11 +156,11 @@
+
+ self.add_serial(serial, secret)
+
+- self.print("Success. Your new serial is: %s" %
(bna.prettify_serial(serial)))
++ self.printm("Success. Your new serial is: %s" %
(bna.prettify_serial(serial)))
+
+ def run_live(self):
+ from time import sleep
+- self.print("Ctrl-C to exit")
++ self.printm("Ctrl-C to exit")
+ while 1:
+ token, time_remaining =
bna.get_token(secret=self._secret)
+ if self.args.remaining:
+@@ -273,12 +273,12 @@
+ # Print the restore code if the user asked for it
+ if self.args.restorecode:
+ code = bna.get_restore_code(serial, self._secret)
+- self.print(code)
++ self.printm(code)
+ return 0
+
+ if self.args.otpauth_url:
+ url = bna.get_otpauth_url(serial, self._secret)
+- self.print(url)
++ self.printm(url)
+ return 0
+
+ # otherwise print the token
+@@ -287,9 +287,9 @@
+ else:
+ token, time_remaining =
bna.get_token(secret=self._secret)
+ if self.args.remaining:
+- self.print("%08i (%02is remaining)" % (token,
time_remaining))
++ self.printm("%08i (%02is remaining)" %
(token, time_remaining))
+ else:
+- self.print("%08i" % (token))
++ self.printm("%08i" % (token))
+
+ return 0
+
+--- bna.py.orig
++++ bna.py
+@@ -12,7 +12,7 @@
+
+ from binascii import hexlify
+ from hashlib import sha1
+-from http.client import HTTPConnection
++from httplib import HTTPConnection
+ from struct import pack, unpack
+ from time import time
+
+@@ -88,7 +88,7 @@
+ def decrypt(response, otp):
+ ret = bytearray()
+ for c, e in zip(response, otp):
+- ret.append(c ^ e)
++ ret.append(ord(c) ^ ord(e))
+ return ret
+
+
+@@ -124,7 +124,7 @@
+ def bytes_to_restore_code(digest):
+ ret = []
+ for i in digest:
+- c = i & 0x1f
++ c = ord(i) & 0x1f
+ if c < 10:
+ c += 48
+ else:
+@@ -160,7 +160,7 @@
+ msg = pack(">Q", int(t / seconds))
+ r = hmac.new(secret, msg, sha1).digest()
+ k = r[19]
+- idx = k & 0x0f
++ idx = ord(k) & 0x0f
+ h = unpack(">L", r[idx:idx + 4])[0] & 0x7fffffff
+ return h % (10 ** digits), -(t % seconds - seconds)
+



  • [SM-Commit] GIT changes to master grimoire by Vlad Glagolev (38fc7c9a1b0ed9a8a1550a3946c584b2215e85b3), Vlad Glagolev, 07/27/2017

Archive powered by MHonArc 2.6.24.

Top of Page