PyCatFile 0.25.0__py3-none-any.whl → 0.25.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pycatfile-0.25.0.data → pycatfile-0.25.2.data}/scripts/catfile.py +11 -11
- {pycatfile-0.25.0.dist-info → pycatfile-0.25.2.dist-info}/METADATA +1 -1
- pycatfile-0.25.2.dist-info/RECORD +10 -0
- pycatfile.py +302 -103
- pycatfile-0.25.0.dist-info/RECORD +0 -10
- {pycatfile-0.25.0.data → pycatfile-0.25.2.data}/scripts/catneofile.py +0 -0
- {pycatfile-0.25.0.data → pycatfile-0.25.2.data}/scripts/neocatfile.py +0 -0
- {pycatfile-0.25.0.dist-info → pycatfile-0.25.2.dist-info}/WHEEL +0 -0
- {pycatfile-0.25.0.dist-info → pycatfile-0.25.2.dist-info}/licenses/LICENSE +0 -0
- {pycatfile-0.25.0.dist-info → pycatfile-0.25.2.dist-info}/top_level.txt +0 -0
- {pycatfile-0.25.0.dist-info → pycatfile-0.25.2.dist-info}/zip-safe +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
15
15
|
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
16
16
|
|
|
17
|
-
$FileInfo: catfile.py - Last Update: 11/
|
|
17
|
+
$FileInfo: catfile.py - Last Update: 11/6/2025 Ver. 0.25.2 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
|
|
@@ -153,38 +153,38 @@ if active_action:
|
|
|
153
153
|
checkcompressfile = pycatfile.CheckCompressionSubType(
|
|
154
154
|
input_file, fnamedict, 0, True)
|
|
155
155
|
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.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
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
157
|
else:
|
|
158
158
|
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], [], {}, fnamedict, getargs.verbose, False)
|
|
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
160
|
if(not tmpout):
|
|
161
161
|
sys.exit(1)
|
|
162
162
|
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], [], {}, fnamedict, getargs.verbose, False)
|
|
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
164
|
elif active_action == 'repack':
|
|
165
165
|
if getargs.convert:
|
|
166
166
|
checkcompressfile = pycatfile.CheckCompressionSubType(
|
|
167
167
|
input_file, fnamedict, 0, True)
|
|
168
168
|
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
169
169
|
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.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
170
|
+
False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
171
171
|
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], [], {}, fnamedict, getargs.verbose, False)
|
|
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
173
|
if(not tmpout):
|
|
174
174
|
sys.exit(1)
|
|
175
175
|
else:
|
|
176
176
|
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.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
177
|
+
False, getargs.filestart, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
178
178
|
elif active_action == 'extract':
|
|
179
179
|
if getargs.convert:
|
|
180
180
|
checkcompressfile = pycatfile.CheckCompressionSubType(
|
|
181
181
|
input_file, fnamedict, 0, True)
|
|
182
182
|
tempout = BytesIO()
|
|
183
183
|
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.skipchecksum, [], {}, fnamedict, False, False)
|
|
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
185
|
else:
|
|
186
186
|
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], [], {}, fnamedict, False, False)
|
|
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
188
|
if(not tmpout):
|
|
189
189
|
sys.exit(1)
|
|
190
190
|
input_file = tempout
|
|
@@ -208,10 +208,10 @@ if active_action:
|
|
|
208
208
|
input_file, fnamedict, 0, True)
|
|
209
209
|
tempout = BytesIO()
|
|
210
210
|
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.skipchecksum, [], {}, fnamedict, False, False, False)
|
|
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
212
|
else:
|
|
213
213
|
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], [], {}, fnamedict, False, False)
|
|
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
215
|
input_file = tempout
|
|
216
216
|
if(not tmpout):
|
|
217
217
|
sys.exit(1)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
pycatfile.py,sha256=W-OppR7CuokFp4G4KLJ8LPxFmOecqPKIsLj3VFaVKbk,592602
|
|
2
|
+
pycatfile-0.25.2.data/scripts/catfile.py,sha256=nfKx7UpYIUe-vi3psEJrM9XYMMxRruJzJDRy-2tlPx8,14164
|
|
3
|
+
pycatfile-0.25.2.data/scripts/catneofile.py,sha256=b0sJBb-o6Rx5TO_dqXnJz3fCf-yPbEul1_6uX2CRS0Q,5128
|
|
4
|
+
pycatfile-0.25.2.data/scripts/neocatfile.py,sha256=YefEZZAnFwJ63xy2zDnvvs99BOyrHVhT1cPH4TnzrQs,7149
|
|
5
|
+
pycatfile-0.25.2.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
|
|
6
|
+
pycatfile-0.25.2.dist-info/METADATA,sha256=S5ZKjUYsAtAvg6SGpgv9B9uSPg9ZINCqf3erm_PGVZg,954
|
|
7
|
+
pycatfile-0.25.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
pycatfile-0.25.2.dist-info/top_level.txt,sha256=ZnSwEHU_60RLIvmFhsATaAaEYjErDQgUymWwoXZ724c,10
|
|
9
|
+
pycatfile-0.25.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
10
|
+
pycatfile-0.25.2.dist-info/RECORD,,
|
pycatfile.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
15
15
|
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
16
16
|
|
|
17
|
-
$FileInfo: pycatfile.py - Last Update: 11/
|
|
17
|
+
$FileInfo: pycatfile.py - Last Update: 11/6/2025 Ver. 0.25.2 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
|
|
@@ -649,12 +649,12 @@ __project__ = __program_name__
|
|
|
649
649
|
__program_alt_name__ = __program_name__
|
|
650
650
|
__project_url__ = "https://github.com/GameMaker2k/PyCatFile"
|
|
651
651
|
__project_release_url__ = __project_url__+"/releases/latest"
|
|
652
|
-
__version_info__ = (0, 25,
|
|
653
|
-
__version_date_info__ = (2025, 11,
|
|
652
|
+
__version_info__ = (0, 25, 2, "RC 1", 1)
|
|
653
|
+
__version_date_info__ = (2025, 11, 6, "RC 1", 1)
|
|
654
654
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
655
655
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
656
656
|
__revision__ = __version_info__[3]
|
|
657
|
-
__revision_id__ = "$Id:
|
|
657
|
+
__revision_id__ = "$Id: d2f5e2d130062be70121a9e3633ff5962335321c $"
|
|
658
658
|
if(__version_info__[4] is not None):
|
|
659
659
|
__version_date_plusrc__ = __version_date__ + \
|
|
660
660
|
"-" + str(__version_date_info__[4])
|
|
@@ -4736,7 +4736,30 @@ def ReadFileDataWithContent(fp, filestart=0, listonly=False, uncompress=True, sk
|
|
|
4736
4736
|
VerbosePrintOut("'" + fprechecksum + "' != " +
|
|
4737
4737
|
"'" + newfcs + "'")
|
|
4738
4738
|
return False
|
|
4739
|
-
fnumfiles = int(inheader[
|
|
4739
|
+
fnumfiles = int(inheader[6], 16)
|
|
4740
|
+
outfseeknextfile = inheaderdata[7]
|
|
4741
|
+
fjsonsize = int(inheaderdata[10], 16)
|
|
4742
|
+
fjsonchecksumtype = inheader[11]
|
|
4743
|
+
fjsonchecksum = inheader[12]
|
|
4744
|
+
fp.read(fjsonsize)
|
|
4745
|
+
# Next seek directive
|
|
4746
|
+
if(re.findall(r"^\+([0-9]+)", outfseeknextfile)):
|
|
4747
|
+
fseeknextasnum = int(outfseeknextfile.replace("+", ""))
|
|
4748
|
+
if(abs(fseeknextasnum) == 0):
|
|
4749
|
+
pass
|
|
4750
|
+
fp.seek(fseeknextasnum, 1)
|
|
4751
|
+
elif(re.findall(r"^\-([0-9]+)", outfseeknextfile)):
|
|
4752
|
+
fseeknextasnum = int(outfseeknextfile)
|
|
4753
|
+
if(abs(fseeknextasnum) == 0):
|
|
4754
|
+
pass
|
|
4755
|
+
fp.seek(fseeknextasnum, 1)
|
|
4756
|
+
elif(re.findall(r"^([0-9]+)", outfseeknextfile)):
|
|
4757
|
+
fseeknextasnum = int(outfseeknextfile)
|
|
4758
|
+
if(abs(fseeknextasnum) == 0):
|
|
4759
|
+
pass
|
|
4760
|
+
fp.seek(fseeknextasnum, 0)
|
|
4761
|
+
else:
|
|
4762
|
+
return False
|
|
4740
4763
|
countnum = 0
|
|
4741
4764
|
flist = []
|
|
4742
4765
|
while(countnum < fnumfiles):
|
|
@@ -4775,10 +4798,10 @@ def ReadFileDataWithContentToArray(fp, filestart=0, seekstart=0, seekend=0, list
|
|
|
4775
4798
|
else:
|
|
4776
4799
|
inheader = ReadFileHeaderDataWoSize(
|
|
4777
4800
|
fp, formatspecs['format_delimiter'])
|
|
4778
|
-
fnumextrafieldsize = int(inheader[
|
|
4779
|
-
fnumextrafields = int(inheader[
|
|
4801
|
+
fnumextrafieldsize = int(inheader[13], 16)
|
|
4802
|
+
fnumextrafields = int(inheader[14], 16)
|
|
4780
4803
|
fextrafieldslist = []
|
|
4781
|
-
extrastart =
|
|
4804
|
+
extrastart = 15
|
|
4782
4805
|
extraend = extrastart + fnumextrafields
|
|
4783
4806
|
while(extrastart < extraend):
|
|
4784
4807
|
fextrafieldslist.append(inheader[extrastart])
|
|
@@ -4798,7 +4821,105 @@ def ReadFileDataWithContentToArray(fp, filestart=0, seekstart=0, seekend=0, list
|
|
|
4798
4821
|
fhencoding = inheader[2]
|
|
4799
4822
|
fostype = inheader[3]
|
|
4800
4823
|
fpythontype = inheader[4]
|
|
4801
|
-
|
|
4824
|
+
fprojectname = inheader[4]
|
|
4825
|
+
fnumfiles = int(inheader[6], 16)
|
|
4826
|
+
fseeknextfile = inheader[7]
|
|
4827
|
+
fjsontype = inheader[8]
|
|
4828
|
+
fjsonlen = int(inheader[9], 16)
|
|
4829
|
+
fjsonsize = int(inheader[10], 16)
|
|
4830
|
+
fjsonchecksumtype = inheader[11]
|
|
4831
|
+
fjsonchecksum = inheader[12]
|
|
4832
|
+
fjsoncontent = {}
|
|
4833
|
+
fjstart = fp.tell()
|
|
4834
|
+
if(fjsontype=="json"):
|
|
4835
|
+
fjsoncontent = {}
|
|
4836
|
+
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
4837
|
+
if(fjsonsize > 0):
|
|
4838
|
+
try:
|
|
4839
|
+
fjsonrawcontent = base64.b64decode(fprejsoncontent.encode("UTF-8")).decode("UTF-8")
|
|
4840
|
+
fjsoncontent = json.loads(base64.b64decode(fprejsoncontent.encode("UTF-8")).decode("UTF-8"))
|
|
4841
|
+
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
4842
|
+
try:
|
|
4843
|
+
fjsonrawcontent = fprejsoncontent
|
|
4844
|
+
fjsoncontent = json.loads(fprejsoncontent)
|
|
4845
|
+
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
4846
|
+
fprejsoncontent = ""
|
|
4847
|
+
fjsonrawcontent = fprejsoncontent
|
|
4848
|
+
fjsoncontent = {}
|
|
4849
|
+
else:
|
|
4850
|
+
fprejsoncontent = ""
|
|
4851
|
+
fjsonrawcontent = fprejsoncontent
|
|
4852
|
+
fjsoncontent = {}
|
|
4853
|
+
elif(testyaml and fjsontype == "yaml"):
|
|
4854
|
+
fjsoncontent = {}
|
|
4855
|
+
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
4856
|
+
if (fjsonsize > 0):
|
|
4857
|
+
try:
|
|
4858
|
+
# try base64 → utf-8 → YAML
|
|
4859
|
+
fjsonrawcontent = base64.b64decode(fprejsoncontent.encode("UTF-8")).decode("UTF-8")
|
|
4860
|
+
fjsoncontent = yaml.safe_load(fjsonrawcontent) or {}
|
|
4861
|
+
except (binascii.Error, UnicodeDecodeError, yaml.YAMLError):
|
|
4862
|
+
try:
|
|
4863
|
+
# fall back to treating the bytes as plain text YAML
|
|
4864
|
+
fjsonrawcontent = fprejsoncontent
|
|
4865
|
+
fjsoncontent = yaml.safe_load(fjsonrawcontent) or {}
|
|
4866
|
+
except (UnicodeDecodeError, yaml.YAMLError):
|
|
4867
|
+
# final fallback: empty
|
|
4868
|
+
fprejsoncontent = ""
|
|
4869
|
+
fjsonrawcontent = fprejsoncontent
|
|
4870
|
+
fjsoncontent = {}
|
|
4871
|
+
else:
|
|
4872
|
+
fprejsoncontent = ""
|
|
4873
|
+
fjsonrawcontent = fprejsoncontent
|
|
4874
|
+
fjsoncontent = {}
|
|
4875
|
+
elif(not testyaml and fjsontype == "yaml"):
|
|
4876
|
+
fjsoncontent = {}
|
|
4877
|
+
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
4878
|
+
fprejsoncontent = ""
|
|
4879
|
+
fjsonrawcontent = fprejsoncontent
|
|
4880
|
+
elif(fjsontype=="list"):
|
|
4881
|
+
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
4882
|
+
flisttmp = MkTempFile()
|
|
4883
|
+
flisttmp.write(fprejsoncontent.encode())
|
|
4884
|
+
flisttmp.seek(0)
|
|
4885
|
+
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
4886
|
+
flisttmp.close()
|
|
4887
|
+
fjsonrawcontent = fjsoncontent
|
|
4888
|
+
if(fjsonlen==1):
|
|
4889
|
+
try:
|
|
4890
|
+
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
4891
|
+
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
4892
|
+
fjsonlen = len(fjsoncontent)
|
|
4893
|
+
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
4894
|
+
try:
|
|
4895
|
+
fjsonrawcontent = fjsoncontent[0]
|
|
4896
|
+
fjsoncontent = json.loads(fjsoncontent[0])
|
|
4897
|
+
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
4898
|
+
pass
|
|
4899
|
+
fjend = fp.tell()
|
|
4900
|
+
if(re.findall("^\\+([0-9]+)", fseeknextfile)):
|
|
4901
|
+
fseeknextasnum = int(fseeknextfile.replace("+", ""))
|
|
4902
|
+
if(abs(fseeknextasnum) == 0):
|
|
4903
|
+
pass
|
|
4904
|
+
fp.seek(fseeknextasnum, 1)
|
|
4905
|
+
elif(re.findall("^\\-([0-9]+)", fseeknextfile)):
|
|
4906
|
+
fseeknextasnum = int(fseeknextfile)
|
|
4907
|
+
if(abs(fseeknextasnum) == 0):
|
|
4908
|
+
pass
|
|
4909
|
+
fp.seek(fseeknextasnum, 1)
|
|
4910
|
+
elif(re.findall("^([0-9]+)", fseeknextfile)):
|
|
4911
|
+
fseeknextasnum = int(fseeknextfile)
|
|
4912
|
+
if(abs(fseeknextasnum) == 0):
|
|
4913
|
+
pass
|
|
4914
|
+
fp.seek(fseeknextasnum, 0)
|
|
4915
|
+
else:
|
|
4916
|
+
return False
|
|
4917
|
+
jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs)
|
|
4918
|
+
if(not hmac.compare_digest(fjsonchecksum, jsonfcs) and not skipchecksum):
|
|
4919
|
+
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
4920
|
+
fname + " at offset " + str(fheaderstart))
|
|
4921
|
+
VerbosePrintOut("'" + fjsonchecksum + "' != " + "'" + jsonfcs + "'")
|
|
4922
|
+
return False
|
|
4802
4923
|
fprechecksumtype = inheader[-2]
|
|
4803
4924
|
fprechecksum = inheader[-1]
|
|
4804
4925
|
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
|
|
@@ -4811,7 +4932,7 @@ def ReadFileDataWithContentToArray(fp, filestart=0, seekstart=0, seekend=0, list
|
|
|
4811
4932
|
return False
|
|
4812
4933
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
4813
4934
|
fcompresstype = ""
|
|
4814
|
-
outlist = {'fnumfiles': fnumfiles, 'ffilestart': filestart, 'fformat': formversions[0], 'fcompression': fcompresstype, 'fencoding': fhencoding, 'fversion': formversions[1], 'fostype': fostype, 'fimptype': fpythontype, 'fheadersize': fheadsize, 'fsize': CatSizeEnd, 'fnumfields': fnumfields + 2, 'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'frawheader': [formstring] + inheader, 'fextrafields': fnumextrafields, 'fextrafieldsize': fnumextrafieldsize, 'fextradata': fextrafieldslist, 'ffilelist': []}
|
|
4935
|
+
outlist = {'fnumfiles': fnumfiles, 'ffilestart': filestart, 'fformat': formversions[0], 'fcompression': fcompresstype, 'fencoding': fhencoding, 'fversion': formversions[1], 'fostype': fostype, 'fprojectname': fprojectname, 'fimptype': fpythontype, 'fheadersize': fheadsize, 'fsize': CatSizeEnd, 'fnumfields': fnumfields + 2, 'fformatspecs': formatspecs, 'fseeknextfile': fseeknextfile, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'fjsonchecksumtype': fjsonchecksumtype, 'fjsontype': fjsontype, 'fjsonlen': fjsonlen, 'fjsonsize': fjsonsize, 'fjsonrawdata': fjsonrawcontent, 'fjsondata': fjsoncontent, 'fjstart': fjstart, 'fjend': fjend, 'fjsonchecksum': fjsonchecksum, 'frawheader': [formstring] + inheader, 'fextrafields': fnumextrafields, 'fextrafieldsize': fnumextrafieldsize, 'fextradata': fextrafieldslist, 'ffilelist': []}
|
|
4815
4936
|
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
4816
4937
|
seekstart = 0
|
|
4817
4938
|
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
@@ -4931,10 +5052,10 @@ def ReadFileDataWithContentToList(fp, filestart=0, seekstart=0, seekend=0, listo
|
|
|
4931
5052
|
else:
|
|
4932
5053
|
inheader = ReadFileHeaderDataWoSize(
|
|
4933
5054
|
fp, formatspecs['format_delimiter'])
|
|
4934
|
-
fnumextrafieldsize = int(inheader[
|
|
4935
|
-
fnumextrafields = int(inheader[
|
|
5055
|
+
fnumextrafieldsize = int(inheader[13], 16)
|
|
5056
|
+
fnumextrafields = int(inheader[14], 16)
|
|
4936
5057
|
fextrafieldslist = []
|
|
4937
|
-
extrastart =
|
|
5058
|
+
extrastart = 15
|
|
4938
5059
|
extraend = extrastart + fnumextrafields
|
|
4939
5060
|
while(extrastart < extraend):
|
|
4940
5061
|
fextrafieldslist.append(inheader[extrastart])
|
|
@@ -4951,10 +5072,40 @@ def ReadFileDataWithContentToList(fp, filestart=0, seekstart=0, seekend=0, listo
|
|
|
4951
5072
|
formversion = re.findall("([\\d]+)", formstring)
|
|
4952
5073
|
fheadsize = int(inheader[0], 16)
|
|
4953
5074
|
fnumfields = int(inheader[1], 16)
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
5075
|
+
fnumfiles = int(inheader[6], 16)
|
|
5076
|
+
fseeknextfile = inheaderdata[7]
|
|
5077
|
+
fjsontype = int(inheader[8], 16)
|
|
5078
|
+
fjsonlen = int(inheader[9], 16)
|
|
5079
|
+
fjsonsize = int(inheader[10], 16)
|
|
5080
|
+
fjsonchecksumtype = inheader[11]
|
|
5081
|
+
fjsonchecksum = inheader[12]
|
|
5082
|
+
fjsoncontent = {}
|
|
5083
|
+
fjstart = fp.tell()
|
|
5084
|
+
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
5085
|
+
fjend = fp.tell()
|
|
5086
|
+
if(re.findall("^\\+([0-9]+)", fseeknextfile)):
|
|
5087
|
+
fseeknextasnum = int(fseeknextfile.replace("+", ""))
|
|
5088
|
+
if(abs(fseeknextasnum) == 0):
|
|
5089
|
+
pass
|
|
5090
|
+
fp.seek(fseeknextasnum, 1)
|
|
5091
|
+
elif(re.findall("^\\-([0-9]+)", fseeknextfile)):
|
|
5092
|
+
fseeknextasnum = int(fseeknextfile)
|
|
5093
|
+
if(abs(fseeknextasnum) == 0):
|
|
5094
|
+
pass
|
|
5095
|
+
fp.seek(fseeknextasnum, 1)
|
|
5096
|
+
elif(re.findall("^([0-9]+)", fseeknextfile)):
|
|
5097
|
+
fseeknextasnum = int(fseeknextfile)
|
|
5098
|
+
if(abs(fseeknextasnum) == 0):
|
|
5099
|
+
pass
|
|
5100
|
+
fp.seek(fseeknextasnum, 0)
|
|
5101
|
+
else:
|
|
5102
|
+
return False
|
|
5103
|
+
jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs)
|
|
5104
|
+
if(not hmac.compare_digest(fjsonchecksum, jsonfcs) and not skipchecksum):
|
|
5105
|
+
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
5106
|
+
fname + " at offset " + str(fheaderstart))
|
|
5107
|
+
VerbosePrintOut("'" + fjsonchecksum + "' != " + "'" + jsonfcs + "'")
|
|
5108
|
+
return False
|
|
4958
5109
|
fprechecksumtype = inheader[-2]
|
|
4959
5110
|
fprechecksum = inheader[-1]
|
|
4960
5111
|
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
|
|
@@ -5008,7 +5159,7 @@ def ReadFileDataWithContentToList(fp, filestart=0, seekstart=0, seekend=0, listo
|
|
|
5008
5159
|
prenewfcs = GetHeaderChecksum(
|
|
5009
5160
|
preheaderdata[:-2], preheaderdata[-4].lower(), True, formatspecs)
|
|
5010
5161
|
prefcs = preheaderdata[-2]
|
|
5011
|
-
if(prefcs
|
|
5162
|
+
if(not hmac.compare_digest(prefcs, prenewfcs) and not skipchecksum):
|
|
5012
5163
|
VerbosePrintOut("File Header Checksum Error with file " +
|
|
5013
5164
|
prefname + " at offset " + str(prefhstart))
|
|
5014
5165
|
VerbosePrintOut("'" + prefcs + "' != " +
|
|
@@ -5029,7 +5180,7 @@ def ReadFileDataWithContentToList(fp, filestart=0, seekstart=0, seekend=0, listo
|
|
|
5029
5180
|
prefcontents, preheaderdata[-3].lower(), False, formatspecs)
|
|
5030
5181
|
prefccs = preheaderdata[-1]
|
|
5031
5182
|
pyhascontents = True
|
|
5032
|
-
if(not hmac.compare_digest(
|
|
5183
|
+
if(not hmac.compare_digest(prefccs, prenewfccs) and not skipchecksum):
|
|
5033
5184
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
5034
5185
|
prefname + " at offset " + str(prefcontentstart))
|
|
5035
5186
|
VerbosePrintOut("'" + prefccs +
|
|
@@ -5390,12 +5541,7 @@ def AppendNullBytes(indata=None, delimiter=__file_format_dict__['format_delimite
|
|
|
5390
5541
|
def _hex_lower(n):
|
|
5391
5542
|
return format(int(n), 'x').lower()
|
|
5392
5543
|
|
|
5393
|
-
def AppendFileHeader(fp,
|
|
5394
|
-
numfiles,
|
|
5395
|
-
fencoding,
|
|
5396
|
-
extradata=None,
|
|
5397
|
-
checksumtype="md5",
|
|
5398
|
-
formatspecs=__file_format_dict__):
|
|
5544
|
+
def AppendFileHeader(fp, numfiles, fencoding, extradata=[], jsondata={}, checksumtype=["md5", "md5"], formatspecs=__file_format_dict__):
|
|
5399
5545
|
"""
|
|
5400
5546
|
Build and write the archive file header.
|
|
5401
5547
|
Returns the same file-like 'fp' on success, or False on failure.
|
|
@@ -5443,24 +5589,44 @@ def AppendFileHeader(fp,
|
|
|
5443
5589
|
# 4) core header fields before checksum:
|
|
5444
5590
|
# tmpoutlenhex, fencoding, platform.system(), fnumfiles
|
|
5445
5591
|
fnumfiles_hex = _hex_lower(numfiles)
|
|
5446
|
-
|
|
5592
|
+
fjsontype = "json"
|
|
5593
|
+
if(len(jsondata) > 0):
|
|
5594
|
+
try:
|
|
5595
|
+
fjsoncontent = json.dumps(jsondata, separators=(',', ':')).encode("UTF-8")
|
|
5596
|
+
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
5597
|
+
fjsoncontent = "".encode("UTF-8")
|
|
5598
|
+
else:
|
|
5599
|
+
fjsoncontent = "".encode("UTF-8")
|
|
5600
|
+
fjsonsize = format(len(fjsoncontent), 'x').lower()
|
|
5601
|
+
fjsonlen = format(len(jsondata), 'x').lower()
|
|
5602
|
+
tmpoutlist = []
|
|
5603
|
+
tmpoutlist.append(fjsontype)
|
|
5604
|
+
tmpoutlist.append(fjsonlen)
|
|
5605
|
+
tmpoutlist.append(fjsonsize)
|
|
5606
|
+
if(len(jsondata) > 0):
|
|
5607
|
+
tmpoutlist.append(checksumtype[1])
|
|
5608
|
+
tmpoutlist.append(GetFileChecksum(fjsoncontent, checksumtype[1], True, formatspecs))
|
|
5609
|
+
else:
|
|
5610
|
+
tmpoutlist.append("none")
|
|
5611
|
+
tmpoutlist.append(GetFileChecksum(fjsoncontent, "none", True, formatspecs))
|
|
5447
5612
|
# Preserve your original "tmpoutlen" computation exactly
|
|
5448
|
-
tmpoutlist
|
|
5449
|
-
|
|
5613
|
+
tmpoutlist.append(extrasizelen)
|
|
5614
|
+
tmpoutlist.append(extrafields)
|
|
5615
|
+
tmpoutlen = 8 + len(tmpoutlist) + len(xlist)
|
|
5450
5616
|
tmpoutlenhex = _hex_lower(tmpoutlen)
|
|
5451
5617
|
|
|
5452
5618
|
# Serialize the first group
|
|
5453
|
-
fnumfilesa = AppendNullBytes([tmpoutlenhex, fencoding, platform.system(), py_implementation, fnumfiles_hex], delimiter)
|
|
5619
|
+
fnumfilesa = AppendNullBytes([tmpoutlenhex, fencoding, platform.system(), py_implementation, __program_name__, fnumfiles_hex, "+"+str(len(formatspecs['format_delimiter']))], delimiter)
|
|
5454
5620
|
# Append tmpoutlist
|
|
5455
5621
|
fnumfilesa += AppendNullBytes(tmpoutlist, delimiter)
|
|
5456
5622
|
# Append extradata items if any
|
|
5457
5623
|
if xlist:
|
|
5458
5624
|
fnumfilesa += AppendNullBytes(xlist, delimiter)
|
|
5459
5625
|
# Append checksum type
|
|
5460
|
-
fnumfilesa += AppendNullByte(checksumtype, delimiter)
|
|
5626
|
+
fnumfilesa += AppendNullByte(checksumtype[0], delimiter)
|
|
5461
5627
|
|
|
5462
5628
|
# 5) inner checksum over fnumfilesa
|
|
5463
|
-
outfileheadercshex = GetFileChecksum(fnumfilesa, checksumtype, True, formatspecs)
|
|
5629
|
+
outfileheadercshex = GetFileChecksum(fnumfilesa, checksumtype[0], True, formatspecs)
|
|
5464
5630
|
tmpfileoutstr = fnumfilesa + AppendNullByte(outfileheadercshex, delimiter)
|
|
5465
5631
|
|
|
5466
5632
|
# 6) size of (tmpfileoutstr) excluding one delimiter, per your original math
|
|
@@ -5473,7 +5639,7 @@ def AppendFileHeader(fp,
|
|
|
5473
5639
|
+ fnumfilesa
|
|
5474
5640
|
)
|
|
5475
5641
|
|
|
5476
|
-
outfileheadercshex = GetFileChecksum(fnumfilesa, checksumtype, True, formatspecs)
|
|
5642
|
+
outfileheadercshex = GetFileChecksum(fnumfilesa, checksumtype[0], True, formatspecs)
|
|
5477
5643
|
fnumfilesa += AppendNullByte(outfileheadercshex, delimiter)
|
|
5478
5644
|
|
|
5479
5645
|
# 8) final total size field (again per your original logic)
|
|
@@ -5481,10 +5647,11 @@ def AppendFileHeader(fp,
|
|
|
5481
5647
|
formheaersizestr = AppendNullByte(formheaersize, delimiter) # computed but not appended in original
|
|
5482
5648
|
# Note: you computed 'formheaersizestr' but didn’t append it afterward in the original either.
|
|
5483
5649
|
# Keeping that behavior for compatibility.
|
|
5484
|
-
|
|
5650
|
+
nullstrecd = formatspecs['format_delimiter'].encode('UTF-8')
|
|
5651
|
+
outfileout = fnumfilesa + fjsoncontent + nullstrecd
|
|
5485
5652
|
# 9) write and try to sync
|
|
5486
5653
|
try:
|
|
5487
|
-
fp.write(
|
|
5654
|
+
fp.write(outfileout)
|
|
5488
5655
|
except (OSError, io.UnsupportedOperation):
|
|
5489
5656
|
return False
|
|
5490
5657
|
|
|
@@ -5505,21 +5672,21 @@ def AppendFileHeader(fp,
|
|
|
5505
5672
|
return fp
|
|
5506
5673
|
|
|
5507
5674
|
|
|
5508
|
-
def MakeEmptyFilePointer(fp, fmttype=__file_format_default__, checksumtype="md5", formatspecs=__file_format_multi_dict__):
|
|
5675
|
+
def MakeEmptyFilePointer(fp, fmttype=__file_format_default__, checksumtype=["md5", "md5"], formatspecs=__file_format_multi_dict__):
|
|
5509
5676
|
if(IsNestedDict(formatspecs) and fmttype in formatspecs):
|
|
5510
5677
|
formatspecs = formatspecs[fmttype]
|
|
5511
5678
|
elif(IsNestedDict(formatspecs) and fmttype not in formatspecs):
|
|
5512
5679
|
fmttype = __file_format_default__
|
|
5513
5680
|
formatspecs = formatspecs[fmttype]
|
|
5514
|
-
AppendFileHeader(fp, 0, "UTF-8", [], checksumtype, formatspecs)
|
|
5681
|
+
AppendFileHeader(fp, 0, "UTF-8", [], {}, checksumtype, formatspecs)
|
|
5515
5682
|
return fp
|
|
5516
5683
|
|
|
5517
5684
|
|
|
5518
|
-
def MakeEmptyCatFilePointer(fp, fmttype=__file_format_default__, checksumtype="md5", formatspecs=__file_format_multi_dict__):
|
|
5685
|
+
def MakeEmptyCatFilePointer(fp, fmttype=__file_format_default__, checksumtype=["md5", "md5"], formatspecs=__file_format_multi_dict__):
|
|
5519
5686
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
5520
5687
|
|
|
5521
5688
|
|
|
5522
|
-
def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="md5", formatspecs=__file_format_multi_dict__, returnfp=False):
|
|
5689
|
+
def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5"], formatspecs=__file_format_multi_dict__, returnfp=False):
|
|
5523
5690
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
5524
5691
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
5525
5692
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -5560,7 +5727,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
5560
5727
|
fp = CompressOpenFile(outfile, compresswholefile, compressionlevel)
|
|
5561
5728
|
except PermissionError:
|
|
5562
5729
|
return False
|
|
5563
|
-
AppendFileHeader(fp, 0, "UTF-8", [], checksumtype, formatspecs)
|
|
5730
|
+
AppendFileHeader(fp, 0, "UTF-8", [], {}, checksumtype, formatspecs)
|
|
5564
5731
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5565
5732
|
fp = CompressOpenFileAlt(
|
|
5566
5733
|
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
@@ -5591,7 +5758,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
5591
5758
|
return True
|
|
5592
5759
|
|
|
5593
5760
|
|
|
5594
|
-
def MakeEmptyCatFile(outfile, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="md5", formatspecs=__file_format_dict__, returnfp=False):
|
|
5761
|
+
def MakeEmptyCatFile(outfile, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5"], formatspecs=__file_format_dict__, returnfp=False):
|
|
5595
5762
|
return MakeEmptyFile(outfile, "auto", compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, formatspecs, returnfp)
|
|
5596
5763
|
|
|
5597
5764
|
|
|
@@ -5678,7 +5845,7 @@ def AppendFileHeaderWithContent(fp, filevalues=[], extradata=[], jsondata={}, fi
|
|
|
5678
5845
|
pass
|
|
5679
5846
|
return fp
|
|
5680
5847
|
|
|
5681
|
-
def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
5848
|
+
def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
5682
5849
|
if(not hasattr(fp, "write")):
|
|
5683
5850
|
return False
|
|
5684
5851
|
advancedlist = formatspecs['use_advanced_list']
|
|
@@ -5727,7 +5894,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
|
|
|
5727
5894
|
inodetoforminode = {}
|
|
5728
5895
|
numfiles = int(len(GetDirList))
|
|
5729
5896
|
fnumfiles = format(numfiles, 'x').lower()
|
|
5730
|
-
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
5897
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
|
|
5731
5898
|
try:
|
|
5732
5899
|
fp.flush()
|
|
5733
5900
|
if(hasattr(os, "sync")):
|
|
@@ -5984,7 +6151,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
|
|
|
5984
6151
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
5985
6152
|
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
|
|
5986
6153
|
AppendFileHeaderWithContent(
|
|
5987
|
-
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[
|
|
6154
|
+
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[2], checksumtype[3], checksumtype[4]], formatspecs)
|
|
5988
6155
|
try:
|
|
5989
6156
|
fp.flush()
|
|
5990
6157
|
if(hasattr(os, "sync")):
|
|
@@ -5993,7 +6160,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
|
|
|
5993
6160
|
pass
|
|
5994
6161
|
return fp
|
|
5995
6162
|
|
|
5996
|
-
def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6163
|
+
def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
5997
6164
|
if(not hasattr(fp, "write")):
|
|
5998
6165
|
return False
|
|
5999
6166
|
if(verbose):
|
|
@@ -6062,7 +6229,7 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
|
|
|
6062
6229
|
except FileNotFoundError:
|
|
6063
6230
|
return False
|
|
6064
6231
|
numfiles = int(len(tarfp.getmembers()))
|
|
6065
|
-
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
6232
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
|
|
6066
6233
|
try:
|
|
6067
6234
|
fp.flush()
|
|
6068
6235
|
if(hasattr(os, "sync")):
|
|
@@ -6206,7 +6373,7 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
|
|
|
6206
6373
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
6207
6374
|
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
|
|
6208
6375
|
AppendFileHeaderWithContent(
|
|
6209
|
-
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[
|
|
6376
|
+
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[2], checksumtype[3], checksumtype[4]], formatspecs)
|
|
6210
6377
|
try:
|
|
6211
6378
|
fp.flush()
|
|
6212
6379
|
if(hasattr(os, "sync")):
|
|
@@ -6216,7 +6383,7 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
|
|
|
6216
6383
|
fcontents.close()
|
|
6217
6384
|
return fp
|
|
6218
6385
|
|
|
6219
|
-
def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6386
|
+
def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6220
6387
|
if(not hasattr(fp, "write")):
|
|
6221
6388
|
return False
|
|
6222
6389
|
if(verbose):
|
|
@@ -6255,7 +6422,7 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
|
|
|
6255
6422
|
if(ziptest):
|
|
6256
6423
|
VerbosePrintOut("Bad file found!")
|
|
6257
6424
|
numfiles = int(len(zipfp.infolist()))
|
|
6258
|
-
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
6425
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
|
|
6259
6426
|
try:
|
|
6260
6427
|
fp.flush()
|
|
6261
6428
|
if(hasattr(os, "sync")):
|
|
@@ -6420,7 +6587,7 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
|
|
|
6420
6587
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
6421
6588
|
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
|
|
6422
6589
|
AppendFileHeaderWithContent(
|
|
6423
|
-
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[
|
|
6590
|
+
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[2], checksumtype[3], checksumtype[4]], formatspecs)
|
|
6424
6591
|
try:
|
|
6425
6592
|
fp.flush()
|
|
6426
6593
|
if(hasattr(os, "sync")):
|
|
@@ -6431,11 +6598,10 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
|
|
|
6431
6598
|
return fp
|
|
6432
6599
|
|
|
6433
6600
|
if(not rarfile_support):
|
|
6434
|
-
def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6601
|
+
def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6435
6602
|
return False
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6603
|
+
else:
|
|
6604
|
+
def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6439
6605
|
if(not hasattr(fp, "write")):
|
|
6440
6606
|
return False
|
|
6441
6607
|
if(verbose):
|
|
@@ -6456,7 +6622,7 @@ if(rarfile_support):
|
|
|
6456
6622
|
if(rartest):
|
|
6457
6623
|
VerbosePrintOut("Bad file found!")
|
|
6458
6624
|
numfiles = int(len(rarfp.infolist()))
|
|
6459
|
-
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
6625
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
|
|
6460
6626
|
try:
|
|
6461
6627
|
fp.flush()
|
|
6462
6628
|
if(hasattr(os, "sync")):
|
|
@@ -6654,7 +6820,7 @@ if(rarfile_support):
|
|
|
6654
6820
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
6655
6821
|
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
|
|
6656
6822
|
AppendFileHeaderWithContent(
|
|
6657
|
-
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[
|
|
6823
|
+
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[2], checksumtype[3], checksumtype[4]], formatspecs)
|
|
6658
6824
|
try:
|
|
6659
6825
|
fp.flush()
|
|
6660
6826
|
if(hasattr(os, "sync")):
|
|
@@ -6665,11 +6831,10 @@ if(rarfile_support):
|
|
|
6665
6831
|
return fp
|
|
6666
6832
|
|
|
6667
6833
|
if(not py7zr_support):
|
|
6668
|
-
def AppendFilesWithContentFromSevenZipFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6834
|
+
def AppendFilesWithContentFromSevenZipFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6669
6835
|
return False
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
def AppendFilesWithContentFromSevenZipFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6836
|
+
else:
|
|
6837
|
+
def AppendFilesWithContentFromSevenZipFile(infile, fp, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6673
6838
|
if(not hasattr(fp, "write")):
|
|
6674
6839
|
return False
|
|
6675
6840
|
if(verbose):
|
|
@@ -6692,7 +6857,7 @@ if(py7zr_support):
|
|
|
6692
6857
|
if(sztestalt):
|
|
6693
6858
|
VerbosePrintOut("Bad file found!")
|
|
6694
6859
|
numfiles = int(len(szpfp.list()))
|
|
6695
|
-
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
6860
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
|
|
6696
6861
|
try:
|
|
6697
6862
|
fp.flush()
|
|
6698
6863
|
if(hasattr(os, "sync")):
|
|
@@ -6828,7 +6993,7 @@ if(py7zr_support):
|
|
|
6828
6993
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
6829
6994
|
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+"+str(len(formatspecs['format_delimiter']))]
|
|
6830
6995
|
AppendFileHeaderWithContent(
|
|
6831
|
-
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[
|
|
6996
|
+
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[2], checksumtype[3], checksumtype[4]], formatspecs)
|
|
6832
6997
|
try:
|
|
6833
6998
|
fp.flush()
|
|
6834
6999
|
if(hasattr(os, "sync")):
|
|
@@ -6838,7 +7003,7 @@ if(py7zr_support):
|
|
|
6838
7003
|
fcontents.close()
|
|
6839
7004
|
return fp
|
|
6840
7005
|
|
|
6841
|
-
def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, followlink=False, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
7006
|
+
def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, extradata=[], jsondata={}, compression="auto", compresswholefile=True, compressionlevel=None, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False):
|
|
6842
7007
|
if(not hasattr(fp, "write")):
|
|
6843
7008
|
return False
|
|
6844
7009
|
if(verbose):
|
|
@@ -6854,7 +7019,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, extradata=[], jsond
|
|
|
6854
7019
|
inodetoforminode = {}
|
|
6855
7020
|
numfiles = int(len(GetDirList))
|
|
6856
7021
|
fnumfiles = format(numfiles, 'x').lower()
|
|
6857
|
-
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
7022
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], [checksumtype[0], checksumtype[1]], formatspecs)
|
|
6858
7023
|
for curfname in GetDirList:
|
|
6859
7024
|
ftype = format(curfname[0], 'x').lower()
|
|
6860
7025
|
fencoding = curfname[1]
|
|
@@ -6896,7 +7061,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, extradata=[], jsond
|
|
|
6896
7061
|
fuid, funame, fgid, fgname, fid, finode, flinkcount, fdev, fdev_minor, fdev_major, fseeknextfile]
|
|
6897
7062
|
fcontents.seek(0, 0)
|
|
6898
7063
|
AppendFileHeaderWithContent(
|
|
6899
|
-
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[
|
|
7064
|
+
fp, tmpoutlist, extradata, jsondata, fcontents.read(), [checksumtype[2], checksumtype[3], checksumtype[4]], formatspecs)
|
|
6900
7065
|
return fp
|
|
6901
7066
|
|
|
6902
7067
|
|
|
@@ -6905,7 +7070,7 @@ def AppendInFileWithContent(infile, fp, dirlistfromtxt=False, extradata=[], json
|
|
|
6905
7070
|
return AppendListsWithContent(inlist, fp, dirlistfromtxt, extradata, jsondata, followlink, checksumtype, formatspecs, verbose)
|
|
6906
7071
|
|
|
6907
7072
|
|
|
6908
|
-
def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, followlink=False, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7073
|
+
def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
6909
7074
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
6910
7075
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
6911
7076
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -6979,7 +7144,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
6979
7144
|
fp.close()
|
|
6980
7145
|
return True
|
|
6981
7146
|
|
|
6982
|
-
def AppendFilesWithContentToStackedOutFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, followlink=False, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7147
|
+
def AppendFilesWithContentToStackedOutFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
6983
7148
|
if not isinstance(infiles, list):
|
|
6984
7149
|
infiles = [infiles]
|
|
6985
7150
|
returnout = False
|
|
@@ -6994,7 +7159,7 @@ def AppendFilesWithContentToStackedOutFile(infiles, outfile, dirlistfromtxt=Fals
|
|
|
6994
7159
|
return True
|
|
6995
7160
|
return returnout
|
|
6996
7161
|
|
|
6997
|
-
def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, extradata=[], jsondata={}, followlink=False, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
7162
|
+
def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, extradata=[], jsondata={}, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
6998
7163
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
6999
7164
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
7000
7165
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -7066,7 +7231,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
7066
7231
|
fp.close()
|
|
7067
7232
|
return True
|
|
7068
7233
|
|
|
7069
|
-
def AppendFilesWithContentFromTarFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7234
|
+
def AppendFilesWithContentFromTarFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7070
7235
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
7071
7236
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
7072
7237
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -7139,7 +7304,7 @@ def AppendFilesWithContentFromTarFileToOutFile(infiles, outfile, fmttype="auto",
|
|
|
7139
7304
|
fp.close()
|
|
7140
7305
|
return True
|
|
7141
7306
|
|
|
7142
|
-
def AppendFilesWithContentFromTarFileToStackedOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7307
|
+
def AppendFilesWithContentFromTarFileToStackedOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7143
7308
|
if not isinstance(infiles, list):
|
|
7144
7309
|
infiles = [infiles]
|
|
7145
7310
|
returnout = False
|
|
@@ -7154,7 +7319,7 @@ def AppendFilesWithContentFromTarFileToStackedOutFile(infiles, outfile, fmttype=
|
|
|
7154
7319
|
return True
|
|
7155
7320
|
return returnout
|
|
7156
7321
|
|
|
7157
|
-
def AppendFilesWithContentFromZipFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7322
|
+
def AppendFilesWithContentFromZipFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7158
7323
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
7159
7324
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
7160
7325
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -7227,7 +7392,7 @@ def AppendFilesWithContentFromZipFileToOutFile(infiles, outfile, fmttype="auto",
|
|
|
7227
7392
|
fp.close()
|
|
7228
7393
|
return True
|
|
7229
7394
|
|
|
7230
|
-
def AppendFilesWithContentFromZipFileToStackedOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7395
|
+
def AppendFilesWithContentFromZipFileToStackedOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7231
7396
|
if not isinstance(infiles, list):
|
|
7232
7397
|
infiles = [infiles]
|
|
7233
7398
|
returnout = False
|
|
@@ -7243,11 +7408,10 @@ def AppendFilesWithContentFromZipFileToStackedOutFile(infiles, outfile, fmttype=
|
|
|
7243
7408
|
return returnout
|
|
7244
7409
|
|
|
7245
7410
|
if(not rarfile_support):
|
|
7246
|
-
def AppendFilesWithContentFromRarFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7411
|
+
def AppendFilesWithContentFromRarFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7247
7412
|
return False
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
def AppendFilesWithContentFromRarFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7413
|
+
else:
|
|
7414
|
+
def AppendFilesWithContentFromRarFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7251
7415
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
7252
7416
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
7253
7417
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -7320,7 +7484,7 @@ if(rarfile_support):
|
|
|
7320
7484
|
fp.close()
|
|
7321
7485
|
return True
|
|
7322
7486
|
|
|
7323
|
-
def AppendFilesWithContentFromRarFileToStackedOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7487
|
+
def AppendFilesWithContentFromRarFileToStackedOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7324
7488
|
if not isinstance(infiles, list):
|
|
7325
7489
|
infiles = [infiles]
|
|
7326
7490
|
returnout = False
|
|
@@ -7336,11 +7500,10 @@ def AppendFilesWithContentFromRarFileToStackedOutFile(infiles, outfile, fmttype=
|
|
|
7336
7500
|
return returnout
|
|
7337
7501
|
|
|
7338
7502
|
if(not py7zr_support):
|
|
7339
|
-
def AppendFilesWithContentFromSevenZipFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7503
|
+
def AppendFilesWithContentFromSevenZipFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7340
7504
|
return False
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
def AppendFilesWithContentFromSevenZipFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7505
|
+
else:
|
|
7506
|
+
def AppendFilesWithContentFromSevenZipFileToOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7344
7507
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
7345
7508
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
7346
7509
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -7413,7 +7576,7 @@ if(py7zr_support):
|
|
|
7413
7576
|
fp.close()
|
|
7414
7577
|
return True
|
|
7415
7578
|
|
|
7416
|
-
def AppendFilesWithContentFromSevenZipFileToStackedOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7579
|
+
def AppendFilesWithContentFromSevenZipFileToStackedOutFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, extradata=[], jsondata={}, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
7417
7580
|
if not isinstance(infiles, list):
|
|
7418
7581
|
infiles = [infiles]
|
|
7419
7582
|
returnout = False
|
|
@@ -7428,7 +7591,7 @@ def AppendFilesWithContentFromSevenZipFileToStackedOutFile(infiles, outfile, fmt
|
|
|
7428
7591
|
return True
|
|
7429
7592
|
return returnout
|
|
7430
7593
|
|
|
7431
|
-
def AppendInFileWithContentToOutFile(infile, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, extradata=[], jsondata={}, followlink=False, checksumtype=["md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
7594
|
+
def AppendInFileWithContentToOutFile(infile, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, extradata=[], jsondata={}, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
7432
7595
|
inlist = ReadInFileWithContentToList(infile, "auto", 0, 0, False, False, True, False, formatspecs)
|
|
7433
7596
|
return AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt, fmttype, compression, compresswholefile, compressionlevel, extradata, jsondata, followlink, checksumtype, formatspecs, verbose, returnfp)
|
|
7434
7597
|
|
|
@@ -9171,43 +9334,41 @@ def CheckSumSupport(checkfor, guaranteed=True):
|
|
|
9171
9334
|
return False
|
|
9172
9335
|
|
|
9173
9336
|
|
|
9174
|
-
def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, checksumtype=["md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
9337
|
+
def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
9175
9338
|
return AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, extradata, jsondata, followlink, checksumtype, formatspecs, verbose, returnfp)
|
|
9176
9339
|
|
|
9177
|
-
def PackStackedCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, checksumtype=["md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
9340
|
+
def PackStackedCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_multi_dict__, verbose=False, returnfp=False):
|
|
9178
9341
|
return AppendFilesWithContentToStackedOutFile(infiles, outfile, dirlistfromtxt, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, extradata, jsondata, followlink, checksumtype, formatspecs, verbose, returnfp)
|
|
9179
9342
|
|
|
9180
|
-
def PackCatFileFromDirList(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, checksumtype=["md5", "md5", "md5"], extradata=[], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9343
|
+
def PackCatFileFromDirList(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9181
9344
|
return PackCatFile(infiles, outfile, dirlistfromtxt, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, followlink, checksumtype, extradata, formatspecs, verbose, returnfp)
|
|
9182
9345
|
|
|
9183
9346
|
|
|
9184
|
-
def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9347
|
+
def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9185
9348
|
return AppendFilesWithContentFromTarFileToOutFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, extradata, jsondata, checksumtype, formatspecs, verbose, returnfp)
|
|
9186
9349
|
|
|
9187
9350
|
|
|
9188
|
-
def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9351
|
+
def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9189
9352
|
return AppendFilesWithContentFromZipFileToOutFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, extradata, jsondata, checksumtype, formatspecs, verbose, returnfp)
|
|
9190
9353
|
|
|
9191
9354
|
|
|
9192
9355
|
if(not rarfile_support):
|
|
9193
|
-
def PackCatFileFromRarFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9356
|
+
def PackCatFileFromRarFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9194
9357
|
return False
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
def PackCatFileFromRarFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9358
|
+
else:
|
|
9359
|
+
def PackCatFileFromRarFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9198
9360
|
return AppendFilesWithContentFromRarFileToOutFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, extradata, jsondata, checksumtype, formatspecs, verbose, returnfp)
|
|
9199
9361
|
|
|
9200
9362
|
|
|
9201
9363
|
if(not py7zr_support):
|
|
9202
|
-
def PackCatFileFromSevenZipFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5"], extradata=[], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9364
|
+
def PackCatFileFromSevenZipFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9203
9365
|
return False
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
def PackCatFileFromSevenZipFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9366
|
+
else:
|
|
9367
|
+
def PackCatFileFromSevenZipFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9207
9368
|
return AppendFilesWithContentFromSevenZipFileToOutFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, extradata, jsondata, checksumtype, formatspecs, verbose, returnfp)
|
|
9208
9369
|
|
|
9209
9370
|
|
|
9210
|
-
def PackCatFileFromInFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9371
|
+
def PackCatFileFromInFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, verbose=False, returnfp=False):
|
|
9211
9372
|
checkcompressfile = CheckCompressionSubType(infile, formatspecs, 0, True)
|
|
9212
9373
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
9213
9374
|
formatspecs = formatspecs[checkcompressfile]
|
|
@@ -9429,19 +9590,57 @@ def CatFileValidate(infile, fmttype="auto", filestart=0,
|
|
|
9429
9590
|
else:
|
|
9430
9591
|
inheader = ReadFileHeaderDataWoSize(fp, formatspecs['format_delimiter'])
|
|
9431
9592
|
|
|
9432
|
-
fnumextrafieldsize = int(inheader[
|
|
9433
|
-
fnumextrafields = int(inheader[
|
|
9434
|
-
extrastart =
|
|
9593
|
+
fnumextrafieldsize = int(inheader[13], 16)
|
|
9594
|
+
fnumextrafields = int(inheader[14], 16)
|
|
9595
|
+
extrastart = 15
|
|
9435
9596
|
extraend = extrastart + fnumextrafields
|
|
9436
9597
|
formversion = re.findall("([\\d]+)", formstring)
|
|
9437
9598
|
fheadsize = int(inheader[0], 16)
|
|
9438
9599
|
fnumfields = int(inheader[1], 16)
|
|
9439
|
-
|
|
9440
|
-
fostype = inheader[3]
|
|
9441
|
-
fpythontype = inheader[4]
|
|
9442
|
-
fnumfiles = int(inheader[5], 16)
|
|
9600
|
+
fnumfiles = int(inheader[6], 16)
|
|
9443
9601
|
fprechecksumtype = inheader[-2]
|
|
9444
9602
|
fprechecksum = inheader[-1]
|
|
9603
|
+
outfseeknextfile = inheader[7]
|
|
9604
|
+
fjsonsize = int(inheader[10], 16)
|
|
9605
|
+
fjsonchecksumtype = inheader[11]
|
|
9606
|
+
fjsonchecksum = inheader[12]
|
|
9607
|
+
fprejsoncontent = fp.read(fjsonsize)
|
|
9608
|
+
jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs)
|
|
9609
|
+
if(fjsonsize > 0):
|
|
9610
|
+
if(hmac.compare_digest(jsonfcs, fjsonchecksum)):
|
|
9611
|
+
if(verbose):
|
|
9612
|
+
VerbosePrintOut("File JSON Data Checksum Passed at offset " + str(outfjstart))
|
|
9613
|
+
VerbosePrintOut("'" + outfjsonchecksum + "' == " + "'" + injsonfcs + "'")
|
|
9614
|
+
else:
|
|
9615
|
+
valid_archive = False
|
|
9616
|
+
invalid_archive = True
|
|
9617
|
+
if(verbose):
|
|
9618
|
+
VerbosePrintOut("File JSON Data Checksum Error at offset " + str(outfjstart))
|
|
9619
|
+
VerbosePrintOut("'" + outfjsonchecksum + "' != " + "'" + injsonfcs + "'")
|
|
9620
|
+
if(not hmac.compare_digest(fjsonchecksum, jsonfcs) and not skipchecksum):
|
|
9621
|
+
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
9622
|
+
fname + " at offset " + str(fheaderstart))
|
|
9623
|
+
VerbosePrintOut("'" + fjsonchecksum + "' != " + "'" + jsonfcs + "'")
|
|
9624
|
+
return False
|
|
9625
|
+
# Next seek directive
|
|
9626
|
+
if(re.findall(r"^\+([0-9]+)", outfseeknextfile)):
|
|
9627
|
+
fseeknextasnum = int(outfseeknextfile.replace("+", ""))
|
|
9628
|
+
if(abs(fseeknextasnum) == 0):
|
|
9629
|
+
pass
|
|
9630
|
+
fp.seek(fseeknextasnum, 1)
|
|
9631
|
+
elif(re.findall(r"^\-([0-9]+)", outfseeknextfile)):
|
|
9632
|
+
fseeknextasnum = int(outfseeknextfile)
|
|
9633
|
+
if(abs(fseeknextasnum) == 0):
|
|
9634
|
+
pass
|
|
9635
|
+
fp.seek(fseeknextasnum, 1)
|
|
9636
|
+
elif(re.findall(r"^([0-9]+)", outfseeknextfile)):
|
|
9637
|
+
fseeknextasnum = int(outfseeknextfile)
|
|
9638
|
+
if(abs(fseeknextasnum) == 0):
|
|
9639
|
+
pass
|
|
9640
|
+
fp.seek(fseeknextasnum, 0)
|
|
9641
|
+
else:
|
|
9642
|
+
return False
|
|
9643
|
+
|
|
9445
9644
|
il = 0
|
|
9446
9645
|
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
|
|
9447
9646
|
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs)
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
pycatfile.py,sha256=krIDu7gOV2ActVZAE3o53EGCpU7cNV25XLJOvxubNMI,582737
|
|
2
|
-
pycatfile-0.25.0.data/scripts/catfile.py,sha256=wtp30h9b2kuoIxTZb3Mpt4IwraNPD3r0epsdHrTHtyY,13984
|
|
3
|
-
pycatfile-0.25.0.data/scripts/catneofile.py,sha256=b0sJBb-o6Rx5TO_dqXnJz3fCf-yPbEul1_6uX2CRS0Q,5128
|
|
4
|
-
pycatfile-0.25.0.data/scripts/neocatfile.py,sha256=YefEZZAnFwJ63xy2zDnvvs99BOyrHVhT1cPH4TnzrQs,7149
|
|
5
|
-
pycatfile-0.25.0.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
|
|
6
|
-
pycatfile-0.25.0.dist-info/METADATA,sha256=K1Fym6En9HvE1Z9dYT9jMCR0MbWOQzOG_OLC7C3Xquo,954
|
|
7
|
-
pycatfile-0.25.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
-
pycatfile-0.25.0.dist-info/top_level.txt,sha256=ZnSwEHU_60RLIvmFhsATaAaEYjErDQgUymWwoXZ724c,10
|
|
9
|
-
pycatfile-0.25.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
10
|
-
pycatfile-0.25.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|