<s> import subprocess <EOL> import re <EOL> import json <EOL> import os <EOL> import config <EOL> import shutil <EOL> import random , string <EOL> import HTMLParser <EOL> import fcntl , termios , struct <EOL> from Crypto . Cipher import AES <EOL> import base64 <EOL> def get_terminal_size ( fd = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> hw = struct . unpack ( '<STR_LIT>' , fcntl . ioctl ( fd , termios . TIOCGWINSZ , '<STR_LIT>' ) ) <EOL> except Exception : <EOL> try : <EOL> hw = ( os . environ [ '<STR_LIT>' ] , os . environ [ '<STR_LIT>' ] ) <EOL> except Exception : <EOL> hw = ( <NUM_LIT> , <NUM_LIT> ) <EOL> return hw <EOL> def random_str ( length ) : <EOL> return '<STR_LIT>' . join ( random . choice ( string . lowercase ) for i in range ( length ) ) <EOL> def get_line ( s ) : <EOL> """<STR_LIT>""" <EOL> return str ( s ) * <NUM_LIT> <EOL> def create_dir ( dir_name ) : <EOL> """<STR_LIT>""" <EOL> if dir_name : <EOL> if not os . path . isdir ( dir_name ) : <EOL> os . makedirs ( dir_name ) <EOL> def decode_html ( s ) : <EOL> return HTMLParser . HTMLParser ( ) . unescape ( s ) <EOL> def ljust ( s , n , fillchar = '<STR_LIT:U+0020>' ) : <EOL> """<STR_LIT>""" <EOL> no_ascii_list = re . findall ( r'<STR_LIT>' , s ) <EOL> ln = len ( '<STR_LIT>' . join ( no_ascii_list ) ) <EOL> return s . ljust ( n - ln , fillchar ) <EOL> def rjust ( s , n , fillchar = '<STR_LIT:U+0020>' ) : <EOL> no_ascii_list = re . findall ( r'<STR_LIT>' , s ) <EOL> ln = len ( '<STR_LIT>' . join ( no_ascii_list ) ) <EOL> return s . rjust ( n - ln , fillchar ) <EOL> def rsa_encrypt ( text , pubKey , modulus ) : <EOL> text = text [ : : - <NUM_LIT:1> ] <EOL> rs = int ( text . encode ( '<STR_LIT>' ) , <NUM_LIT:16> ) ** int ( pubKey , <NUM_LIT:16> ) % int ( modulus , <NUM_LIT:16> ) <EOL> return format ( rs , '<STR_LIT:x>' ) . zfill ( <NUM_LIT> ) <EOL> def aes_encrypt ( text , secKey ) : <EOL> pad = <NUM_LIT:16> - len ( text ) % <NUM_LIT:16> <EOL> text = text + pad * chr ( pad ) <EOL> encryptor = AES . new ( secKey , <NUM_LIT:2> , '<STR_LIT>' ) <EOL> ciphertext = encryptor . encrypt ( text ) <EOL> ciphertext = base64 . b64encode ( ciphertext ) <EOL> return ciphertext </s>
