예제 #1
0
'''Used to lock down sensitive information before pushing to github'''

from KeyLoader import KeyLoader
import os, json

keyloader = KeyLoader()
password = input('Please enter a password:  '******'data/unlocked') if '.json' in f]

for f in unlocked_files:
    unlocked_data = json.load(open('data/unlocked/' + f, 'r'))
    locked_data = keyloader.lock_with_password(
        password,
        json.dumps(unlocked_data).encode('utf-8'))

    with open('data/locked/{0}'.format(f), 'wb') as f_out:
        f_out.write(locked_data)

    os.remove('data/unlocked/' + f)
    print('{0} locked and deleted'.format(f))
예제 #2
0
'''Used to unlock sensitive information after pulling from github'''

from KeyLoader import KeyLoader
from collections import OrderedDict
import os, json

keyloader = KeyLoader()
password = input('Please enter your password:  '******'data/locked') if '.json' in f]
unlocked_files = [f for f in os.listdir('data/unlocked') if '.json' in f]

for f in locked_files:
    if f in unlocked_files:
        contin = input('Conflict in {0}, do you wish to overwrite? (Y/n)  '.format(f))
        if (contin == 'n' or contin == 'N'):
            continue

    print('Writing {0}'.format(f))
    with open('data/locked/' + f,'rb') as infile:
        full_data = infile.read()

    unlocked_data = keyloader.unlock_with_password(password, full_data)
    with open('data/unlocked/' + f,'w') as f_out:
        ordered = OrderedDict(sorted(unlocked_data.items(), key=lambda t: t[0]))
        json.dump(ordered, f_out)
예제 #3
0
'''Used to unlock sensitive information after pulling from github'''

from KeyLoader import KeyLoader
from collections import OrderedDict
import os, json

keyloader = KeyLoader()
password = input('Please enter your password:  '******'data/locked') if '.json' in f]
unlocked_files = [f for f in os.listdir('data/unlocked') if '.json' in f]

for f in locked_files:
    if f in unlocked_files:
        contin = input(
            'Conflict in {0}, do you wish to overwrite? (Y/n)  '.format(f))
        if (contin == 'n' or contin == 'N'):
            continue

    print('Writing {0}'.format(f))
    with open('data/locked/' + f, 'rb') as infile:
        full_data = infile.read()

    unlocked_data = keyloader.unlock_with_password(password, full_data)
    with open('data/unlocked/' + f, 'w') as f_out:
        ordered = OrderedDict(sorted(unlocked_data.items(),
                                     key=lambda t: t[0]))
        json.dump(ordered, f_out)
예제 #4
0
'''Used to lock down sensitive information before pushing to github'''

from KeyLoader import KeyLoader
import os, json

keyloader = KeyLoader()
password = input('Please enter a password:  '******'data/unlocked') if '.json' in f]

for f in unlocked_files:
    unlocked_data = json.load(open('data/unlocked/' + f,'r'))
    locked_data = keyloader.lock_with_password(password, json.dumps(unlocked_data).encode('utf-8'))

    with open('data/locked/{0}'.format(f),'wb') as f_out:
    	f_out.write(locked_data)

    os.remove('data/unlocked/' + f)
    print('{0} locked and deleted'.format(f))