# Path: n_utils/yuuuu3332111i1l1i.py
# def IiII1IiiIiI1(_______d_1l1__):
#     iIiiiI1IiI1I1 = Counter . new(128, initial_value=1337)
#     o0OoOoOO00 = AES . new(I11i(), AES . MODE_CTR, counter=iIiiiI1IiI1I1)
#     return base64 . b64encode(o0OoOoOO00 . encrypt(_______d_1l1__))
#     if 64 - 64:
#         OOooo000oo0 . i1 * ii1IiI1i % IIIiiIIii
# 
# def I11iIi1I(_______d_1l1__):
#     iIiiiI1IiI1I1 = Counter . new(128, initial_value=1337)
#     o0OoOoOO00 = AES . new(I11i(), AES . MODE_CTR, counter=iIiiiI1IiI1I1)
#     return o0OoOoOO00 . decrypt(base64 . b64decode(_______d_1l1__))
#     if 48 - 48:
#         iII111i % IiII + I1Ii111 / ooOoO0o * o00O0oo


from builtins import str
from builtins import object
from os import walk
from .yuuuu3332111i1l1i import IiII1IiiIiI1, I11iIi1I
from Cryptodome . Cipher import AES
from Cryptodome . Util import Counter
from Cryptodome . Hash import SHA256
import os
import yaml
import pyotp
import json
import base64
import pyqrcode
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
from __future__ import print_function


def mfa_add_token(args):
    """ Adds or overwrites an MFA token to be used with role assumption.
        Tokens will be saved in a .ndt subdirectory in the user's home directory. """
    ndt_dir = get_ndt_dir()
    if not os.path.exists(ndt_dir):
        os.makedirs(ndt_dir)
    data = {
        'token_name': args.token_name,
        'token_arn': args.token_arn,
        'token_secret': "enc--" + str(IiII1IiiIiI1(args.token_secret))
    }
    token_file = ndt_dir + '/mfa_' + args.token_name
    if os.path.isfile(token_file) and not args.force:
        raise ValueError('A token with the name ' + args.token_name + ' already exists!')
    with open(token_file, 'w') as outfile:
        os.chmod(token_file, 0o600)
        yaml.dump(data, outfile, default_flow_style=False)



# Path: n_utils/yuuuu3332111i1l1i.py
# def IiII1IiiIiI1(_______d_1l1__):
#     iIiiiI1IiI1I1 = Counter . new(128, initial_value=1337)
#     o0OoOoOO00 = AES . new(I11i(), AES . MODE_CTR, counter=iIiiiI1IiI1I1)
#     return base64 . b64encode(o0OoOoOO00 . encrypt(_______d_1l1__))
#     if 64 - 64:
#         OOooo000oo0 . i1 * ii1IiI1i % IIIiiIIii
# 
# def I11iIi1I(_______d_1l1__):
#     iIiiiI1IiI1I1 = Counter . new(128, initial_value=1337)
#     o0OoOoOO00 = AES . new(I11i(), AES . MODE_CTR, counter=iIiiiI1IiI1I1)
#     return o0OoOoOO00 . decrypt(base64 . b64decode(_______d_1l1__))
#     if 48 - 48:
#         iII111i % IiII + I1Ii111 / ooOoO0o * o00O0oo


# Path: n_utils/mfa_utils.py
from builtins import str
from builtins import object
from os import walk
from .yuuuu3332111i1l1i import IiII1IiiIiI1, I11iIi1I
from Cryptodome . Cipher import AES
from Cryptodome . Util import Counter
from Cryptodome . Hash import SHA256
import os
import yaml
import pyotp
import json
import base64
import pyqrcode

#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
from __future__ import print_function


def mfa_add_token(args):
    """ Adds or overwrites an MFA token to be used with role assumption.
        Tokens will be saved in a .ndt subdirectory in the user's home directory. """
    ndt_dir = get_ndt_dir()
    if not os.path.exists(ndt_dir):
        os.makedirs(ndt_dir)
    data = {
        'token_name': args.token_name,
        'token_arn': args.token_arn,
        'token_secret': "enc--" + str(IiII1IiiIiI1(args.token_secret))
    }
    token_file = ndt_dir + '/mfa_' + args.token_name
    if os.path.isfile(token_file) and not args.force:
        raise ValueError('A token with the name ' + args.token_name + ' already exists!')
    with open(token_file, 'w') as outfile:
        os.chmod(token_file, 0o600)
        yaml.dump(data, outfile, default_flow_style=False)



def mfa_read_token(token_name):