anonymous No title
No License Python
2020年09月29日
Copy
import sys, re, uuid, py_compile, os, shutil
uuid = str(uuid.uuid4())
UUID = uuid.replace('-', '').upper()
path = str(os.getcwd())
pos = path.find('/Documents')
infopath = path[:pos]
L = list(re.search('AppGroup/[A-Z0-9\\-]+/', path).group().replace('/', '').replace('AppGroup', '').replace('-', ''))
L.extend(UUID)
code = ''.join(L) + str(len(L))
path = re.search('AppGroup/[A-Z0-9\\-]+/', path).group().replace('/', '').replace('AppGroup', '').replace('-', '')

def create_code():
    if os.path.exists('info.pyc'):
        print('不正しようとしてますね?')
        sys.exit()
    print('起動しました、設定を開始します。')
    with open('info.py', mode='w') as (file):
        text = "code = '{}'\npath = '{}'\nuuid = '{}'\npermission = 'ok'".format(code, path, UUID)
        file.write(text)
    Path = os.getcwd()
    py_compile.compile('info.py')
    os.remove('info.py')
    shutil.move('__pycache__/info.cpython-36.pyc', Path)
    os.rmdir('__pycache__')
    os.rename('info.cpython-36.pyc', 'info.pyc')
    shutil.move('info.pyc', infopath)
    os.remove('createCode.pyc')
    sys.exit()
import sys, re, uuid, py_compile, os, shutil
uuid = str(uuid.uuid4())
UUID = uuid.replace('-', '').upper()
path = str(os.getcwd())
pos = path.find('/Documents')
infopath = path[:pos]
L = list(re.search('AppGroup/[A-Z0-9\\-]+/', path).group().replace('/', '').replace('AppGroup', '').replace('-', ''))
L.extend(UUID)
code = ''.join(L) + str(len(L))
path = re.search('AppGroup/[A-Z0-9\\-]+/', path).group().replace('/', '').replace('AppGroup', '').replace('-', '')

def create_code():
    if os.path.exists('info.pyc'):
        print('不正しようとしてますね?')
        sys.exit()
    print('起動しました、設定を開始します。')
    with open('info.py', mode='w') as (file):
        text = "code = '{}'\npath = '{}'\nuuid = '{}'\npermission = 'ok'".format(code, path, UUID)
        file.write(text)
    Path = os.getcwd()
    py_compile.compile('info.py')
    os.remove('info.py')
    shutil.move('__pycache__/info.cpython-36.pyc', Path)
    os.rmdir('__pycache__')
    os.rename('info.cpython-36.pyc', 'info.pyc')
    shutil.move('info.pyc', infopath)
    os.remove('createCode.pyc')
    sys.exit()

Output

Run
No one still commented. Please first comment.