Skip to content

Commit aeff345

Browse files
committed
Small update
1 parent be5250a commit aeff345

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

catfile.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def handler(signum, frame):
117117
argparser.add_argument("-v", "--validate", action="store_true", help="Validate archive file checksums.")
118118
argparser.add_argument("-C", "--checksum", default="md5", help="Specify the type of checksum to use. The default is crc32.")
119119
argparser.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.")
120+
argparser.add_argument("-k", "--insecretkey", default=None, help="Secretkey to use for checksum input.")
121+
argparser.add_argument("-K", "--outsecretkey", default=None, help="Secretkey to use for checksum output.")
121122
# Permissions and metadata
122123
argparser.add_argument("-p", "--preserve", action="store_false", help="Do not preserve permissions and timestamps of files.")
123124
# Miscellaneous
@@ -154,38 +155,38 @@ def handler(signum, frame):
154155
checkcompressfile = pycatfile.CheckCompressionSubType(
155156
input_file, fnamedict, 0, True)
156157
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
157-
tmpout = pycatfile.RePackCatFile(input_file, getargs.output, "auto", 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.secretkey, getargs.verbose, False)
158+
tmpout = pycatfile.RePackCatFile(input_file, getargs.output, "auto", 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.insecretkey, getargs.outsecretkey, getargs.verbose, False)
158159
else:
159160
tmpout = pycatfile.PackCatFileFromInFile(
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)
161+
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.insecretkey, getargs.verbose, False)
161162
if(not tmpout):
162163
sys.exit(1)
163164
else:
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)
165+
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.insecretkey, getargs.verbose, False)
165166
elif active_action == 'repack':
166167
if getargs.convert:
167168
checkcompressfile = pycatfile.CheckCompressionSubType(
168169
input_file, fnamedict, 0, True)
169170
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
170171
pycatfile.RePackCatFile(input_file, getargs.output, "auto", getargs.compression, getargs.wholefile, getargs.level, pycatfile.compressionlistalt,
171-
False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.secretkey, getargs.secretkey, getargs.verbose, False)
172+
False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, getargs.verbose, False)
172173
else:
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)
174+
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.insecretkey, getargs.verbose, False)
174175
if(not tmpout):
175176
sys.exit(1)
176177
else:
177178
pycatfile.RePackCatFile(input_file, getargs.output, "auto", getargs.compression, getargs.wholefile, getargs.level, pycatfile.compressionlistalt,
178-
False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.secretkey, getargs.secretkey, getargs.verbose, False)
179+
False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.insecretkey, getargs.outsecretkey, getargs.verbose, False)
179180
elif active_action == 'extract':
180181
if getargs.convert:
181182
checkcompressfile = pycatfile.CheckCompressionSubType(
182183
input_file, fnamedict, 0, True)
183184
tempout = BytesIO()
184185
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
185-
tmpout = pycatfile.RePackCatFile(input_file, tempout, "auto", 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.secretkey, False, False)
186+
tmpout = pycatfile.RePackCatFile(input_file, tempout, "auto", 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.insecretkey, getargs.outsecretkey, False, False)
186187
else:
187188
tmpout = pycatfile.PackCatFileFromInFile(
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)
189+
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.insecretkey, False, False)
189190
if(not tmpout):
190191
sys.exit(1)
191192
input_file = tempout
@@ -196,28 +197,28 @@ def handler(signum, frame):
196197
checkcompressfile = pycatfile.CheckCompressionSubType(
197198
input_file, fnamedict, 0, True)
198199
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
199-
tmpout = pycatfile.CatFileListFiles(input_file, "auto", getargs.filestart, 0, 0, getargs.skipchecksum, fnamedict, getargs.secretkey, False, getargs.verbose, False, False)
200+
tmpout = pycatfile.CatFileListFiles(input_file, "auto", getargs.filestart, 0, 0, getargs.skipchecksum, fnamedict, getargs.insecretkey, False, getargs.verbose, False, False)
200201
else:
201-
tmpout = pycatfile.InFileListFiles(input_file, getargs.verbose, fnamedict, getargs.secretkey, False, False, False)
202+
tmpout = pycatfile.InFileListFiles(input_file, getargs.verbose, fnamedict, getargs.insecretkey, False, False, False)
202203
if(not tmpout):
203204
sys.exit(1)
204205
else:
205-
pycatfile.CatFileListFiles(input_file, "auto", getargs.filestart, 0, 0, getargs.skipchecksum, fnamedict, getargs.secretkey, False, getargs.verbose, False, False)
206+
pycatfile.CatFileListFiles(input_file, "auto", getargs.filestart, 0, 0, getargs.skipchecksum, fnamedict, getargs.insecretkey, False, getargs.verbose, False, False)
206207
elif active_action == 'validate':
207208
if getargs.convert:
208209
checkcompressfile = pycatfile.CheckCompressionSubType(
209210
input_file, fnamedict, 0, True)
210211
tempout = BytesIO()
211212
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
212-
tmpout = pycatfile.RePackCatFile(input_file, tempout, "auto", 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.secretkey, False, False, False)
213+
tmpout = pycatfile.RePackCatFile(input_file, tempout, "auto", 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.insecretkey, getargs.outsecretkey, False, False, False)
213214
else:
214215
tmpout = pycatfile.PackCatFileFromInFile(
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)
216+
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.insecretkey, False, False)
216217
input_file = tempout
217218
if(not tmpout):
218219
sys.exit(1)
219220
fvalid = pycatfile.StackedCatFileValidate(
220-
input_file, "auto", getargs.filestart, fnamedict, getargs.secretkey, False, getargs.verbose, False)
221+
input_file, "auto", getargs.filestart, fnamedict, getargs.insecretkey, False, getargs.verbose, False)
221222
if(not getargs.verbose):
222223
import sys
223224
import logging

pycatfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def _get(section_dict, key, default=None):
652652
__version_date__ = str(__version_date_info__[0]) + "." + str(
653653
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
654654
__revision__ = __version_info__[3]
655-
__revision_id__ = "$Id: 7d760a9824804341c14f119457713afbe95764bc $"
655+
__revision_id__ = "$Id$"
656656
if(__version_info__[4] is not None):
657657
__version_date_plusrc__ = __version_date__ + \
658658
"-" + str(__version_date_info__[4])

0 commit comments

Comments
 (0)