mirror of
https://github.com/os-mnemo/pan-globalprotect-okta
synced 2026-07-31 07:44:38 +02:00
Merge pull request #9 from supertylerc/fix-8/raw-input
Fix `raw_input` for py3
This commit is contained in:
+3
-2
@@ -34,6 +34,7 @@ if sys.version_info >= (3,):
|
|||||||
else:
|
else:
|
||||||
text_type = unicode
|
text_type = unicode
|
||||||
binary_type = str
|
binary_type = str
|
||||||
|
input = raw_input
|
||||||
|
|
||||||
to_b = lambda v: v if isinstance(v, binary_type) else v.encode('utf-8')
|
to_b = lambda v: v if isinstance(v, binary_type) else v.encode('utf-8')
|
||||||
to_u = lambda v: v if isinstance(v, text_type) else v.decode('utf-8')
|
to_u = lambda v: v if isinstance(v, text_type) else v.decode('utf-8')
|
||||||
@@ -116,7 +117,7 @@ def load_conf(cf):
|
|||||||
continue
|
continue
|
||||||
conf[k] = v.strip()
|
conf[k] = v.strip()
|
||||||
if len(conf.get('username', '').strip()) == 0:
|
if len(conf.get('username', '').strip()) == 0:
|
||||||
conf['username'] = raw_input('username: ').strip()
|
conf['username'] = input('username: ').strip()
|
||||||
if len(conf.get('password', '').strip()) == 0:
|
if len(conf.get('password', '').strip()) == 0:
|
||||||
conf['password'] = getpass.getpass('password: ').strip()
|
conf['password'] = getpass.getpass('password: ').strip()
|
||||||
for k in keys:
|
for k in keys:
|
||||||
@@ -244,7 +245,7 @@ def okta_mfa_totp(conf, s, factors, state_token):
|
|||||||
secret = conf.get('totp.{0}'.format(provider), '') or ''
|
secret = conf.get('totp.{0}'.format(provider), '') or ''
|
||||||
code = None
|
code = None
|
||||||
if len(secret) == 0:
|
if len(secret) == 0:
|
||||||
code = raw_input('{0} TOTP: '.format(provider)).strip()
|
code = input('{0} TOTP: '.format(provider)).strip()
|
||||||
else:
|
else:
|
||||||
import pyotp
|
import pyotp
|
||||||
totp = pyotp.TOTP(secret)
|
totp = pyotp.TOTP(secret)
|
||||||
|
|||||||
Reference in New Issue
Block a user