<jupyter_start><jupyter_text>Get public key and compressing with 7z  Generate password<jupyter_code>password = '';
dau = ['.', '^', '&', '$', '#', '@', ',', '`']
for i in range(31):
    tmp = random.randint(1, 2)
    if (tmp == 1):
        password += random.choice(string.ascii_letters)
    elif (tmp == 2):
        password += str(random.randint(0, 9))
    else:
        password += dau[random.randint(0, len(dau) - 1)]      
        
password<jupyter_output><empty_output><jupyter_text>Compress with password<jupyter_code>check_path = "C:/Users/Admin/Desktop/Contain/"
ZIPPATH = "C:/Program Files/7-Zip/"
ZIPFILE = check_path + "client_1.zip"
FILETOZIP = check_path + "client_1.csv"

batchfile_data = f'''@ECHO OFF
set PATH=%PATH%;{ZIPPATH}
7z a {ZIPFILE} {FILETOZIP} -p{password}'''
batchfile = open(check_path + 'compress.bat', 'w')
batchfile.write(batchfile_data)
batchfile.close()
os.system(check_path + 'compress.bat')<jupyter_output><empty_output><jupyter_text>Encrypt password<jupyter_code>HOSTPATH=r'\\172.16.58.3\marknice\\'
PASSWORDFILENAME='password_1.txt'

with open(HOSTPATH + '\public_key.key') as public_key_file:
    public_key = public_key_file.read()
public_key = rsa.PublicKey.load_pkcs1(public_key, 'PEM')
encrypted_message = rsa.encrypt(str.encode(password), public_key)
encrypted_file = open(check_path+f'{PASSWORDFILENAME}', 'wb')
encrypted_file.write(encrypted_message)
encrypted_file.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16494133885438234, 'fraction_numerical': 0.01725327812284334, 'mean_word_length': 5.5610859728506785, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '141378', 'license': 'MIT', 'n_tokens_mistral': 573, 'n_tokens_neox': 548, 'n_words': 84, 'path': 'client/Client_MarkNice_Stage_2.ipynb', 'repo_name': 'nprm1243/-n-THNMCNTT-', 'size': '1451'}