diff --git a/duo_activate.py b/duo_activate.py index 48dbf5b..6d2ed44 100755 --- a/duo_activate.py +++ b/duo_activate.py @@ -1,14 +1,14 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 import pyotp import requests import base64 import json import sys -from urllib2 import unquote if len(sys.argv) < 2: - print "Usage: python duo_bypass.py "; exit() + print("Usage: python duo_bypass.py ") + sys.exit() qr_url = sys.argv[1] @@ -38,16 +38,16 @@ response = json.loads(r.text) try: secret = base64.b32encode(response['response']['hotp_secret']) except KeyError: - print response + print(response) sys.exit(1) -print "secret", secret +print("secret", secret) -print "10 Next OneTime Passwords!" +print("10 Next OneTime Passwords!") # Generate 10 Otps! hotp = pyotp.HOTP(secret) for _ in xrange(10): - print hotp.at(_) + print(hotp.at(_)) f = open('duotoken.hotp', 'w') f.write(secret + "\n") diff --git a/duo_gen.py b/duo_gen.py index 49c185c..d4da768 100755 --- a/duo_gen.py +++ b/duo_gen.py @@ -1,11 +1,7 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 import pyotp -import requests -import base64 -import json import sys -from urllib2 import unquote if len(sys.argv) == 2: file = sys.argv[1] @@ -17,11 +13,11 @@ secret = f.readline()[0:-1] offset = f.tell() count = int(f.readline()) -print "secret", secret -print "count", count +print("secret", secret) +print("count", count) hotp = pyotp.HOTP(secret) -print "Code:", hotp.at(count) +print("Code:", hotp.at(count)) f.seek(offset) f.write(str(count + 1))