bugfix print function
This commit is contained in:
parent
14b5e9fab4
commit
5479c3eaa0
4
README
Normal file → Executable file
4
README
Normal file → Executable file
|
@ -20,7 +20,7 @@ Install on other distrib
|
|||
install pkg depends (look at archlinux PKGBUILD file wich provide usefull informations)
|
||||
|
||||
simply untar archive, then launch :
|
||||
$ python ./kirmah/kirmah.py
|
||||
$ python ./kirmah/kirmah-cli.py
|
||||
$ python3 ./kirmah/kirmah.py
|
||||
$ python3 ./kirmah/kirmah-cli.py
|
||||
|
||||
you can also use python disutils and setup.py
|
||||
|
|
21
kirmah/app.py
Normal file → Executable file
21
kirmah/app.py
Normal file → Executable file
|
@ -45,7 +45,7 @@ from psr.log import Log
|
|||
class KirmahApp:
|
||||
|
||||
@Log(Const.LOG_BUILD)
|
||||
def __init__(self, debug=True, color=True, loglvl=Const.LOG_DEFAULT):
|
||||
def __init__(self, debug=False, color=True, loglvl=Const.LOG_NEVER):
|
||||
""""""
|
||||
self.encmode = conf.DEFVAL_ENCMODE
|
||||
self.splitmode = False
|
||||
|
@ -71,10 +71,15 @@ class KirmahApp:
|
|||
""""""
|
||||
kpath = self.getDefaultKeyPath()
|
||||
if not Io.file_exists(kpath):
|
||||
if Sys.isUnix() :
|
||||
#if Sys.isUnix() :
|
||||
if not Sys.isdir(conf.DEFVAL_UKEY_PATH) :
|
||||
Sys.mkdir_p(conf.DEFVAL_UKEY_PATH)
|
||||
Io.set_data(kpath, KeyGen(conf.DEFVAL_UKEY_LENGHT).key)
|
||||
k = KeyGen(conf.DEFVAL_UKEY_LENGHT)
|
||||
print(k)
|
||||
content = k.key
|
||||
print('content')
|
||||
Io.set_data(kpath, content)
|
||||
print('set content')
|
||||
self.selectKey(kpath)
|
||||
|
||||
|
||||
|
@ -89,11 +94,15 @@ class KirmahApp:
|
|||
@Log(Const.LOG_DEBUG)
|
||||
def getKeyInfos(self, filename=None):
|
||||
""""""
|
||||
if filename is None : filename = self.getDefaultKeyPath()
|
||||
if filename is None : filename = self.getDefaultKeyPath()
|
||||
if not Io.file_exists(filename):
|
||||
raise FileNotFoundException(filename)
|
||||
print(filename)
|
||||
print('toto2')
|
||||
k = Io.get_data(filename)
|
||||
print('get data2')
|
||||
s = len(k)
|
||||
# print(s)
|
||||
m = KeyGen(s).getMark(k)
|
||||
return k, s, m
|
||||
|
||||
|
@ -101,6 +110,8 @@ class KirmahApp:
|
|||
@Log(Const.LOG_DEBUG)
|
||||
def selectKey(self, filename):
|
||||
""""""
|
||||
print('selectKey : ')
|
||||
print(filename)
|
||||
if not Io.file_exists(filename):
|
||||
raise FileNotFoundException(filename)
|
||||
self.kpath = filename
|
||||
|
@ -189,7 +200,7 @@ class KirmahApp:
|
|||
key = '-k'+q+self.kpath+q if self.kpath != self.getDefaultKeyPath() else ''
|
||||
#~ q = '"'
|
||||
call = ['kirmah-cli.py',debug, action,q+self.src+q,comp,mproc,rmode,mmode,'-o',q+self.dst+q,key]
|
||||
print('python '+(' '.join(call)))
|
||||
print('python3 '+(' '.join(call)))
|
||||
return call
|
||||
|
||||
|
||||
|
|
518
kirmah/cli.py
518
kirmah/cli.py
|
@ -136,97 +136,97 @@ class Cli(AbstractCli):
|
|||
""""""
|
||||
if not withoutHeader : Cli.print_header()
|
||||
|
||||
Sys.print(' USAGE :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '+Cli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('help ' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' USAGE :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '+Cli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('help ' , Sys.CLZ_HELP_CMD)
|
||||
|
||||
Sys.print(' '+Cli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('key ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('[ -l ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('length' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('outputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(']' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '+Cli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('key ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('[ -l ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('length' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('outputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(']' , Sys.CLZ_HELP_ARG)
|
||||
|
||||
Sys.print(' '+Cli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('enc ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('inputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('} ' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('[' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print(' -z|Z|a -r|R -m|M -j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('numProcess' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('keyFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('outputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(']' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '+Cli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('enc ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('inputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('} ' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('[' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo(' -z|Z|a -r|R -m|M -j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('numProcess' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('keyFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('outputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(']' , Sys.CLZ_HELP_ARG)
|
||||
|
||||
Sys.print(' '+conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('dec ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('inputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('} ' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('[' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print(' -j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('numProcess' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('keyFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('outputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(']' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '+conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('dec ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('inputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('} ' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('[' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo(' -j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('numProcess' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('keyFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('outputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(']' , Sys.CLZ_HELP_ARG)
|
||||
|
||||
Sys.print(' '+conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('split ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('inputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('} ' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('[' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print(' -p ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('numParts' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('keyFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('tarOutputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(']' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '+conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('split ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('inputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('} ' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('[' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo(' -p ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('numParts' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('keyFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('tarOutputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(']' , Sys.CLZ_HELP_ARG)
|
||||
|
||||
Sys.print(' '+conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('merge ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('inputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('} ' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('[' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('keyFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('outputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(']' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '+conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('merge ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('inputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('} ' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('[' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('keyFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('outputFile' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(']' , Sys.CLZ_HELP_ARG)
|
||||
|
||||
|
||||
@staticmethod
|
||||
|
@ -235,111 +235,111 @@ class Cli(AbstractCli):
|
|||
Sys.dprint('\n')
|
||||
Cli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
|
||||
Sys.print(' MAIN OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '*4+'-v'.ljust(13,' ')+', --version' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'display programm version' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-d'.ljust(13,' ')+', --debug' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'enable debug mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-f'.ljust(13,' ')+', --force' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'force rewriting existing files without alert' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-q'.ljust(13,' ')+', --quiet' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'don\'t print status messages to stdout' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-h'.ljust(13,' ')+', --help' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'display help' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' MAIN OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'-v'.ljust(13,' ')+', --version' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'display programm version' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-d'.ljust(13,' ')+', --debug' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'enable debug mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-f'.ljust(13,' ')+', --force' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'force rewriting existing files without alert' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-q'.ljust(13,' ')+', --quiet' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'don\'t print status messages to stdout' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-h'.ljust(13,' ')+', --help' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'display help' , Sys.CLZ_HELP_ARG_INFO)
|
||||
|
||||
Sys.dprint('\n')
|
||||
Sys.print(' KEY OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '*4+'-l ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('LENGTH'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --length'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('LENGTH'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'specified key length (128 to 4096 - default:1024)' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'specified key output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' KEY OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'-l ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('LENGTH'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --length'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('LENGTH'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'specified key length (128 to 4096 - default:1024)' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'specified key output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
|
||||
Sys.dprint('\n')
|
||||
Sys.print(' ENCRYPT OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '*4+'-a'.ljust(13,' ')+', --fullcompress' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'enable full compression mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-z'.ljust(13,' ')+', --compress' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'enable compression mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-Z'.ljust(13,' ')+', --nocompress' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'disable compression mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-r'.ljust(13,' ')+', --random' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'enable random mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-R'.ljust(13,' ')+', --norandom' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'disable random mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-m'.ljust(13,' ')+', --mix' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'enable mix mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-M'.ljust(13,' ')+', --nomix' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'disable mix mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --multiprocess'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'number of process for encryption (2 to 8)' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --keyfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'key filename used to encrypt' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'specified encrypted output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' ENCRYPT OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'-a'.ljust(13,' ')+', --fullcompress' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'enable full compression mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-z'.ljust(13,' ')+', --compress' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'enable compression mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-Z'.ljust(13,' ')+', --nocompress' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'disable compression mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-r'.ljust(13,' ')+', --random' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'enable random mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-R'.ljust(13,' ')+', --norandom' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'disable random mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-m'.ljust(13,' ')+', --mix' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'enable mix mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-M'.ljust(13,' ')+', --nomix' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'disable mix mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --multiprocess'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'number of process for encryption (2 to 8)' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --keyfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'key filename used to encrypt' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'specified encrypted output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
|
||||
Sys.dprint('\n')
|
||||
Sys.print(' DECRYPT OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '*4+'-j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --multiprocess'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'number of process for decryption (2 to 8)' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --keyfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'key filename used to decrypt' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'specified decrypted output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' DECRYPT OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'-j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --multiprocess'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'number of process for decryption (2 to 8)' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --keyfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'key filename used to decrypt' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'specified decrypted output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
|
||||
Sys.dprint('\n')
|
||||
Sys.print(' SPLIT OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '*4+'-p ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --part'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'count part to split' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --keyfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'key filename used to split' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('TARFILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('TARFILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'specified tar output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' SPLIT OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'-p ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --part'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('COUNT'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'count part to split' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --keyfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'key filename used to split' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('TARFILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('TARFILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'specified tar output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
|
||||
Sys.dprint('\n')
|
||||
Sys.print(' MERGE OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '*4+'-k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --keyfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'key filename used to merge' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'specified decrypted output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' MERGE OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'-k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --keyfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'key filename used to merge' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --outputfile'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('FILE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'specified decrypted output filename' , Sys.CLZ_HELP_ARG_INFO)
|
||||
|
||||
Sys.dprint('\n')
|
||||
|
||||
|
@ -348,114 +348,114 @@ class Cli(AbstractCli):
|
|||
def print_help():
|
||||
""""""
|
||||
Cli.print_header()
|
||||
Sys.print(Cli.conf.PRG_DESC, Sys.CLZ_HELP_DESC)
|
||||
Sys.echo(Cli.conf.PRG_DESC, Sys.CLZ_HELP_DESC)
|
||||
Cli.print_usage('',True)
|
||||
Cli.print_options()
|
||||
Cli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
Sys.dprint()
|
||||
Sys.print(' EXEMPLES :\n', Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' EXEMPLES :\n', Sys.CLZ_HELP_CMD)
|
||||
CHQ = "'"
|
||||
|
||||
Sys.print(' '*4+'command key :', Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'command key :', Sys.CLZ_HELP_CMD)
|
||||
|
||||
Sys.print(' '*8+'# generate a new crypted key of 2048 length', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('key -l ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('2048 ', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# generate a new crypted key of 2048 length', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('key -l ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('2048 ', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
Sys.print(' '*8+'# generate a new crypted key (default length is 1024) in a specified location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('key -o ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print(Cli.DIRKEY+'.myNewKey', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# generate a new crypted key (default length is 1024) in a specified location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('key -o ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo(Cli.DIRKEY+'.myNewKey', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
|
||||
Cli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
Sys.print('\n'+' '*4+'command encrypt :', Sys.CLZ_HELP_CMD)
|
||||
Sys.echo('\n'+' '*4+'command encrypt :', Sys.CLZ_HELP_CMD)
|
||||
|
||||
Sys.print(' '*8+'# encrypt specified file with default crypted key and default options', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('enc ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print(Cli.HOME+'mySecretTextFile.txt', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# encrypt specified file with default crypted key and default options', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('enc ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo(Cli.HOME+'mySecretTextFile.txt', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
Sys.print(' '*8+'# encrypt specified file with specified crypted key (full compression, no random but mix mode)', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+'# on specified output location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('enc ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('mySecretTextFile.txt', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -aRm -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print(Cli.DIRKEY+'.myNewKey', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('test.kmh', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# encrypt specified file with specified crypted key (full compression, no random but mix mode)', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+'# on specified output location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('enc ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('mySecretTextFile.txt', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -aRm -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo(Cli.DIRKEY+'.myNewKey', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('test.kmh', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
Sys.print(' '*8+'# encrypt specified file with default crypted key (no compression but random & mix mode and multiprocessing)', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('enc ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('myBigTextFile.txt', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -Zrm -j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('4', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# encrypt specified file with default crypted key (no compression but random & mix mode and multiprocessing)', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('enc ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('myBigTextFile.txt', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -Zrm -j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('4', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
|
||||
Cli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
Sys.print('\n'+' '*4+'command decrypt :', Sys.CLZ_HELP_CMD)
|
||||
Sys.echo('\n'+' '*4+'command decrypt :', Sys.CLZ_HELP_CMD)
|
||||
|
||||
Sys.print(' '*8+'# decrypt specified file with default crypted key', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('dec ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print(Cli.HOME+'mySecretFile.kmh', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# decrypt specified file with default crypted key', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('dec ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo(Cli.HOME+'mySecretFile.kmh', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
Sys.print(' '*8+'# decrypt specified file with specified crypted key on specified output location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+Cli.conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('dec ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('myEncryptedSecretFile.kmh', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print(Cli.HOME+'.kirmah'+Sys.sep+'.myNewKey', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('myDecryptedSecretFile.txt', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# decrypt specified file with specified crypted key on specified output location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+Cli.conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('dec ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('myEncryptedSecretFile.kmh', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo(Cli.HOME+'.kirmah'+Sys.sep+'.myNewKey', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('myDecryptedSecretFile.txt', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
Sys.print(' '*8+'# decrypt specified file with default crypted key and multiprocessing', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('dec ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('myEncryptedSecretFile.kmh', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('4' , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# decrypt specified file with default crypted key and multiprocessing', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('dec ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('myEncryptedSecretFile.kmh', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -j ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('4' , Sys.CLZ_HELP_PARAM)
|
||||
|
||||
|
||||
Cli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
Sys.print('\n'+' '*4+'command split :', Sys.CLZ_HELP_CMD)
|
||||
Sys.echo('\n'+' '*4+'command split :', Sys.CLZ_HELP_CMD)
|
||||
|
||||
Sys.print(' '*8+'# split specified file with default crypted key', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('split ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print(Cli.HOME+'myBigBinaryFile.avi', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# split specified file with default crypted key', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('split ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo(Cli.HOME+'myBigBinaryFile.avi', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
Sys.print(' '*8+'# split specified file on 55 parts with specified crypted key on specified output location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('split ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('myBigBinaryFile.avi', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -p ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('55' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print(Cli.DIRKEY+'.myNewKey', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('myBigBinaryFile.encrypted', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# split specified file on 55 parts with specified crypted key on specified output location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('split ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('myBigBinaryFile.avi', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -p ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('55' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo(Cli.DIRKEY+'.myNewKey', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('myBigBinaryFile.encrypted', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
|
||||
Cli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
Sys.print('\n'+' '*4+'command merge :', Sys.CLZ_HELP_CMD)
|
||||
Sys.echo('\n'+' '*4+'command merge :', Sys.CLZ_HELP_CMD)
|
||||
|
||||
Sys.print(' '*8+'# merge specified splitted file with default crypted key', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('merge ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print(Cli.HOME+'6136bd1b53d84ecbad5380594eea7256176c19e0266c723ea2e982f8ca49922b.kcf', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# merge specified splitted file with default crypted key', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('merge ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo(Cli.HOME+'6136bd1b53d84ecbad5380594eea7256176c19e0266c723ea2e982f8ca49922b.kcf', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
Sys.print(' '*8+'# merge specified tark splitted file with specified crypted key on specified output location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.print(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('merge ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('myBigBinaryFile.encrypted.tark', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print(Cli.DIRKEY+'.myNewKey', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('myBigBinaryFile.decrypted.avi', Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*8+'# merge specified tark splitted file with specified crypted key on specified output location', Sys.CLZ_HELP_COMMENT)
|
||||
Sys.echo(' '*8+conf.PRG_CLI_NAME+' ', Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('merge ', Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('myBigBinaryFile.encrypted.tark', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -k ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo(Cli.DIRKEY+'.myNewKey', Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -o ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('myBigBinaryFile.decrypted.avi', Sys.CLZ_HELP_PARAM)
|
||||
|
||||
Cli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
Sys.dprint()
|
||||
|
|
|
@ -65,7 +65,8 @@ class CliApp:
|
|||
if Io.file_exists(self.o.outputfile) and not self.o.force :
|
||||
|
||||
Sys.pwarn((('the key file ',(self.o.outputfile, Sys.Clz.fgb3), ' already exists !'),
|
||||
'if you rewrite this file, all previous files encrypted with the corresponding key will be unrecoverable !'))
|
||||
'if you rewrite this file, all previous files encrypted with the corresponding key will be',
|
||||
'unrecoverable !'))
|
||||
|
||||
done = Sys.pask('Are you sure to rewrite this file')
|
||||
self.stime = Sys.datetime.now()
|
||||
|
@ -74,7 +75,7 @@ class CliApp:
|
|||
Sys.pstep('Generate key file', self.stime, done)
|
||||
|
||||
if done :
|
||||
Sys.print(' '*5+Sys.realpath(self.o.outputfile), Sys.Clz.fgB1, True)
|
||||
Sys.echo(' '*5+Sys.realpath(self.o.outputfile), Sys.Clz.fgB1, True)
|
||||
|
||||
else :
|
||||
self.parser.error_cmd((('invalid option ',('-l, --length', Sys.Clz.fgb3), ' value (', ('128',Sys.Clz.fgb3),' to ', ('4096',Sys.Clz.fgb3),')'),))
|
||||
|
@ -319,15 +320,15 @@ class CliApp:
|
|||
def onend_cmd(self, title, stime, done, outputfile):
|
||||
""""""
|
||||
s = Const.LINE_SEP_CHAR*Const.LINE_SEP_LEN
|
||||
Sys.print(s, Sys.CLZ_HEAD_LINE)
|
||||
Sys.echo(s, Sys.CLZ_HEAD_LINE)
|
||||
Sys.wlog([(s, Const.CLZ_HEAD_SEP)])
|
||||
Sys.pstep(title, stime, done, True)
|
||||
Sys.print(s, Sys.CLZ_HEAD_LINE)
|
||||
Sys.echo(s, Sys.CLZ_HEAD_LINE)
|
||||
Sys.wlog([(s, Const.CLZ_HEAD_SEP)])
|
||||
if done and outputfile is not None:
|
||||
Sys.cli_emit_progress(100)
|
||||
Sys.print(' '*5+Sys.realpath(outputfile), Sys.Clz.fgB1, False)
|
||||
Sys.print(' ('+Sys.getFileSize(outputfile)+')', Sys.Clz.fgB3)
|
||||
Sys.echo(' '*5+Sys.realpath(outputfile), Sys.Clz.fgB1, False)
|
||||
Sys.echo(' ('+Sys.getFileSize(outputfile)+')', Sys.Clz.fgB3)
|
||||
bdata = [(' '*5+Sys.realpath(outputfile), 'io'),(' ('+Sys.getFileSize(outputfile)+')','func')]
|
||||
Sys.wlog(bdata)
|
||||
Sys.wlog(Sys.dprint())
|
||||
|
|
|
@ -102,8 +102,10 @@ DEFVAL_ENCMODE = True
|
|||
DEFVAL_MIXMODE = True
|
||||
DEFVAL_RANDOMMODE = True
|
||||
DEFVAL_USER_PATH = ''.join([sep,'home',sep,getUserLogin(),sep])
|
||||
#~ DEFVAL_USER_PATH = ''.join(['C:',sep,sep,'dev',sep,sep,getUserLogin(),sep,sep])
|
||||
DEFVAL_UKEY_PATH = ''.join([DEFVAL_USER_PATH, '.', PRG_PACKAGE,sep])
|
||||
DEFVAL_UKEY_NAME = '.default.key'
|
||||
#~ DEFVAL_UKEY_PATH = ''.join([DEFVAL_USER_PATH, PRG_PACKAGE,sep,sep])
|
||||
DEFVAL_UKEY_NAME = 'default.key'
|
||||
DEFVAL_UKEY_LENGHT = 1024
|
||||
DEFVAL_CRYPT_EXT = '.kmh'
|
||||
|
||||
|
|
|
@ -705,17 +705,17 @@ class Kirmah:
|
|||
filePath += ext
|
||||
depDir = dirs
|
||||
perc = 10
|
||||
frav = 2.7
|
||||
frav = len(hlst['data'])
|
||||
with Io.wfile(filePath) as fo :
|
||||
while p < hlst['head'][1] :
|
||||
perc += 0.5
|
||||
perc = p/3*100/len(hlst['data'])
|
||||
Sys.cli_emit_progress(perc)
|
||||
try:
|
||||
self.mergePart(fo, hlst['data'][p], depDir)
|
||||
except Exception as e:
|
||||
Sys.pwarn((('merge : ',(str(e),Sys.CLZ_WARN_PARAM), ' !'),), True)
|
||||
raise e
|
||||
perc += frav
|
||||
perc = p*100/len(hlst['data'])
|
||||
Sys.cli_emit_progress(perc)
|
||||
p += 1
|
||||
return filePath
|
||||
|
@ -1169,7 +1169,6 @@ class Randomiz:
|
|||
self.__init__(self.count,chl)
|
||||
|
||||
|
||||
@Log(Const.LOG_NEVER)
|
||||
def get(self,single=True):
|
||||
""""""
|
||||
pos = choice(self.lst)
|
||||
|
|
8
kirmah/gui.py
Normal file → Executable file
8
kirmah/gui.py
Normal file → Executable file
|
@ -86,7 +86,11 @@ class AppGui(Gui):
|
|||
key, size, mark = self.app.getKeyInfos()
|
||||
|
||||
self.curKey = self.DEFAULT_KEY
|
||||
print('-'*15)
|
||||
v = self.app.getDefaultKeyPath()
|
||||
print(v)
|
||||
self.get('filechooserbutton1').set_filename(self.app.getDefaultKeyPath())
|
||||
print(conf.DEFVAL_USER_PATH)
|
||||
self.get('filechooserbutton3').set_current_folder(conf.DEFVAL_USER_PATH)
|
||||
devPath = '/home/dev/git_repos/kirmah2.15/'
|
||||
#~ self.get('filechooserbutton3').set_current_folder(devPath)
|
||||
|
@ -222,7 +226,7 @@ class AppGui(Gui):
|
|||
if self.start: self.refreshProceed()
|
||||
|
||||
|
||||
@Log(Const.LOG_UI)
|
||||
@Log(Const.LOG_NEVER)
|
||||
def on_switch_mode(self, s, data):
|
||||
""""""
|
||||
self.app.switchEncMode(not s.get_active())
|
||||
|
@ -233,7 +237,7 @@ class AppGui(Gui):
|
|||
if self.start: self.refreshProceed()
|
||||
|
||||
|
||||
@Log(Const.LOG_UI)
|
||||
@Log(Const.LOG_NEVER)
|
||||
def on_switch_format(self, s, data):
|
||||
""""""
|
||||
self.app.switchFormatMode(not s.get_active())
|
||||
|
|
5
kirmah/ui.py
Normal file → Executable file
5
kirmah/ui.py
Normal file → Executable file
|
@ -110,6 +110,10 @@ class Gui():
|
|||
finally:
|
||||
main_quit(*args)
|
||||
|
||||
@Log()
|
||||
def beforeDelete(self):
|
||||
""""""
|
||||
|
||||
|
||||
@Log(Const.LOG_UI)
|
||||
def list_threads(self):
|
||||
|
@ -216,6 +220,7 @@ class Gui():
|
|||
data = Sys.g.LOG_QUEUE.get()
|
||||
if data is not None :
|
||||
if data is not Sys.g.SIGNAL_STOP :
|
||||
cth, data = data
|
||||
for item in data :
|
||||
ei = self.textbuffer.get_end_iter()
|
||||
offs = ei.get_offset()
|
||||
|
|
88
psr/cli.py
Normal file → Executable file
88
psr/cli.py
Normal file → Executable file
|
@ -123,7 +123,7 @@ class AbstractCli():
|
|||
d = AbstractCli.printHeaderPart('author' ,AbstractCli.conf.PRG_AUTHOR)
|
||||
e = AbstractCli.printHeaderPart('license' ,AbstractCli.conf.PRG_LICENSE)
|
||||
f = AbstractCli.printHeaderPart('copyright',AbstractCli.conf.PRG_COPY)
|
||||
Sys.print(' ', Sys.Clz.OFF)
|
||||
Sys.echo(' ', Sys.Clz.OFF)
|
||||
AbstractCli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
Sys.wlog(a)
|
||||
Sys.wlog(b + c + d + e + f )
|
||||
|
@ -135,7 +135,7 @@ class AbstractCli():
|
|||
def printLineSep(sep,lenSep):
|
||||
""""""
|
||||
s = sep*lenSep
|
||||
Sys.print(s, Sys.CLZ_HEAD_LINE)
|
||||
Sys.echo(s, Sys.CLZ_HEAD_LINE)
|
||||
return [(s, Const.CLZ_HEAD_SEP)]
|
||||
|
||||
|
||||
|
@ -143,7 +143,7 @@ class AbstractCli():
|
|||
def printHeaderTitle(title):
|
||||
""""""
|
||||
s = ' == '+title+' == '
|
||||
Sys.print(s, Sys.CLZ_HEAD_APP, False, True)
|
||||
Sys.echo(s, Sys.CLZ_HEAD_APP, False, True)
|
||||
return [(s, Const.CLZ_HEAD_APP)]
|
||||
|
||||
|
||||
|
@ -151,11 +151,11 @@ class AbstractCli():
|
|||
def printHeaderPart(label,value):
|
||||
""""""
|
||||
a, b, c = ' [',':' ,'] '
|
||||
Sys.print(a , Sys.CLZ_HEAD_SEP, False)
|
||||
Sys.print(label, Sys.CLZ_HEAD_KEY, False)
|
||||
Sys.print(b , Sys.CLZ_HEAD_SEP, False)
|
||||
Sys.print(value, Sys.CLZ_HEAD_VAL, False)
|
||||
Sys.print(c , Sys.CLZ_HEAD_SEP, False)
|
||||
Sys.echo(a , Sys.CLZ_HEAD_SEP, False)
|
||||
Sys.echo(label, Sys.CLZ_HEAD_KEY, False)
|
||||
Sys.echo(b , Sys.CLZ_HEAD_SEP, False)
|
||||
Sys.echo(value, Sys.CLZ_HEAD_VAL, False)
|
||||
Sys.echo(c , Sys.CLZ_HEAD_SEP, False)
|
||||
return [(a,Const.CLZ_HEAD_SEP),(label,Const.CLZ_HEAD_KEY),(b,Const.CLZ_HEAD_SEP),(value,Const.CLZ_HEAD_VAL),(c,Const.CLZ_HEAD_SEP)]
|
||||
|
||||
|
||||
|
@ -171,30 +171,30 @@ class AbstractCli():
|
|||
Sys.dprint('\n')
|
||||
AbstractCli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
|
||||
|
||||
Sys.print(' MAIN OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '*4+'-v'.ljust(13,' ')+', --version' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'display programm version' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-d'.ljust(13,' ')+', --debug' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'enable debug mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-f'.ljust(13,' ')+', --force' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'force rewriting existing files without alert' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-q'.ljust(13,' ')+', --quiet' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'don\'t print status messages to stdout' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-h'.ljust(13,' ')+', --help' , Sys.CLZ_HELP_ARG)
|
||||
Sys.print(' '*50+'display help' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' MAIN OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'-v'.ljust(13,' ')+', --version' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'display programm version' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-d'.ljust(13,' ')+', --debug' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'enable debug mode' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-f'.ljust(13,' ')+', --force' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'force rewriting existing files without alert' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-q'.ljust(13,' ')+', --quiet' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'don\'t print status messages to stdout' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-h'.ljust(13,' ')+', --help' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '*50+'display help' , Sys.CLZ_HELP_ARG_INFO)
|
||||
|
||||
Sys.dprint('\n')
|
||||
Sys.print(' KEY OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '*4+'-a ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --bind_opt_a'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'description option a' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.print(' '*4+'-b ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(', --bind_opt_b'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.print(' '*50+'description option b' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' KEY OPTIONS :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '*4+'-a ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --bind_opt_a'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'description option a' , Sys.CLZ_HELP_ARG_INFO)
|
||||
Sys.echo(' '*4+'-b ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(', --bind_opt_b'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
|
||||
Sys.echo(' '*50+'description option b' , Sys.CLZ_HELP_ARG_INFO)
|
||||
|
||||
|
||||
|
||||
|
@ -202,21 +202,21 @@ class AbstractCli():
|
|||
""""""
|
||||
if not withoutHeader : AbstractCli.print_header()
|
||||
|
||||
Sys.print(' USAGE :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.print(' '+AbstractCli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('help ' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' USAGE :\n' , Sys.CLZ_HELP_CMD)
|
||||
Sys.echo(' '+AbstractCli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('help ' , Sys.CLZ_HELP_CMD)
|
||||
|
||||
Sys.print(' '+AbstractCli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.print('cmd ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.print('[ -a ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('param_a' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(' -b ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.print('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('param_b' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.print(']' , Sys.CLZ_HELP_ARG)
|
||||
Sys.echo(' '+AbstractCli.conf.PRG_CLI_NAME+' ' , Sys.CLZ_HELP_PRG, False)
|
||||
Sys.echo('cmd ' , Sys.CLZ_HELP_CMD, False)
|
||||
Sys.echo('[ -a ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('param_a' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(' -b ' , Sys.CLZ_HELP_ARG, False)
|
||||
Sys.echo('{' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('param_b' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo('}' , Sys.CLZ_HELP_PARAM, False)
|
||||
Sys.echo(']' , Sys.CLZ_HELP_ARG)
|
||||
|
||||
|
||||
@staticmethod
|
||||
|
|
13
psr/const.py
Normal file → Executable file
13
psr/const.py
Normal file → Executable file
|
@ -65,6 +65,17 @@ class Const:
|
|||
CLZ_KO = 'ko'
|
||||
CLZ_TASK = 'task'
|
||||
CLZ_SYMBOL = 'symbol'
|
||||
CLZ_ACTION = 'action'
|
||||
CLZ_INIT = 'init'
|
||||
|
||||
CLZ_0 = 'color0'
|
||||
CLZ_1 = 'color1'
|
||||
CLZ_2 = 'color2'
|
||||
CLZ_3 = 'color3'
|
||||
CLZ_4 = 'color4'
|
||||
CLZ_5 = 'color5'
|
||||
CLZ_6 = 'color6'
|
||||
CLZ_7 = 'color7'
|
||||
|
||||
CLZ_HEAD_APP = 'headapp'
|
||||
CLZ_HEAD_SEP = 'headsep'
|
||||
|
@ -89,6 +100,6 @@ class Const:
|
|||
UNIT_SHORT_TIB = 'TiB'
|
||||
|
||||
LINE_SEP_LEN = 100
|
||||
LINE_SEP_CHAR = '―'
|
||||
LINE_SEP_CHAR = '-'
|
||||
|
||||
const = Const()
|
||||
|
|
84
psr/imap.py
Normal file → Executable file
84
psr/imap.py
Normal file → Executable file
|
@ -5,7 +5,7 @@ from email import message_from_bytes
|
|||
from email.header import decode_header
|
||||
from email.message import Message
|
||||
from re import search as research, split as resplit
|
||||
|
||||
from multiprocessing import Process
|
||||
from psr.sys import Io, Sys, Const
|
||||
from psr.log import Log
|
||||
|
||||
|
@ -103,12 +103,12 @@ register(_codec_imap4utf7)
|
|||
class ImapConfig:
|
||||
""""""
|
||||
|
||||
def __init__(self, host, user, pwd, port=993):
|
||||
def __init__(self, host, user, pwd, port='993'):
|
||||
""""""
|
||||
self.host = host
|
||||
self.user = user
|
||||
self.pwd = pwd
|
||||
self.port = port
|
||||
self.port = str(port)
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -173,37 +173,46 @@ class ImapHelper:
|
|||
""""""
|
||||
|
||||
@Log(Const.LOG_BUILD)
|
||||
def __init__(self, conf, box='INBOX'):
|
||||
def __init__(self, conf, box='INBOX', noBoxCreat=False):
|
||||
""""""
|
||||
if research('yahoo.com', conf.host) is not None :
|
||||
if conf.host != None and research('yahoo.com', conf.host) is not None :
|
||||
self.DRAFTS = self.DRAFTS[:-1]
|
||||
self.conf = conf
|
||||
self.rootBox = box
|
||||
self.BOXS = {}
|
||||
self.cnx = None
|
||||
self.cnxusr = None
|
||||
self.conf = conf
|
||||
self.rootBox = box
|
||||
self.BOXS = {}
|
||||
self.cnx = None
|
||||
self.cnxusr = None
|
||||
self.noBoxCreat = noBoxCreat
|
||||
self.switchAccount(self.conf, self.rootBox, True)
|
||||
|
||||
@Log()
|
||||
def reconnect(self):
|
||||
""""""
|
||||
Sys.pwlog([(' Reconnecting... ', Const.CLZ_7, True)])
|
||||
self.switchAccount(self.conf, self.rootBox, True)
|
||||
|
||||
|
||||
@Log()
|
||||
def switchAccount(self, conf, box='INBOX', force=False):
|
||||
""""""
|
||||
if force or self.cnx is None or self.cnxusr is not conf.user :
|
||||
try :
|
||||
Sys.print(' Attempt to login... ' , Sys.Clz.fgB7, False)
|
||||
Sys.print('(' , Sys.Clz.fgn7, False)
|
||||
Sys.print(conf.user , Sys.Clz.fgB2, False)
|
||||
Sys.print('@' , Sys.Clz.fgn7, False)
|
||||
Sys.print(conf.host , Sys.Clz.fgB4, False)
|
||||
Sys.print(':' , Sys.Clz.fgn7, False)
|
||||
Sys.print(conf.port , Sys.Clz.fgB3, False)
|
||||
Sys.print(')' , Sys.Clz.fgn7)
|
||||
try :
|
||||
Sys.pwlog([(' Attempt to login... ' , Const.CLZ_7),
|
||||
('(' , Const.CLZ_0),
|
||||
(conf.user , Const.CLZ_2),
|
||||
('@' , Const.CLZ_0),
|
||||
(conf.host , Const.CLZ_3),
|
||||
(':' , Const.CLZ_0),
|
||||
(conf.port , Const.CLZ_4),
|
||||
(')' , Const.CLZ_0, True)])
|
||||
|
||||
self.cnx = ImapClient(conf.host,conf.port)
|
||||
except Exception as e :
|
||||
raise BadHostException()
|
||||
|
||||
|
||||
try :
|
||||
status, resp = self.cnx.login(conf.user,conf.pwd)
|
||||
|
||||
|
||||
except Exception as e :
|
||||
status = self.KO
|
||||
pass
|
||||
|
@ -212,11 +221,12 @@ class ImapHelper:
|
|||
self.cnxusr = None
|
||||
raise BadLoginException(' Cannot login with '+conf.user+':'+conf.pwd)
|
||||
else :
|
||||
Sys.print(' connected' , Sys.Clz.fgB2)
|
||||
Sys.pwlog([(' Connected ', Const.CLZ_2, True),
|
||||
(Const.LINE_SEP_CHAR*Const.LINE_SEP_LEN , Const.CLZ_0, True)])
|
||||
self.cnxusr = conf.user
|
||||
try :
|
||||
status, resp = self.cnx.select(self.rootBox)
|
||||
if status == self.KO :
|
||||
if status == self.KO and not self.noBoxCreat:
|
||||
self.createBox(self.rootBox)
|
||||
status, resp = self.cnx.select(self.rootBox)
|
||||
self.initBoxNames()
|
||||
|
@ -433,9 +443,10 @@ class ImapHelper:
|
|||
if len(ids) > 0 and ids[0]!='' and ids[0]!=None:
|
||||
delids = ImapHelper._getIdsList(ids)
|
||||
status, resp = self.cnx.uid('store', delids, self.FLAGS, self.DELETED )
|
||||
Sys.print(' Deleting msg ', Sys.Clz.fgn7, False, False)
|
||||
Sys.print(delids , Sys.Clz.fgB1, False, False)
|
||||
Sys.print(' '+status , Sys.Clz.fgB7)
|
||||
|
||||
Sys.pwlog([(' Deleting msg ', Const.CLZ_0),
|
||||
(delids , Const.CLZ_1),
|
||||
(' '+status , Const.CLZ_7, True)])
|
||||
self.cnx.expunge()
|
||||
self.cnx.select(self.rootBox)
|
||||
|
||||
|
@ -454,6 +465,10 @@ class ImapHelper:
|
|||
@Log(Const.LOG_APP)
|
||||
def getAttachment(self, msg, toDir='./', byUid=False):
|
||||
""""""
|
||||
# self.download(msg, toDir, byUid, False)
|
||||
# p = Process(target=self.download, args=(msg, toDir, byUid))
|
||||
# p.start()
|
||||
# p.join()
|
||||
if not isinstance(msg, Message) :
|
||||
msg = self.getEmail(msg, byUid)
|
||||
for part in msg.walk():
|
||||
|
@ -461,6 +476,23 @@ class ImapHelper:
|
|||
if part.get_content_maintype() == 'multipart' or not filename : continue
|
||||
with Io.wfile(Sys.join(toDir, filename)) as fo :
|
||||
fo.write(part.get_payload(decode=True))
|
||||
|
||||
|
||||
@Log(Const.LOG_APP)
|
||||
def download(self, msg, toDir, byUid=False, reconError=True):
|
||||
""""""
|
||||
try:
|
||||
if not isinstance(msg, Message) :
|
||||
msg = self.getEmail(msg, byUid)
|
||||
for part in msg.walk():
|
||||
filename = part.get_filename()
|
||||
if part.get_content_maintype() == 'multipart' or not filename : continue
|
||||
with Io.wfile(Sys.join(toDir, filename)) as fo :
|
||||
fo.write(part.get_payload(decode=True))
|
||||
except Exception as e :
|
||||
print(e)
|
||||
self.reconnect()
|
||||
self.download(msg, toDir, byUid, False)
|
||||
|
||||
|
||||
@Log()
|
||||
|
|
20
psr/ini.py
Normal file → Executable file
20
psr/ini.py
Normal file → Executable file
|
@ -13,8 +13,10 @@ class IniFile:
|
|||
def __init__(self, path):
|
||||
""""""
|
||||
self.path = path
|
||||
self.dic = {}
|
||||
self.dic = {'main':{}}
|
||||
self.read()
|
||||
if not 'main' in self.dic :
|
||||
self.dic['main'] = {}
|
||||
|
||||
|
||||
@Log(Const.LOG_DEBUG)
|
||||
|
@ -41,6 +43,10 @@ class IniFile:
|
|||
def get(self, key, section='main'):
|
||||
""""""
|
||||
return self.dic[section][key]
|
||||
#if section in self.dic :
|
||||
# return self.dic[section][key]
|
||||
#else :
|
||||
# return ''
|
||||
|
||||
|
||||
@Log(Const.LOG_DEBUG)
|
||||
|
@ -78,7 +84,7 @@ class IniFile:
|
|||
""""""
|
||||
data = {}
|
||||
for s in self.dic :
|
||||
if s.startswith(section, 0) : data[s[len(section)+1:]] = self.dic[s]
|
||||
if s.startswith(section, 0) : data[s[len(section)+1:]] = self.dic[s].copy()
|
||||
return data
|
||||
|
||||
|
||||
|
@ -129,20 +135,20 @@ class IniFile:
|
|||
if sectionName!='main':
|
||||
Sys.dprint()
|
||||
if not withoutSectionName :
|
||||
Sys.print('['+sectionName+']', Sys.Clz.fgB3)
|
||||
Sys.echo('['+sectionName+']', Sys.Clz.fgB3)
|
||||
else:
|
||||
Sys.print('['+sectionName.split('.')[1]+']', Sys.Clz.fgB3)
|
||||
Sys.echo('['+sectionName.split('.')[1]+']', Sys.Clz.fgB3)
|
||||
if sectionName in self.dic :
|
||||
for k in sorted(self.dic[sectionName]):
|
||||
k = k.rstrip(' ')
|
||||
a = ''
|
||||
Sys.print(k.ljust(10,' ')+' = ' , Sys.Clz.fgn7, False)
|
||||
Sys.echo(k.ljust(10,' ')+' = ' , Sys.Clz.fgn7, False)
|
||||
if self.dic[sectionName][k] is not None :
|
||||
if len(self.dic[sectionName][k]) > 98: a = '…'
|
||||
if Sys.isUnix() or k is not 'key' :
|
||||
Sys.print(self.dic[sectionName][k][:98]+a, Sys.Clz.fgN2)
|
||||
Sys.echo(self.dic[sectionName][k][:98]+a, Sys.Clz.fgN2)
|
||||
else:
|
||||
Sys.print('key is masked', Sys.Clz.fgb1)
|
||||
Sys.echo('key is masked', Sys.Clz.fgb1)
|
||||
|
||||
@Log()
|
||||
def read(self):
|
||||
|
|
13
psr/io.py
Normal file → Executable file
13
psr/io.py
Normal file → Executable file
|
@ -41,7 +41,11 @@ class Io:
|
|||
from bz2 import compress as bzcompress, decompress as bzdecompress
|
||||
from errno import EEXIST
|
||||
from os import remove as removeFile, utime, rename
|
||||
from mmap import mmap, PROT_READ
|
||||
from platform import system
|
||||
if system() == 'Windows' :
|
||||
from mmap import mmap, ACCESS_READ as PROT_READ
|
||||
else :
|
||||
from mmap import mmap, PROT_READ
|
||||
|
||||
def __init__(self):
|
||||
""""""
|
||||
|
@ -125,8 +129,11 @@ class Io:
|
|||
@staticmethod
|
||||
def get_file_obj(path, binary=False, writing=False, update=False, truncate=False):
|
||||
""""""
|
||||
if not writing :
|
||||
f = open(path, mode='rt' if not binary else 'rb')
|
||||
if not writing :
|
||||
if not binary :
|
||||
f = open(path, encoding='utf-8', mode='rt')
|
||||
else :
|
||||
f = open(path, mode='rb')
|
||||
else :
|
||||
if update and not Io.file_exists(path):
|
||||
if binary :
|
||||
|
|
16
psr/log.py
Normal file → Executable file
16
psr/log.py
Normal file → Executable file
|
@ -86,7 +86,7 @@ class Log:
|
|||
if not (isinstance(a, str) or isinstance(a, bytes)):
|
||||
a = str(a)
|
||||
if len(a) > Sys.g.LOG_LIM_ARG_LENGTH :
|
||||
args[i] = a[:Sys.g.LOG_LIM_ARG_LENGTH]+'…' if isinstance(a, str) else bytes('…','utf-8')
|
||||
args[i] = a[:Sys.g.LOG_LIM_ARG_LENGTH]+'...' if isinstance(a, str) else bytes('...','utf-8')
|
||||
args = str(args)[1:-1]
|
||||
if args[-1:] == ',' : args = args[:-1]
|
||||
return args
|
||||
|
@ -104,11 +104,15 @@ class Log:
|
|||
|
||||
a, b, c, d, e = ('=> ' if enter else '<= '), '['+str(Sys.getpid()).rjust(5,' ')+']', ' '+sign+'(', Log._formatArgs(args), ') '
|
||||
if not isChildProc :
|
||||
Sys.print(a , Sys.CLZ_IO , False)
|
||||
Sys.print(b , Sys.CLZ_PID if not isChildProc else Sys.CLZ_CPID, False)
|
||||
Sys.print(c , Sys.CLZ_FUNC, False)
|
||||
Sys.print(d , Sys.CLZ_ARGS, False)
|
||||
Sys.print(e , Sys.CLZ_FUNC, False)
|
||||
Sys.echo(a , Sys.CLZ_IO , False)
|
||||
Sys.echo(b , Sys.CLZ_PID if not isChildProc else Sys.CLZ_CPID, False)
|
||||
Sys.echo(c , Sys.CLZ_FUNC, False)
|
||||
try:
|
||||
Sys.echo(d , Sys.CLZ_ARGS, False)
|
||||
except :
|
||||
Sys.echo('?nr_arg?' , Sys.CLZ_ARGS, False)
|
||||
pass
|
||||
Sys.echo(e , Sys.CLZ_FUNC, False)
|
||||
|
||||
bind_data += [(a, Const.CLZ_IO),(b, Const.CLZ_CPID if isChildProc else Const.CLZ_PID),(c , Const.CLZ_CFUNC if isChildProc else Const.CLZ_FUNC),(d , Const.CLZ_ARGS),(e , Const.CLZ_CFUNC if isChildProc else Const.CLZ_FUNC)]
|
||||
|
||||
|
|
2
psr/mproc.py
Normal file → Executable file
2
psr/mproc.py
Normal file → Executable file
|
@ -141,7 +141,7 @@ class Manager:
|
|||
if Sys.g.DEBUG :
|
||||
if not Sys.g.GUI :
|
||||
for item in msg[self.K_DATA] :
|
||||
Sys.print(item[0], Sys.clzdic[item[1]], False, True)
|
||||
Sys.echo(item[0], Sys.clzdic[item[1]], False, True)
|
||||
Sys.dprint('')
|
||||
#~ else :
|
||||
Sys.wlog(msg[self.K_DATA])
|
||||
|
|
120
psr/sys.py
Normal file → Executable file
120
psr/sys.py
Normal file → Executable file
|
@ -33,11 +33,11 @@
|
|||
|
||||
from psr.io import Io
|
||||
from psr.const import Const
|
||||
from threading import RLock
|
||||
from threading import RLock, current_thread
|
||||
from multiprocessing import Event
|
||||
from queue import Queue
|
||||
|
||||
def init(name, debug, remote=False, color=True, loglvl=Const.LOG_DEFAULT):
|
||||
def init(name, debug, remote=False, color=True, loglvl=Const.LOG_NEVER):
|
||||
Sys.g_init(name, debug, remote, color, loglvl)
|
||||
Sys.g_set_main_proc(remote)
|
||||
|
||||
|
@ -52,7 +52,7 @@ class Sys:
|
|||
from getpass import getuser as getUserLogin
|
||||
from time import strftime, mktime, time, localtime, sleep
|
||||
from datetime import datetime, timedelta
|
||||
from sys import exit
|
||||
from sys import exit, stdout, executable
|
||||
from os.path import abspath, dirname, join, realpath, basename, getsize, isdir, splitext
|
||||
from math import log, floor, ceil
|
||||
from _thread import exit as thread_exit
|
||||
|
@ -74,6 +74,7 @@ class Sys:
|
|||
g.SIGNAL_STOP = 0
|
||||
g.SIGNAL_START = 1
|
||||
g.SIGNAL_RUN = 2
|
||||
g.SIGNAL_CLEAR = 3
|
||||
g.GUI = False
|
||||
g.GUI_PRINT_STDOUT = True
|
||||
g.MPEVENT = Event()
|
||||
|
@ -229,7 +230,7 @@ class Sys:
|
|||
if not Sys.is_cli_cancel():
|
||||
if Sys.g.LOG_QUEUE is not None :
|
||||
try :
|
||||
Sys.g.LOG_QUEUE.put(data)
|
||||
Sys.g.LOG_QUEUE.put((current_thread().name,data))
|
||||
Sys.cli_emit_progress()
|
||||
except Exception as e:
|
||||
Sys.pwarn((('wlog exception ',(str(e),Sys.CLZ_ERROR_PARAM), ' !'),), True)
|
||||
|
@ -239,7 +240,24 @@ class Sys:
|
|||
|
||||
|
||||
@staticmethod
|
||||
def print(data, colors, endLF=True, endClz=True):
|
||||
def pwlog(data, guiClear=False):
|
||||
""" data=[('text', keycolor, newline)]"""
|
||||
if guiClear : Sys.wlog(Sys.g.SIGNAL_CLEAR)
|
||||
wd = []
|
||||
for item in data :
|
||||
nl = False if len(item)< 3 else (item[2]==1 or item[2]==True)
|
||||
c = Const.CLZ_0 if (len(item)< 2 or item[1] not in Sys.clzdic) else item[1]
|
||||
Sys.echo(item[0], Sys.clzdic[c], nl)
|
||||
wd += [(item[0], c)]
|
||||
if nl and Sys.g.GUI :
|
||||
Sys.wlog(wd)
|
||||
wd = []
|
||||
if len(wd) > 0 and Sys.g.GUI :
|
||||
Sys.wlog(wd)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def echo(data, colors, endLF=True, endClz=True):
|
||||
""""""
|
||||
if isinstance(data,bytes) :
|
||||
data = Sys.getPrintableBytes(data)
|
||||
|
@ -256,7 +274,7 @@ class Sys:
|
|||
else :
|
||||
if Sys.g.COLOR_MODE : Sys.Clz.setColor(eval('Sys.Clz._w'+'|Sys.Clz._w'.join(tokens)))
|
||||
Sys.dprint(data,end=ev, dbcall=False)
|
||||
stdout.flush()
|
||||
Sys.stdout.flush()
|
||||
if endClz and Sys.g.COLOR_MODE : Sys.Clz.setColor(Sys.Clz._wOFF)
|
||||
|
||||
|
||||
|
@ -268,7 +286,8 @@ class Sys:
|
|||
if not Sys.g.GUI or Sys.g.GUI_PRINT_STDOUT :
|
||||
if Sys.g.RLOCK is not None :
|
||||
with Sys.g.RLOCK :
|
||||
if not Sys.g.QUIET : print(d,end=end)
|
||||
if not Sys.g.QUIET :
|
||||
print(d,end=end)
|
||||
else :
|
||||
if not Sys.g.QUIET :
|
||||
print(d,end=end)
|
||||
|
@ -281,8 +300,8 @@ class Sys:
|
|||
def eprint(d='', label=Const.WARN, dbcall=False):
|
||||
""""""
|
||||
c = Sys.CLZ_ERROR if label is Const.ERROR else Sys.CLZ_WARN
|
||||
Sys.print(' '+label+' : ', c, False, False)
|
||||
Sys.print(str(d)+' ', c, True, True)
|
||||
Sys.echo(' '+label+' : ', c, False, False)
|
||||
Sys.echo(str(d)+' ', c, True, True)
|
||||
|
||||
bdata = [(label+' : ' , label),(str(d)+' ', label)]
|
||||
return bdata
|
||||
|
@ -293,8 +312,8 @@ class Sys:
|
|||
""""""
|
||||
t, s = Sys.strftime('%H:%M',t), Sys.strftime(':%S ',t)
|
||||
if not dbcall :
|
||||
Sys.print(t , Sys.CLZ_TIME, False)
|
||||
Sys.print(s , Sys.CLZ_SEC , False)
|
||||
Sys.echo(t , Sys.CLZ_TIME, False)
|
||||
Sys.echo(s , Sys.CLZ_SEC , False)
|
||||
|
||||
bdata = [(t , Const.CLZ_TIME),(s , Const.CLZ_SEC)]
|
||||
return bdata
|
||||
|
@ -305,8 +324,8 @@ class Sys:
|
|||
""""""
|
||||
l, v = label.rjust(pad,' '), ' '+str(value)
|
||||
if not dbcall :
|
||||
Sys.print(l, Sys.CLZ_SEC , False)
|
||||
Sys.print(v, Sys.CLZ_TIME , True)
|
||||
Sys.echo(l, Sys.CLZ_SEC , False)
|
||||
Sys.echo(v, Sys.CLZ_TIME , True)
|
||||
|
||||
bdata = [(l, Const.CLZ_SEC),(v, Const.CLZ_TIME)]
|
||||
return bdata
|
||||
|
@ -320,10 +339,10 @@ class Sys:
|
|||
@staticmethod
|
||||
def pdelta(t, label='', dbcall= False):
|
||||
""""""
|
||||
if len(label)>0 and not dbcall : Sys.print(label+' ', Sys.CLZ_IO, False)
|
||||
if len(label)>0 and not dbcall : Sys.echo(label+' ', Sys.CLZ_IO, False)
|
||||
v = Sys.getDelta(t)
|
||||
if not dbcall :
|
||||
Sys.print(v, Sys.CLZ_DELTA)
|
||||
Sys.echo(v, Sys.CLZ_DELTA)
|
||||
|
||||
bdata = []
|
||||
if len(label)>0 :
|
||||
|
@ -335,7 +354,7 @@ class Sys:
|
|||
@staticmethod
|
||||
def pcontent(content, color=None, bcolor=Const.CLZ_DEFAULT, dbcall= False):
|
||||
""""""
|
||||
if not dbcall : Sys.print(content, Sys.CLZ_SEC if color is None else color)
|
||||
if not dbcall : Sys.echo(content, Sys.CLZ_SEC if color is None else color)
|
||||
|
||||
bdata = [(content, bcolor)]
|
||||
return bdata
|
||||
|
@ -359,18 +378,18 @@ class Sys:
|
|||
uiclz = Const.CLZ_WARN if not isError else Const.CLZ_ERROR
|
||||
uiclzp = Const.CLZ_WARN_PARAM if not isError else Const.CLZ_ERROR_PARAM
|
||||
|
||||
if not dbcall : Sys.print(w, clzp, False, False)
|
||||
if not dbcall : Sys.echo(w, clzp, False, False)
|
||||
bdata = []
|
||||
if not Sys.g.QUIET :
|
||||
bdata.append((w, uiclzp))
|
||||
for i, line in enumerate(data) :
|
||||
if i > 0 :
|
||||
if not dbcall : Sys.print(' '*len(w), clz, False, False)
|
||||
if not dbcall : Sys.echo(' '*len(w), clz, False, False)
|
||||
if not Sys.g.QUIET :
|
||||
bdata.append((' '*len(w), uiclz))
|
||||
if isinstance(line,str) :
|
||||
s = line.ljust(length-len(w),' ')
|
||||
if not dbcall : Sys.print(s, clz, True, True)
|
||||
if not dbcall : Sys.echo(s, clz, True, True)
|
||||
|
||||
if not Sys.g.QUIET :
|
||||
bdata.append((s, uiclz))
|
||||
|
@ -380,15 +399,15 @@ class Sys:
|
|||
sl = 0
|
||||
for p in line :
|
||||
if isinstance(p,str) :
|
||||
Sys.print(p, clz, False, False)
|
||||
Sys.echo(p, clz, False, False)
|
||||
bdata.append((p, uiclz))
|
||||
sl += len(p)
|
||||
else :
|
||||
Sys.print(p[0], clzp+p[1], False, False)
|
||||
Sys.echo(p[0], clzp+p[1], False, False)
|
||||
bdata.append((p[0], uiclzp))
|
||||
sl += len(p[0])
|
||||
s = ' '.ljust(length-sl-len(w),' ')
|
||||
if not dbcall : Sys.print(s, clz, True, True)
|
||||
if not dbcall : Sys.echo(s, clz, True, True)
|
||||
if not Sys.g.QUIET :
|
||||
bdata.append((s, uiclz))
|
||||
Sys.wlog(bdata)
|
||||
|
@ -401,9 +420,9 @@ class Sys:
|
|||
@staticmethod
|
||||
def _psymbol(ch, done=True):
|
||||
""""""
|
||||
Sys.print(' ', Sys.CLZ_DEFAULT, False, False)
|
||||
Sys.print(' '+ch+' ', Sys.CLZ_HEAD_APP if done else Sys.CLZ_SYMBOL, False, True)
|
||||
Sys.print(' ', Sys.CLZ_DEFAULT, False, True)
|
||||
Sys.echo(' ', Sys.CLZ_DEFAULT, False, False)
|
||||
Sys.echo(' '+ch+' ', Sys.CLZ_HEAD_APP if done else Sys.CLZ_SYMBOL, False, True)
|
||||
Sys.echo(' ', Sys.CLZ_DEFAULT, False, True)
|
||||
bdata = [(' ', Const.CLZ_DEFAULT),(' '+ch+' ', Const.CLZ_HEAD_APP if done else Sys.CLZ_SYMBOL),(' ', Const.CLZ_DEFAULT)]
|
||||
return bdata
|
||||
|
||||
|
@ -412,7 +431,7 @@ class Sys:
|
|||
def pask(ask, yesValue='yes', noValue='no'):
|
||||
""""""
|
||||
Sys._psymbol('?')
|
||||
Sys.print('', Sys.Clz.fgb3, False, False)
|
||||
Sys.echo('', Sys.Clz.fgb3, False, False)
|
||||
ask = ask + ' ('+yesValue+'/'+noValue+') ? '
|
||||
answer = input(ask)
|
||||
while answer.lower()!=yesValue.lower() and answer.lower()!=noValue.lower() :
|
||||
|
@ -428,13 +447,13 @@ class Sys:
|
|||
if stime is not None :
|
||||
v = ' ('+''.join(['{:.5f}'.format(Sys.time()-(Sys.mktime(stime.timetuple())+1e-6*stime.microsecond)),' s'])+')'
|
||||
else : v = ''
|
||||
bdata = Sys._psymbol('¤')
|
||||
Sys.print(title, Sys.CLZ_TITLE, False, False)
|
||||
Sys.print(v+' '.ljust(length-len(title)-20-len(v), ' '),Sys.CLZ_DELTA, False, True)
|
||||
bdata = Sys._psymbol('*')
|
||||
Sys.echo(title, Sys.CLZ_TITLE, False, False)
|
||||
Sys.echo(v+' '.ljust(length-len(title)-20-len(v), ' '),Sys.CLZ_DELTA, False, True)
|
||||
if done :
|
||||
Sys.print(' == '+Const.OK+' == ', Sys.CLZ_OK)
|
||||
Sys.echo(' == '+Const.OK+' == ', Sys.CLZ_OK)
|
||||
else :
|
||||
Sys.print(' == '+Const.KO+' == ', Sys.CLZ_KO)
|
||||
Sys.echo(' == '+Const.KO+' == ', Sys.CLZ_KO)
|
||||
|
||||
bdata = bdata + [(title, Const.CLZ_TITLE),(v+' '.ljust(length-len(title)-20-len(v)), Const.CLZ_DELTA),(' == '+(Const.OK if done else Const.KO)+' == ', (Const.CLZ_OK if done else Const.CLZ_KO))]
|
||||
|
||||
|
@ -450,7 +469,7 @@ class Sys:
|
|||
def ptask(title='Processing, please wait'):
|
||||
if not Sys.g.QUIET :
|
||||
s = ' '+title+'...'
|
||||
Sys.print(s, Sys.CLZ_TASK )
|
||||
Sys.echo(s, Sys.CLZ_TASK )
|
||||
Sys.wlog([(s, Const.CLZ_TASK)])
|
||||
Sys.wlog(Sys.dprint())
|
||||
|
||||
|
@ -514,22 +533,22 @@ class Coloriz:
|
|||
for i in range(0,8):
|
||||
# foreground normal
|
||||
exec('self.fgn%i = self._MARKER + self._MARKER[0] + "n%i" + self._SEP + self._MARKER' % (i,i))
|
||||
if True or Sys.isUnix() : exec('self._un%i = "\\033[0;3%im"' % (i,i))
|
||||
if Sys.isUnix() : exec('self._un%i = "\\033[0;3%im"' % (i,i))
|
||||
# foreground bold
|
||||
exec('self.fgb%i = self._MARKER + self._MARKER[0] + "f%i" + self._SEP + self._MARKER' % (i,i))
|
||||
if True or Sys.isUnix() : exec('self._uf%i = "\\033[1;3%im"' % (i,i))
|
||||
if Sys.isUnix() : exec('self._uf%i = "\\033[1;3%im"' % (i,i))
|
||||
# foreground high intensity
|
||||
exec('self.fgN%i = self._MARKER + self._MARKER[0] + "N%i" + self._SEP + self._MARKER' % (i,i))
|
||||
if True or Sys.isUnix() : exec('self._uN%i = "\\033[0;9%im"' % (i,i))
|
||||
if Sys.isUnix() : exec('self._uN%i = "\\033[0;9%im"' % (i,i))
|
||||
# foreground bold high intensity
|
||||
exec('self.fgB%i = self._MARKER + self._MARKER[0] + "F%i" + self._SEP + self._MARKER' % (i,i))
|
||||
if True or Sys.isUnix() : exec('self._uF%i = "\\033[1;9%im"' % (i,i))
|
||||
if Sys.isUnix() : exec('self._uF%i = "\\033[1;9%im"' % (i,i))
|
||||
# background
|
||||
exec('self.bg%i = self._MARKER + self._MARKER[0] + "b%i" + self._SEP + self._MARKER' % (i,i))
|
||||
if True or Sys.isUnix() : exec('self._ub%i = "\\033[4%im"' % (i,i))
|
||||
if Sys.isUnix() : exec('self._ub%i = "\\033[4%im"' % (i,i))
|
||||
# background high intensity
|
||||
exec('self.BG%i = self._MARKER + self._MARKER[0] + "B%i" + self._SEP + self._MARKER' % (i,i))
|
||||
if True or Sys.isUnix() : exec('self._uB%i = "\\033[0;10%im"' % (i,i))
|
||||
if Sys.isUnix() : exec('self._uB%i = "\\033[0;10%im"' % (i,i))
|
||||
|
||||
Sys.Clz = Coloriz()
|
||||
Sys.CLZ_TIME = Sys.Clz.fgN2+Sys.Clz.bg0
|
||||
|
@ -552,6 +571,8 @@ Sys.CLZ_TITLE = Sys.Clz.fgB7+Sys.Clz.bg0
|
|||
Sys.CLZ_SYMBOL = Sys.Clz.BG4+Sys.Clz.fgB7
|
||||
Sys.CLZ_OK = Sys.Clz.bg2+Sys.Clz.fgb7
|
||||
Sys.CLZ_KO = Sys.Clz.bg1+Sys.Clz.fgb7
|
||||
Sys.CLZ_ACTION = Sys.Clz.BG4+Sys.Clz.fgB7
|
||||
Sys.CLZ_INIT = Sys.Clz.BG4+Sys.Clz.fgB7
|
||||
Sys.CLZ_HELP_PRG = Sys.Clz.fgb7
|
||||
Sys.CLZ_HELP_CMD = Sys.Clz.fgB3
|
||||
Sys.CLZ_HELP_PARAM = Sys.Clz.fgB1
|
||||
|
@ -565,4 +586,25 @@ Sys.CLZ_HEAD_VAL = Sys.Clz.fgB4
|
|||
Sys.CLZ_HEAD_SEP = Sys.Clz.fgB0
|
||||
Sys.CLZ_HEAD_LINE = Sys.Clz.fgN0
|
||||
|
||||
Sys.clzdic = { Const.CLZ_TASK : Sys.CLZ_TASK, Const.CLZ_SYMBOL: Sys.CLZ_SYMBOL, Const.CLZ_TIME : Sys.CLZ_TIME, Const.CLZ_SEC : Sys.CLZ_SEC, Const.CLZ_IO : Sys.CLZ_IO, Const.CLZ_CPID : Sys.CLZ_CPID, Const.CLZ_PID : Sys.CLZ_PID, Const.CLZ_CFUNC : Sys.CLZ_CFUNC, Const.CLZ_FUNC : Sys.CLZ_FUNC, Const.CLZ_ARGS : Sys.CLZ_ARGS, Const.CLZ_DELTA : Sys.CLZ_DELTA, Const.CLZ_ERROR : Sys.CLZ_ERROR, Const.CLZ_WARN : Sys.CLZ_WARN, Const.CLZ_ERROR_PARAM : Sys.CLZ_ERROR_PARAM, Const.CLZ_WARN_PARAM : Sys.CLZ_WARN_PARAM, Const.CLZ_DEFAULT : Sys.CLZ_DEFAULT }
|
||||
Sys.CLZ_0 = Sys.Clz.fgn7
|
||||
Sys.CLZ_1 = Sys.Clz.fgB1
|
||||
Sys.CLZ_2 = Sys.Clz.fgB2
|
||||
Sys.CLZ_3 = Sys.Clz.fgB3
|
||||
Sys.CLZ_4 = Sys.Clz.fgB4
|
||||
Sys.CLZ_5 = Sys.Clz.fgB5
|
||||
Sys.CLZ_6 = Sys.Clz.fgB6
|
||||
Sys.CLZ_7 = Sys.Clz.fgB7
|
||||
|
||||
Sys.clzdic = { Const.CLZ_0 : Sys.CLZ_0 , Const.CLZ_1 : Sys.CLZ_1 , Const.CLZ_2 : Sys.CLZ_2,
|
||||
Const.CLZ_3 : Sys.CLZ_3 , Const.CLZ_4 : Sys.CLZ_4 , Const.CLZ_5 : Sys.CLZ_5,
|
||||
Const.CLZ_6 : Sys.CLZ_6 , Const.CLZ_7 : Sys.CLZ_7 ,
|
||||
Const.CLZ_TASK : Sys.CLZ_TASK , Const.CLZ_SYMBOL: Sys.CLZ_SYMBOL,
|
||||
Const.CLZ_TIME : Sys.CLZ_TIME , Const.CLZ_SEC : Sys.CLZ_SEC ,
|
||||
Const.CLZ_IO : Sys.CLZ_IO , Const.CLZ_CPID : Sys.CLZ_CPID , Const.CLZ_PID : Sys.CLZ_PID,
|
||||
Const.CLZ_CFUNC : Sys.CLZ_CFUNC , Const.CLZ_FUNC : Sys.CLZ_FUNC , Const.CLZ_ARGS : Sys.CLZ_ARGS,
|
||||
Const.CLZ_DELTA : Sys.CLZ_DELTA ,
|
||||
Const.CLZ_ERROR : Sys.CLZ_ERROR , Const.CLZ_WARN : Sys.CLZ_WARN , Const.CLZ_ERROR_PARAM : Sys.CLZ_ERROR_PARAM, Const.CLZ_WARN_PARAM : Sys.CLZ_WARN_PARAM,
|
||||
Const.CLZ_DEFAULT : Sys.CLZ_DEFAULT,
|
||||
Const.CLZ_ACTION : Sys.CLZ_ACTION ,
|
||||
Const.CLZ_INIT : Sys.CLZ_INIT
|
||||
}
|
||||
|
|
0
psr/w32color.py
Normal file → Executable file
0
psr/w32color.py
Normal file → Executable file
0
resources/kirmah.desktop
Normal file → Executable file
0
resources/kirmah.desktop
Normal file → Executable file
0
resources/kirmah/glade/kirmah.glade
Normal file → Executable file
0
resources/kirmah/glade/kirmah.glade
Normal file → Executable file
0
resources/pixmaps/kirmah/kirmah.png
Normal file → Executable file
0
resources/pixmaps/kirmah/kirmah.png
Normal file → Executable file
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
0
resources/pixmaps/kirmah/kirmah_ico.png
Normal file → Executable file
0
resources/pixmaps/kirmah/kirmah_ico.png
Normal file → Executable file
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
0
scripts/kirmah
Normal file → Executable file
0
scripts/kirmah
Normal file → Executable file
0
scripts/kirmah-cli
Normal file → Executable file
0
scripts/kirmah-cli
Normal file → Executable file
Loading…
Reference in New Issue
Block a user