@@ -117,6 +117,7 @@ def handler(signum, frame):
117117argparser .add_argument ("-v" , "--validate" , action = "store_true" , help = "Validate archive file checksums." )
118118argparser .add_argument ("-C" , "--checksum" , default = "md5" , help = "Specify the type of checksum to use. The default is crc32." )
119119argparser .add_argument ("-s" , "--skipchecksum" , action = "store_true" , help = "Skip the checksum check of files." )
120+ argparser .add_argument ("-k" , "--secretkey" , default = None , help = "Secretkey to use for checksum." )
120121# Permissions and metadata
121122argparser .add_argument ("-p" , "--preserve" , action = "store_false" , help = "Do not preserve permissions and timestamps of files." )
122123# Miscellaneous
@@ -153,38 +154,38 @@ def handler(signum, frame):
153154 checkcompressfile = pycatfile .CheckCompressionSubType (
154155 input_file , fnamedict , 0 , True )
155156 if ((pycatfile .IsNestedDict (fnamedict ) and checkcompressfile in fnamedict ) or (pycatfile .IsSingleDict (fnamedict ) and checkcompressfile == fnamedict ['format_magic' ])):
156- tmpout = pycatfile .RePackCatFile (input_file , getargs .output , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .verbose , False )
157+ tmpout = pycatfile .RePackCatFile (input_file , getargs .output , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .secretkey , getargs . verbose , False )
157158 else :
158159 tmpout = pycatfile .PackCatFileFromInFile (
159- input_file , getargs .output , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs .verbose , False )
160+ input_file , getargs .output , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs .secretkey , getargs . verbose , False )
160161 if (not tmpout ):
161162 sys .exit (1 )
162163 else :
163- pycatfile .PackCatFile (getargs .input , getargs .output , getargs .text , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , False , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs .verbose , False )
164+ pycatfile .PackCatFile (getargs .input , getargs .output , getargs .text , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , False , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs .secretkey , getargs . verbose , False )
164165 elif active_action == 'repack' :
165166 if getargs .convert :
166167 checkcompressfile = pycatfile .CheckCompressionSubType (
167168 input_file , fnamedict , 0 , True )
168169 if ((pycatfile .IsNestedDict (fnamedict ) and checkcompressfile in fnamedict ) or (pycatfile .IsSingleDict (fnamedict ) and checkcompressfile == fnamedict ['format_magic' ])):
169170 pycatfile .RePackCatFile (input_file , getargs .output , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt ,
170- False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .verbose , False )
171+ False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .secretkey , getargs . verbose , False )
171172 else :
172- pycatfile .PackCatFileFromInFile (input_file , getargs .output , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs .verbose , False )
173+ pycatfile .PackCatFileFromInFile (input_file , getargs .output , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs .secretkey , getargs . verbose , False )
173174 if (not tmpout ):
174175 sys .exit (1 )
175176 else :
176177 pycatfile .RePackCatFile (input_file , getargs .output , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt ,
177- False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .verbose , False )
178+ False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .secretkey , getargs . verbose , False )
178179 elif active_action == 'extract' :
179180 if getargs .convert :
180181 checkcompressfile = pycatfile .CheckCompressionSubType (
181182 input_file , fnamedict , 0 , True )
182183 tempout = BytesIO ()
183184 if ((pycatfile .IsNestedDict (fnamedict ) and checkcompressfile in fnamedict ) or (pycatfile .IsSingleDict (fnamedict ) and checkcompressfile == fnamedict ['format_magic' ])):
184- tmpout = pycatfile .RePackCatFile (input_file , tempout , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , False , False )
185+ tmpout = pycatfile .RePackCatFile (input_file , tempout , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs . secretkey , False , False )
185186 else :
186187 tmpout = pycatfile .PackCatFileFromInFile (
187- input_file , tempout , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , False , False )
188+ input_file , tempout , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs . secretkey , False , False )
188189 if (not tmpout ):
189190 sys .exit (1 )
190191 input_file = tempout
@@ -195,28 +196,28 @@ def handler(signum, frame):
195196 checkcompressfile = pycatfile .CheckCompressionSubType (
196197 input_file , fnamedict , 0 , True )
197198 if ((pycatfile .IsNestedDict (fnamedict ) and checkcompressfile in fnamedict ) or (pycatfile .IsSingleDict (fnamedict ) and checkcompressfile == fnamedict ['format_magic' ])):
198- tmpout = pycatfile .CatFileListFiles (input_file , "auto" , getargs .filestart , 0 , 0 , getargs .skipchecksum , fnamedict , False , getargs .verbose , False , False )
199+ tmpout = pycatfile .CatFileListFiles (input_file , "auto" , getargs .filestart , 0 , 0 , getargs .skipchecksum , fnamedict , getargs . secretkey , False , getargs .verbose , False , False )
199200 else :
200- tmpout = pycatfile .InFileListFiles (input_file , getargs .verbose , fnamedict , False , False , False )
201+ tmpout = pycatfile .InFileListFiles (input_file , getargs .verbose , fnamedict , getargs . secretkey , False , False , False )
201202 if (not tmpout ):
202203 sys .exit (1 )
203204 else :
204- pycatfile .CatFileListFiles (input_file , "auto" , getargs .filestart , 0 , 0 , getargs .skipchecksum , fnamedict , False , getargs .verbose , False , False )
205+ pycatfile .CatFileListFiles (input_file , "auto" , getargs .filestart , 0 , 0 , getargs .skipchecksum , fnamedict , getargs . secretkey , False , getargs .verbose , False , False )
205206 elif active_action == 'validate' :
206207 if getargs .convert :
207208 checkcompressfile = pycatfile .CheckCompressionSubType (
208209 input_file , fnamedict , 0 , True )
209210 tempout = BytesIO ()
210211 if ((pycatfile .IsNestedDict (fnamedict ) and checkcompressfile in fnamedict ) or (pycatfile .IsSingleDict (fnamedict ) and checkcompressfile == fnamedict ['format_magic' ])):
211- tmpout = pycatfile .RePackCatFile (input_file , tempout , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , False , False , False )
212+ tmpout = pycatfile .RePackCatFile (input_file , tempout , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs . secretkey , False , False , False )
212213 else :
213214 tmpout = pycatfile .PackCatFileFromInFile (
214- input_file , tempout , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , False , False )
215+ input_file , tempout , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pycatfile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs . secretkey , False , False )
215216 input_file = tempout
216217 if (not tmpout ):
217218 sys .exit (1 )
218219 fvalid = pycatfile .StackedCatFileValidate (
219- input_file , "auto" , getargs .filestart , fnamedict , False , getargs .verbose , False )
220+ input_file , "auto" , getargs .filestart , fnamedict , getargs . secretkey , False , getargs .verbose , False )
220221 if (not getargs .verbose ):
221222 import sys
222223 import logging
0 commit comments