PyCatFile 0.14.10__tar.gz → 0.14.14__tar.gz
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.14.10 → pycatfile-0.14.14}/PKG-INFO +1 -1
- {pycatfile-0.14.10 → pycatfile-0.14.14}/PyCatFile.egg-info/PKG-INFO +1 -1
- {pycatfile-0.14.10 → pycatfile-0.14.14}/pycatfile.py +157 -202
- {pycatfile-0.14.10 → pycatfile-0.14.14}/LICENSE +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/PyCatFile.egg-info/SOURCES.txt +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/PyCatFile.egg-info/dependency_links.txt +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/PyCatFile.egg-info/top_level.txt +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/PyCatFile.egg-info/zip-safe +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/README.md +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/catfile.py +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/neocatfile.py +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/setup.cfg +0 -0
- {pycatfile-0.14.10 → pycatfile-0.14.14}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.14
|
|
4
4
|
Summary: A tar like file format name catfile after unix cat command (concatenate files) .
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyCatFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyCatFile/archive/master.tar.gz
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.14
|
|
4
4
|
Summary: A tar like file format name catfile after unix cat command (concatenate files) .
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyCatFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyCatFile/archive/master.tar.gz
|
|
@@ -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:
|
|
17
|
+
$FileInfo: pycatfile.py - Last Update: 12/3/2024 Ver. 0.14.14 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
|
|
@@ -25,6 +25,7 @@ import sys
|
|
|
25
25
|
import time
|
|
26
26
|
import stat
|
|
27
27
|
import zlib
|
|
28
|
+
import codecs
|
|
28
29
|
import base64
|
|
29
30
|
import shutil
|
|
30
31
|
import socket
|
|
@@ -63,6 +64,13 @@ except ImportError:
|
|
|
63
64
|
except ImportError:
|
|
64
65
|
import ConfigParser as configparser
|
|
65
66
|
|
|
67
|
+
try:
|
|
68
|
+
file
|
|
69
|
+
except NameError:
|
|
70
|
+
from io import IOBase
|
|
71
|
+
file = IOBase
|
|
72
|
+
#if isinstance(outfile, file) or isinstance(outfile, IOBase):
|
|
73
|
+
|
|
66
74
|
try:
|
|
67
75
|
basestring
|
|
68
76
|
except NameError:
|
|
@@ -85,7 +93,6 @@ except ImportError:
|
|
|
85
93
|
# Windows-specific setup
|
|
86
94
|
if os.name == 'nt':
|
|
87
95
|
if sys.version_info[0] == 2:
|
|
88
|
-
import codecs
|
|
89
96
|
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
|
|
90
97
|
sys.stderr = codecs.getwriter('utf-8')(sys.stderr)
|
|
91
98
|
else:
|
|
@@ -97,7 +104,6 @@ if os.name == 'nt':
|
|
|
97
104
|
hashlib_guaranteed = False
|
|
98
105
|
# Environment setup
|
|
99
106
|
os.environ["PYTHONIOENCODING"] = "UTF-8"
|
|
100
|
-
os.environ["LC_CTYPE"] = "UTF-8"
|
|
101
107
|
|
|
102
108
|
# Reload sys to set default encoding to UTF-8 (Python 2 only)
|
|
103
109
|
if sys.version_info[0] == 2:
|
|
@@ -240,24 +246,25 @@ if(__use_http_lib__ == "requests" and havehttpx and not haverequests):
|
|
|
240
246
|
if((__use_http_lib__ == "httpx" or __use_http_lib__ == "requests") and not havehttpx and not haverequests):
|
|
241
247
|
__use_http_lib__ = "urllib"
|
|
242
248
|
if os.path.exists(__config_file__) and __use_ini_file__:
|
|
243
|
-
# Create a ConfigParser object
|
|
244
249
|
config = configparser.ConfigParser()
|
|
245
|
-
# Read the configuration file
|
|
246
250
|
config.read(__config_file__)
|
|
247
|
-
|
|
251
|
+
def decode_unicode_escape(value):
|
|
252
|
+
if sys.version_info[0] < 3: # Python 2
|
|
253
|
+
return value.decode('unicode_escape')
|
|
254
|
+
else: # Python 3
|
|
255
|
+
return bytes(value, 'utf-8').decode('unicode_escape')
|
|
248
256
|
__file_format_name__ = config.get('main', 'name')
|
|
249
257
|
__program_name__ = config.get('main', 'proname')
|
|
250
258
|
__file_format_lower__ = config.get('main', 'lower')
|
|
251
|
-
__file_format_magic__ = config.get('main', 'magic')
|
|
252
|
-
__file_format_len__ = config.getint('main', 'len')
|
|
259
|
+
__file_format_magic__ = decode_unicode_escape(config.get('main', 'magic'))
|
|
260
|
+
__file_format_len__ = config.getint('main', 'len')
|
|
253
261
|
__file_format_hex__ = config.get('main', 'hex')
|
|
254
|
-
__file_format_delimiter__ = config.get('main', 'delimiter')
|
|
262
|
+
__file_format_delimiter__ = decode_unicode_escape(config.get('main', 'delimiter'))
|
|
255
263
|
__file_format_ver__ = config.get('main', 'ver')
|
|
256
264
|
__use_new_style__ = config.getboolean('main', 'newstyle')
|
|
257
265
|
__use_advanced_list__ = config.getboolean('main', 'advancedlist')
|
|
258
266
|
__use_alt_inode__ = config.getboolean('main', 'altinode')
|
|
259
267
|
__file_format_extension__ = config.get('main', 'extension')
|
|
260
|
-
|
|
261
268
|
else:
|
|
262
269
|
if not __use_alt_format__:
|
|
263
270
|
# Format Info by Kazuki Przyborowski
|
|
@@ -296,12 +303,12 @@ __file_format_dict__ = {'format_name': __file_format_name__, 'format_magic': __f
|
|
|
296
303
|
'format_delimiter': __file_format_delimiter__, 'format_ver': __file_format_ver__, 'new_style': __use_new_style__, 'use_advanced_list': __use_advanced_list__, 'use_alt_inode': __use_alt_inode__}
|
|
297
304
|
__project__ = __program_name__
|
|
298
305
|
__project_url__ = "https://github.com/GameMaker2k/PyCatFile"
|
|
299
|
-
__version_info__ = (0, 14,
|
|
300
|
-
__version_date_info__ = (2024,
|
|
306
|
+
__version_info__ = (0, 14, 14, "RC 1", 1)
|
|
307
|
+
__version_date_info__ = (2024, 12, 3, "RC 1", 1)
|
|
301
308
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
302
309
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
303
310
|
__revision__ = __version_info__[3]
|
|
304
|
-
__revision_id__ = "$Id:
|
|
311
|
+
__revision_id__ = "$Id: 3ddc69234c08a55463f598d89770c82c7cdf2f9b $"
|
|
305
312
|
if(__version_info__[4] is not None):
|
|
306
313
|
__version_date_plusrc__ = __version_date__ + \
|
|
307
314
|
"-" + str(__version_date_info__[4])
|
|
@@ -573,8 +580,8 @@ def ListDir(dirpath, followlink=False, duplicates=False):
|
|
|
573
580
|
retlist.append(dpath)
|
|
574
581
|
if duplicates:
|
|
575
582
|
retlist.append(dpath)
|
|
576
|
-
for
|
|
577
|
-
fpath = os.path.join(root,
|
|
583
|
+
for files in filenames:
|
|
584
|
+
fpath = os.path.join(root, files)
|
|
578
585
|
fpath = RemoveWindowsPath(fpath)
|
|
579
586
|
if fs_encoding != 'utf-8':
|
|
580
587
|
fpath = fpath.encode(fs_encoding).decode('utf-8')
|
|
@@ -615,8 +622,8 @@ def ListDirAdvanced(dirpath, followlink=False, duplicates=False):
|
|
|
615
622
|
retlist.append(dpath)
|
|
616
623
|
elif duplicates:
|
|
617
624
|
retlist.append(dpath)
|
|
618
|
-
for
|
|
619
|
-
fpath = os.path.join(root,
|
|
625
|
+
for files in filenames:
|
|
626
|
+
fpath = os.path.join(root, files)
|
|
620
627
|
fpath = RemoveWindowsPath(fpath)
|
|
621
628
|
if fs_encoding != 'utf-8':
|
|
622
629
|
fpath = fpath.encode(fs_encoding).decode('utf-8')
|
|
@@ -1701,15 +1708,14 @@ def ReadFileHeaderDataBySizeWithContentToArray(fp, listonly=False, contentasfile
|
|
|
1701
1708
|
fid = int(HeaderOut[18], 16)
|
|
1702
1709
|
finode = int(HeaderOut[19], 16)
|
|
1703
1710
|
flinkcount = int(HeaderOut[20], 16)
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
fextrafields = int(HeaderOut[27], 16)
|
|
1711
|
+
fdev = int(HeaderOut[21], 16)
|
|
1712
|
+
fdev_minor = int(HeaderOut[22], 16)
|
|
1713
|
+
fdev_major = int(HeaderOut[23], 16)
|
|
1714
|
+
fseeknextfile = HeaderOut[24]
|
|
1715
|
+
fextrasize = int(HeaderOut[25], 16)
|
|
1716
|
+
fextrafields = int(HeaderOut[26], 16)
|
|
1711
1717
|
extrafieldslist = []
|
|
1712
|
-
extrastart =
|
|
1718
|
+
extrastart = 27
|
|
1713
1719
|
extraend = extrastart + fextrafields
|
|
1714
1720
|
extrafieldslist = []
|
|
1715
1721
|
if(extrastart < extraend):
|
|
@@ -1778,8 +1784,8 @@ def ReadFileHeaderDataBySizeWithContentToArray(fp, listonly=False, contentasfile
|
|
|
1778
1784
|
fcontents.seek(0, 0)
|
|
1779
1785
|
if(not contentasfile):
|
|
1780
1786
|
fcontents = fcontents.read()
|
|
1781
|
-
catlist = {'fheadersize': fheadsize, 'fhstart': fheaderstart, 'fhend': fhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
1782
|
-
'
|
|
1787
|
+
catlist = {'fheadersize': fheadsize, 'fhstart': fheaderstart, 'fhend': fhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
1788
|
+
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': fseeknextfile, 'fheaderchecksumtype': HeaderOut[-4], 'fcontentchecksumtype': HeaderOut[-3], 'fnumfields': fnumfields + 2, 'frawheader': HeaderOut, 'fextrafields': fextrafields, 'fextrafieldsize': fextrasize, 'fextralist': extrafieldslist, 'fheaderchecksum': fcs, 'fcontentchecksum': fccs, 'fhascontents': pyhascontents, 'fcontentstart': fcontentstart, 'fcontentend': fcontentend, 'fcontentasfile': contentasfile, 'fcontents': fcontents}
|
|
1783
1789
|
return catlist
|
|
1784
1790
|
|
|
1785
1791
|
|
|
@@ -1820,15 +1826,14 @@ def ReadFileHeaderDataBySizeWithContentToList(fp, listonly=False, uncompress=Tru
|
|
|
1820
1826
|
fid = int(HeaderOut[18], 16)
|
|
1821
1827
|
finode = int(HeaderOut[19], 16)
|
|
1822
1828
|
flinkcount = int(HeaderOut[20], 16)
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
fextrafields = int(HeaderOut[27], 16)
|
|
1829
|
+
fdev = int(HeaderOut[21], 16)
|
|
1830
|
+
fdev_minor = int(HeaderOut[22], 16)
|
|
1831
|
+
fdev_major = int(HeaderOut[23], 16)
|
|
1832
|
+
fseeknextfile = HeaderOut[24]
|
|
1833
|
+
fextrasize = int(HeaderOut[25], 16)
|
|
1834
|
+
fextrafields = int(HeaderOut[26], 16)
|
|
1830
1835
|
extrafieldslist = []
|
|
1831
|
-
extrastart =
|
|
1836
|
+
extrastart = 27
|
|
1832
1837
|
extraend = extrastart + fextrafields
|
|
1833
1838
|
extrafieldslist = []
|
|
1834
1839
|
if(extrastart < extraend):
|
|
@@ -1895,7 +1900,7 @@ def ReadFileHeaderDataBySizeWithContentToList(fp, listonly=False, uncompress=Tru
|
|
|
1895
1900
|
else:
|
|
1896
1901
|
return False
|
|
1897
1902
|
catlist = [ftype, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression, fcsize, fuid, funame, fgid, fgname, fid,
|
|
1898
|
-
finode, flinkcount, fdev_minor, fdev_major,
|
|
1903
|
+
finode, flinkcount, fdev, fdev_minor, fdev_major, fseeknextfile, extrafieldslist, fheaderchecksumtype, fcontentchecksumtype, fcontents]
|
|
1899
1904
|
return catlist
|
|
1900
1905
|
|
|
1901
1906
|
|
|
@@ -1905,19 +1910,19 @@ def ReadFileDataBySizeWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
1905
1910
|
curloc = fp.tell()
|
|
1906
1911
|
if(curloc > 0):
|
|
1907
1912
|
fp.seek(0, 0)
|
|
1908
|
-
catheader = ReadFileHeaderData(fp,
|
|
1913
|
+
catheader = ReadFileHeaderData(fp, 5, delimiter)
|
|
1909
1914
|
if(curloc > 0):
|
|
1910
1915
|
fp.seek(curloc, 0)
|
|
1911
1916
|
headercheck = ValidateHeaderChecksum(
|
|
1912
|
-
catheader[:-1], catheader[
|
|
1913
|
-
newfcs = GetHeaderChecksum(catheader[:-2], catheader[
|
|
1917
|
+
catheader[:-1], catheader[3], catheader[4], formatspecs)
|
|
1918
|
+
newfcs = GetHeaderChecksum(catheader[:-2], catheader[3], True, formatspecs)
|
|
1914
1919
|
if(not headercheck and not skipchecksum):
|
|
1915
1920
|
VerbosePrintOut(
|
|
1916
1921
|
"File Header Checksum Error with file at offset " + str(0))
|
|
1917
1922
|
VerbosePrintOut("'" + str(newfcs) + "' != " +
|
|
1918
|
-
"'" + str(catheader[
|
|
1923
|
+
"'" + str(catheader[4]) + "'")
|
|
1919
1924
|
return False
|
|
1920
|
-
fnumfiles = int(catheader[
|
|
1925
|
+
fnumfiles = int(catheader[2], 16)
|
|
1921
1926
|
countnum = 0
|
|
1922
1927
|
flist = []
|
|
1923
1928
|
while(countnum < fnumfiles):
|
|
@@ -1936,25 +1941,25 @@ def ReadFileDataBySizeWithContentToArray(fp, seekstart=0, seekend=0, listonly=Fa
|
|
|
1936
1941
|
curloc = fp.tell()
|
|
1937
1942
|
if(curloc > 0):
|
|
1938
1943
|
fp.seek(0, 0)
|
|
1939
|
-
catheader = ReadFileHeaderData(fp,
|
|
1944
|
+
catheader = ReadFileHeaderData(fp, 5, delimiter)
|
|
1940
1945
|
if(curloc > 0):
|
|
1941
1946
|
fp.seek(curloc, 0)
|
|
1942
1947
|
headercheck = ValidateHeaderChecksum(
|
|
1943
|
-
catheader[:-1], catheader[
|
|
1944
|
-
newfcs = GetHeaderChecksum(catheader[:-2], catheader[
|
|
1948
|
+
catheader[:-1], catheader[3], catheader[4], formatspecs)
|
|
1949
|
+
newfcs = GetHeaderChecksum(catheader[:-2], catheader[3], True, formatspecs)
|
|
1945
1950
|
if(not headercheck and not skipchecksum):
|
|
1946
1951
|
VerbosePrintOut(
|
|
1947
1952
|
"File Header Checksum Error with file at offset " + str(0))
|
|
1948
1953
|
VerbosePrintOut("'" + str(newfcs) + "' != " +
|
|
1949
|
-
"'" + str(catheader[
|
|
1954
|
+
"'" + str(catheader[4]) + "'")
|
|
1950
1955
|
return False
|
|
1951
1956
|
catstring = catheader[0]
|
|
1952
1957
|
catversion = re.findall("([\\d]+)", catstring)
|
|
1953
1958
|
catversions = re.search('(.*?)(\\d+)', catstring).groups()
|
|
1954
|
-
fprenumfiles = catheader[
|
|
1959
|
+
fprenumfiles = catheader[2]
|
|
1955
1960
|
fnumfiles = int(fprenumfiles, 16)
|
|
1956
|
-
fprechecksumtype = catheader[
|
|
1957
|
-
fprechecksum = catheader[
|
|
1961
|
+
fprechecksumtype = catheader[3]
|
|
1962
|
+
fprechecksum = catheader[4]
|
|
1958
1963
|
catlist = {'fnumfiles': fnumfiles, 'fformat': catversions[0], 'fversion': catversions[1],
|
|
1959
1964
|
'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'ffilelist': []}
|
|
1960
1965
|
if(seekstart < 0 and seekstart > fnumfiles):
|
|
@@ -2039,25 +2044,25 @@ def ReadFileDataBySizeWithContentToList(fp, seekstart=0, seekend=0, listonly=Fal
|
|
|
2039
2044
|
curloc = fp.tell()
|
|
2040
2045
|
if(curloc > 0):
|
|
2041
2046
|
fp.seek(0, 0)
|
|
2042
|
-
catheader = ReadFileHeaderData(fp,
|
|
2047
|
+
catheader = ReadFileHeaderData(fp, 5, delimiter)
|
|
2043
2048
|
if(curloc > 0):
|
|
2044
2049
|
fp.seek(curloc, 0)
|
|
2045
2050
|
headercheck = ValidateHeaderChecksum(
|
|
2046
|
-
catheader[:-1], catheader[
|
|
2047
|
-
newfcs = GetHeaderChecksum(catheader[:-2], catheader[
|
|
2051
|
+
catheader[:-1], catheader[3], catheader[4], formatspecs)
|
|
2052
|
+
newfcs = GetHeaderChecksum(catheader[:-2], catheader[3], True, formatspecs)
|
|
2048
2053
|
if(not headercheck and not skipchecksum):
|
|
2049
2054
|
VerbosePrintOut(
|
|
2050
2055
|
"File Header Checksum Error with file at offset " + str(0))
|
|
2051
2056
|
VerbosePrintOut("'" + str(newfcs) + "' != " +
|
|
2052
|
-
"'" + str(catheader[
|
|
2057
|
+
"'" + str(catheader[4]) + "'")
|
|
2053
2058
|
return False
|
|
2054
2059
|
catstring = catheader[0]
|
|
2055
2060
|
catversion = re.findall("([\\d]+)", catstring)
|
|
2056
2061
|
catversions = re.search('(.*?)(\\d+)', catstring).groups()
|
|
2057
2062
|
fprenumfiles = catheader[1]
|
|
2058
2063
|
fnumfiles = int(fprenumfiles, 16)
|
|
2059
|
-
fprechecksumtype = catheader[
|
|
2060
|
-
fprechecksum = catheader[
|
|
2064
|
+
fprechecksumtype = catheader[3]
|
|
2065
|
+
fprechecksum = catheader[4]
|
|
2061
2066
|
catlist = []
|
|
2062
2067
|
if(seekstart < 0 and seekstart > fnumfiles):
|
|
2063
2068
|
seekstart = 0
|
|
@@ -2289,7 +2294,7 @@ def AppendFileHeader(fp, numfiles, checksumtype="crc32", formatspecs=__file_form
|
|
|
2289
2294
|
fp.write(fileheader.encode('UTF-8'))
|
|
2290
2295
|
fnumfiles = format(int(numfiles), 'x').lower()
|
|
2291
2296
|
fnumfilesa = AppendNullBytes(
|
|
2292
|
-
[fnumfiles, checksumtype], formatspecs['format_delimiter'])
|
|
2297
|
+
[platform.system(), fnumfiles, checksumtype], formatspecs['format_delimiter'])
|
|
2293
2298
|
catfileheadercshex = GetFileChecksum(
|
|
2294
2299
|
fileheader + fnumfilesa, checksumtype, True, formatspecs)
|
|
2295
2300
|
fnumfilesa = fnumfilesa + \
|
|
@@ -2532,14 +2537,6 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
2532
2537
|
getfdev = GetDevMajorMinor(fdev)
|
|
2533
2538
|
fdev_minor = getfdev[0]
|
|
2534
2539
|
fdev_major = getfdev[1]
|
|
2535
|
-
frdev = fstatinfo.st_dev
|
|
2536
|
-
if(hasattr(fstatinfo, "st_rdev")):
|
|
2537
|
-
frdev = fstatinfo.st_rdev
|
|
2538
|
-
else:
|
|
2539
|
-
frdev = fstatinfo.st_dev
|
|
2540
|
-
getfrdev = GetDevMajorMinor(frdev)
|
|
2541
|
-
frdev_minor = getfrdev[0]
|
|
2542
|
-
frdev_major = getfrdev[1]
|
|
2543
2540
|
if(ftype == 1 or ftype == 2 or ftype == 3 or ftype == 4 or ftype == 5 or ftype == 6):
|
|
2544
2541
|
fsize = format(int("0"), 'x').lower()
|
|
2545
2542
|
elif(ftype == 0 or ftype == 7):
|
|
@@ -2578,10 +2575,9 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
2578
2575
|
fgname = ""
|
|
2579
2576
|
except ImportError:
|
|
2580
2577
|
fgname = ""
|
|
2578
|
+
fdev = format(int(fdev), 'x').lower()
|
|
2581
2579
|
fdev_minor = format(int(fdev_minor), 'x').lower()
|
|
2582
2580
|
fdev_major = format(int(fdev_major), 'x').lower()
|
|
2583
|
-
frdev_minor = format(int(frdev_minor), 'x').lower()
|
|
2584
|
-
frdev_major = format(int(frdev_major), 'x').lower()
|
|
2585
2581
|
finode = format(int(finode), 'x').lower()
|
|
2586
2582
|
flinkcount = format(int(flinkcount), 'x').lower()
|
|
2587
2583
|
if(hasattr(fstatinfo, "st_file_attributes")):
|
|
@@ -2685,7 +2681,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
2685
2681
|
fcontents.seek(0, 0)
|
|
2686
2682
|
ftypehex = format(ftype, 'x').lower()
|
|
2687
2683
|
catoutlist = [ftypehex, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
2688
|
-
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev_minor, fdev_major,
|
|
2684
|
+
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+1"]
|
|
2689
2685
|
fp = AppendFileHeaderWithContent(
|
|
2690
2686
|
fp, catoutlist, extradata, fcontents.read(), checksumtype, formatspecs)
|
|
2691
2687
|
if(numfiles > 0):
|
|
@@ -2736,17 +2732,16 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
|
|
|
2736
2732
|
fid = format(curfname[16], 'x').lower()
|
|
2737
2733
|
finode = format(curfname[17], 'x').lower()
|
|
2738
2734
|
flinkcount = format(curfname[18], 'x').lower()
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
fcontents = curfname[27]
|
|
2735
|
+
fdev = format(curfname[19], 'x').lower()
|
|
2736
|
+
fdev_minor = format(curfname[20], 'x').lower()
|
|
2737
|
+
fdev_major = format(curfname[21], 'x').lower()
|
|
2738
|
+
fseeknextfile = curfname[22]
|
|
2739
|
+
extradata = curfname[23]
|
|
2740
|
+
fheaderchecksumtype = curfname[24]
|
|
2741
|
+
fcontentchecksumtype = curfname[25]
|
|
2742
|
+
fcontents = curfname[26]
|
|
2748
2743
|
catoutlist = [ftype, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression, fcsize,
|
|
2749
|
-
fuid, funame, fgid, fgname, fid, finode, flinkcount, fdev_minor, fdev_major,
|
|
2744
|
+
fuid, funame, fgid, fgname, fid, finode, flinkcount, fdev, fdev_minor, fdev_major, fseeknextfile]
|
|
2750
2745
|
fcontents.seek(0, 0)
|
|
2751
2746
|
fp = AppendFileHeaderWithContent(
|
|
2752
2747
|
fp, catoutlist, extradata, fcontents.read(), checksumtype, formatspecs)
|
|
@@ -3130,13 +3125,6 @@ def UncompressArchiveFile(fp, formatspecs=__file_format_dict__):
|
|
|
3130
3125
|
if(compresscheck == "catfile" or compresscheck == formatspecs['format_lower']):
|
|
3131
3126
|
catfp = fp
|
|
3132
3127
|
if(not compresscheck):
|
|
3133
|
-
try:
|
|
3134
|
-
import lzma
|
|
3135
|
-
except ImportError:
|
|
3136
|
-
try:
|
|
3137
|
-
from backports import lzma
|
|
3138
|
-
except ImportError:
|
|
3139
|
-
return False
|
|
3140
3128
|
catfp = BytesIO()
|
|
3141
3129
|
with fp as fpcontent:
|
|
3142
3130
|
try:
|
|
@@ -3704,14 +3692,6 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
3704
3692
|
getfdev = GetDevMajorMinor(fdev)
|
|
3705
3693
|
fdev_minor = getfdev[0]
|
|
3706
3694
|
fdev_major = getfdev[1]
|
|
3707
|
-
frdev = fstatinfo.st_dev
|
|
3708
|
-
if(hasattr(fstatinfo, "st_rdev")):
|
|
3709
|
-
frdev = fstatinfo.st_rdev
|
|
3710
|
-
else:
|
|
3711
|
-
frdev = fstatinfo.st_dev
|
|
3712
|
-
getfrdev = GetDevMajorMinor(frdev)
|
|
3713
|
-
frdev_minor = getfrdev[0]
|
|
3714
|
-
frdev_major = getfrdev[1]
|
|
3715
3695
|
if(ftype == 1 or ftype == 2 or ftype == 3 or ftype == 4 or ftype == 5 or ftype == 6):
|
|
3716
3696
|
fsize = format(int("0"), 'x').lower()
|
|
3717
3697
|
elif(ftype == 0 or ftype == 7):
|
|
@@ -3750,10 +3730,9 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
3750
3730
|
fgname = ""
|
|
3751
3731
|
except ImportError:
|
|
3752
3732
|
fgname = ""
|
|
3733
|
+
fdev = format(int(fdev), 'x').lower()
|
|
3753
3734
|
fdev_minor = format(int(fdev_minor), 'x').lower()
|
|
3754
3735
|
fdev_major = format(int(fdev_major), 'x').lower()
|
|
3755
|
-
frdev_minor = format(int(frdev_minor), 'x').lower()
|
|
3756
|
-
frdev_major = format(int(frdev_major), 'x').lower()
|
|
3757
3736
|
finode = format(int(finode), 'x').lower()
|
|
3758
3737
|
flinkcount = format(int(flinkcount), 'x').lower()
|
|
3759
3738
|
if(hasattr(fstatinfo, "st_file_attributes")):
|
|
@@ -3856,7 +3835,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
3856
3835
|
fcontents.seek(0, 0)
|
|
3857
3836
|
ftypehex = format(ftype, 'x').lower()
|
|
3858
3837
|
catoutlist = [ftypehex, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
3859
|
-
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev_minor, fdev_major,
|
|
3838
|
+
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+1"]
|
|
3860
3839
|
catfp = AppendFileHeaderWithContent(
|
|
3861
3840
|
catfp, catoutlist, extradata, fcontents.read(), checksumtype, formatspecs)
|
|
3862
3841
|
fcontents.close()
|
|
@@ -4036,10 +4015,9 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compresswhol
|
|
|
4036
4015
|
curfid = curfid + 1
|
|
4037
4016
|
if(ftype == 2):
|
|
4038
4017
|
flinkname = member.linkname
|
|
4018
|
+
fdev = format(int(os.makedev(member.devmajor, member.devminor)), 'x').lower()
|
|
4039
4019
|
fdev_minor = format(int(member.devminor), 'x').lower()
|
|
4040
4020
|
fdev_major = format(int(member.devmajor), 'x').lower()
|
|
4041
|
-
frdev_minor = format(int(member.devminor), 'x').lower()
|
|
4042
|
-
frdev_major = format(int(member.devmajor), 'x').lower()
|
|
4043
4021
|
if(ftype == 1 or ftype == 2 or ftype == 3 or ftype == 4 or ftype == 5 or ftype == 6):
|
|
4044
4022
|
fsize = format(int("0"), 'x').lower()
|
|
4045
4023
|
elif(ftype == 0 or ftype == 7):
|
|
@@ -4110,7 +4088,7 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compresswhol
|
|
|
4110
4088
|
fcontents.seek(0, 0)
|
|
4111
4089
|
ftypehex = format(ftype, 'x').lower()
|
|
4112
4090
|
catoutlist = [ftypehex, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
4113
|
-
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev_minor, fdev_major,
|
|
4091
|
+
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+1"]
|
|
4114
4092
|
catfp = AppendFileHeaderWithContent(
|
|
4115
4093
|
catfp, catoutlist, extradata, fcontents.read(), checksumtype, formatspecs)
|
|
4116
4094
|
fcontents.close()
|
|
@@ -4246,10 +4224,9 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compresswhol
|
|
|
4246
4224
|
fcurfid = format(int(curfid), 'x').lower()
|
|
4247
4225
|
fcurinode = format(int(curfid), 'x').lower()
|
|
4248
4226
|
curfid = curfid + 1
|
|
4227
|
+
fdev = format(int(0), 'x').lower()
|
|
4249
4228
|
fdev_minor = format(int(0), 'x').lower()
|
|
4250
4229
|
fdev_major = format(int(0), 'x').lower()
|
|
4251
|
-
frdev_minor = format(int(0), 'x').lower()
|
|
4252
|
-
frdev_major = format(int(0), 'x').lower()
|
|
4253
4230
|
if(ftype == 5):
|
|
4254
4231
|
fsize = format(int("0"), 'x').lower()
|
|
4255
4232
|
elif(ftype == 0):
|
|
@@ -4377,7 +4354,7 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compresswhol
|
|
|
4377
4354
|
fcontents.seek(0, 0)
|
|
4378
4355
|
ftypehex = format(ftype, 'x').lower()
|
|
4379
4356
|
catoutlist = [ftypehex, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
4380
|
-
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev_minor, fdev_major,
|
|
4357
|
+
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+1"]
|
|
4381
4358
|
catfp = AppendFileHeaderWithContent(
|
|
4382
4359
|
catfp, catoutlist, extradata, fcontents.read(), checksumtype, formatspecs)
|
|
4383
4360
|
fcontents.close()
|
|
@@ -4541,10 +4518,9 @@ if(rarfile_support):
|
|
|
4541
4518
|
fcurfid = format(int(curfid), 'x').lower()
|
|
4542
4519
|
fcurinode = format(int(curfid), 'x').lower()
|
|
4543
4520
|
curfid = curfid + 1
|
|
4521
|
+
fdev = format(int(0), 'x').lower()
|
|
4544
4522
|
fdev_minor = format(int(0), 'x').lower()
|
|
4545
4523
|
fdev_major = format(int(0), 'x').lower()
|
|
4546
|
-
frdev_minor = format(int(0), 'x').lower()
|
|
4547
|
-
frdev_major = format(int(0), 'x').lower()
|
|
4548
4524
|
if(ftype == 5):
|
|
4549
4525
|
fsize = format(int("0"), 'x').lower()
|
|
4550
4526
|
elif(ftype == 0):
|
|
@@ -4674,7 +4650,7 @@ if(rarfile_support):
|
|
|
4674
4650
|
fcontents.seek(0, 0)
|
|
4675
4651
|
ftypehex = format(ftype, 'x').lower()
|
|
4676
4652
|
catoutlist = [ftypehex, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
4677
|
-
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev_minor, fdev_major,
|
|
4653
|
+
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+1"]
|
|
4678
4654
|
catfp = AppendFileHeaderWithContent(
|
|
4679
4655
|
catfp, catoutlist, extradata, fcontents.read(), checksumtype, formatspecs)
|
|
4680
4656
|
fcontents.close()
|
|
@@ -4797,10 +4773,9 @@ if(py7zr_support):
|
|
|
4797
4773
|
fcurfid = format(int(curfid), 'x').lower()
|
|
4798
4774
|
fcurinode = format(int(curfid), 'x').lower()
|
|
4799
4775
|
curfid = curfid + 1
|
|
4776
|
+
fdev = format(int(0), 'x').lower()
|
|
4800
4777
|
fdev_minor = format(int(0), 'x').lower()
|
|
4801
4778
|
fdev_major = format(int(0), 'x').lower()
|
|
4802
|
-
frdev_minor = format(int(0), 'x').lower()
|
|
4803
|
-
frdev_major = format(int(0), 'x').lower()
|
|
4804
4779
|
if(ftype == 5):
|
|
4805
4780
|
fsize = format(int("0"), 'x').lower()
|
|
4806
4781
|
fatime = format(int(member.creationtime.timestamp()), 'x').lower()
|
|
@@ -4904,7 +4879,7 @@ if(py7zr_support):
|
|
|
4904
4879
|
fcontents.seek(0, 0)
|
|
4905
4880
|
ftypehex = format(ftype, 'x').lower()
|
|
4906
4881
|
catoutlist = [ftypehex, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
4907
|
-
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev_minor, fdev_major,
|
|
4882
|
+
fcsize, fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, "+1"]
|
|
4908
4883
|
catfp = AppendFileHeaderWithContent(
|
|
4909
4884
|
catfp, catoutlist, extradata, fcontents.read(), checksumtype, formatspecs)
|
|
4910
4885
|
fcontents.close()
|
|
@@ -5071,14 +5046,15 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, contentasfile=Tru
|
|
|
5071
5046
|
return False
|
|
5072
5047
|
if(catdel != formatspecs['format_delimiter']):
|
|
5073
5048
|
return False
|
|
5074
|
-
catheader = ReadFileHeaderData(catfp,
|
|
5049
|
+
catheader = ReadFileHeaderData(catfp, 4, formatspecs['format_delimiter'])
|
|
5075
5050
|
if(curloc > 0):
|
|
5076
5051
|
catfp.seek(curloc, 0)
|
|
5077
5052
|
catversion = re.findall("([\\d]+)", catstring)
|
|
5078
|
-
|
|
5053
|
+
fostype = catheader[0]
|
|
5054
|
+
fprenumfiles = catheader[1]
|
|
5079
5055
|
fnumfiles = int(fprenumfiles, 16)
|
|
5080
|
-
fprechecksumtype = catheader[
|
|
5081
|
-
fprechecksum = catheader[
|
|
5056
|
+
fprechecksumtype = catheader[2]
|
|
5057
|
+
fprechecksum = catheader[3]
|
|
5082
5058
|
fileheader = AppendNullByte(catstring, formatspecs['format_delimiter'])
|
|
5083
5059
|
fnumfileshex = format(int(fnumfiles), 'x').lower()
|
|
5084
5060
|
fileheader = fileheader + \
|
|
@@ -5096,7 +5072,7 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, contentasfile=Tru
|
|
|
5096
5072
|
"'" + str(catfileheadercshex) + "'")
|
|
5097
5073
|
return False
|
|
5098
5074
|
catversions = re.search('(.*?)(\\d+)', catstring).groups()
|
|
5099
|
-
catlist = {'fnumfiles': fnumfiles, 'fformat': catversions[0], 'fversion': catversions[1],
|
|
5075
|
+
catlist = {'fnumfiles': fnumfiles, 'fformat': catversions[0], 'fversion': catversions[1], 'fostype': fostype,
|
|
5100
5076
|
'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'ffilelist': {}}
|
|
5101
5077
|
if(seekto >= fnumfiles):
|
|
5102
5078
|
seekto = fnumfiles - 1
|
|
@@ -5141,15 +5117,14 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, contentasfile=Tru
|
|
|
5141
5117
|
fid = int(preheaderdata[18], 16)
|
|
5142
5118
|
finode = int(preheaderdata[19], 16)
|
|
5143
5119
|
flinkcount = int(preheaderdata[20], 16)
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
prefextrafields = int(preheaderdata[27], 16)
|
|
5120
|
+
prefdev = int(preheaderdata[21], 16)
|
|
5121
|
+
prefdev_minor = int(preheaderdata[22], 16)
|
|
5122
|
+
prefdev_major = int(preheaderdata[23], 16)
|
|
5123
|
+
prefseeknextfile = preheaderdata[24]
|
|
5124
|
+
prefextrasize = int(preheaderdata[25], 16)
|
|
5125
|
+
prefextrafields = int(preheaderdata[26], 16)
|
|
5151
5126
|
extrafieldslist = []
|
|
5152
|
-
extrastart =
|
|
5127
|
+
extrastart = 27
|
|
5153
5128
|
extraend = extrastart + prefextrafields
|
|
5154
5129
|
extrafieldslist = []
|
|
5155
5130
|
if(extrastart < extraend):
|
|
@@ -5329,14 +5304,15 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, contentasfi
|
|
|
5329
5304
|
return False
|
|
5330
5305
|
if(catdel != formatspecs['format_delimiter']):
|
|
5331
5306
|
return False
|
|
5332
|
-
catheader = ReadFileHeaderData(catfp,
|
|
5307
|
+
catheader = ReadFileHeaderData(catfp, 4, formatspecs['format_delimiter'])
|
|
5333
5308
|
if(curloc > 0):
|
|
5334
5309
|
catfp.seek(curloc, 0)
|
|
5335
5310
|
catversion = re.findall("([\\d]+)", catstring)
|
|
5336
|
-
|
|
5311
|
+
fostype = catheader[0]
|
|
5312
|
+
fprenumfiles = catheader[1]
|
|
5337
5313
|
fnumfiles = int(fprenumfiles, 16)
|
|
5338
|
-
fprechecksumtype = catheader[
|
|
5339
|
-
fprechecksum = catheader[
|
|
5314
|
+
fprechecksumtype = catheader[2]
|
|
5315
|
+
fprechecksum = catheader[3]
|
|
5340
5316
|
fileheader = AppendNullByte(catstring, formatspecs['format_delimiter'])
|
|
5341
5317
|
fnumfileshex = format(int(fnumfiles), 'x').lower()
|
|
5342
5318
|
fileheader = fileheader + \
|
|
@@ -5354,7 +5330,7 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, contentasfi
|
|
|
5354
5330
|
"'" + str(catfileheadercshex) + "'")
|
|
5355
5331
|
return False
|
|
5356
5332
|
catversions = re.search('(.*?)(\\d+)', catstring).groups()
|
|
5357
|
-
catlist = {'fnumfiles': fnumfiles, 'fformat': catversions[0], 'fversion': catversions[1],
|
|
5333
|
+
catlist = {'fnumfiles': fnumfiles, 'fformat': catversions[0], 'fversion': catversions[1], 'fostype': fostype,
|
|
5358
5334
|
'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'ffilelist': {}}
|
|
5359
5335
|
seekto = fnumfiles - 1
|
|
5360
5336
|
filefound = False
|
|
@@ -5397,15 +5373,14 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, contentasfi
|
|
|
5397
5373
|
fid = int(preheaderdata[18], 16)
|
|
5398
5374
|
finode = int(preheaderdata[19], 16)
|
|
5399
5375
|
flinkcount = int(preheaderdata[20], 16)
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
prefextrafields = int(preheaderdata[27], 16)
|
|
5376
|
+
prefdev = int(preheaderdata[21], 16)
|
|
5377
|
+
prefdev_minor = int(preheaderdata[22], 16)
|
|
5378
|
+
prefdev_major = int(preheaderdata[23], 16)
|
|
5379
|
+
prefseeknextfile = preheaderdata[24]
|
|
5380
|
+
prefextrasize = int(preheaderdata[25], 16)
|
|
5381
|
+
prefextrafields = int(preheaderdata[26], 16)
|
|
5407
5382
|
extrafieldslist = []
|
|
5408
|
-
extrastart =
|
|
5383
|
+
extrastart = 27
|
|
5409
5384
|
extraend = extrastart + prefextrafields
|
|
5410
5385
|
extrafieldslist = []
|
|
5411
5386
|
if(extrastart < extraend):
|
|
@@ -5600,19 +5575,20 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_dict__, verbose=False,
|
|
|
5600
5575
|
return False
|
|
5601
5576
|
if(catdel != formatspecs['format_delimiter']):
|
|
5602
5577
|
return False
|
|
5603
|
-
catheader = ReadFileHeaderData(catfp,
|
|
5578
|
+
catheader = ReadFileHeaderData(catfp, 4, formatspecs['format_delimiter'])
|
|
5604
5579
|
if(curloc > 0):
|
|
5605
5580
|
catfp.seek(curloc, 0)
|
|
5606
5581
|
catversion = re.findall("([\\d]+)", catstring)
|
|
5607
|
-
|
|
5582
|
+
fostype = catheader[0]
|
|
5583
|
+
fprenumfiles = catheader[1]
|
|
5608
5584
|
fnumfiles = int(fprenumfiles, 16)
|
|
5609
|
-
fprechecksumtype = catheader[
|
|
5610
|
-
fprechecksum = catheader[
|
|
5585
|
+
fprechecksumtype = catheader[2]
|
|
5586
|
+
fprechecksum = catheader[3]
|
|
5611
5587
|
il = 0
|
|
5612
5588
|
fileheader = AppendNullByte(catstring, formatspecs['format_delimiter'])
|
|
5613
5589
|
fnumfileshex = format(int(fnumfiles), 'x').lower()
|
|
5614
5590
|
fileheader = fileheader + \
|
|
5615
|
-
AppendNullBytes([fnumfileshex, fprechecksumtype],
|
|
5591
|
+
AppendNullBytes([fostype, fnumfileshex, fprechecksumtype],
|
|
5616
5592
|
formatspecs['format_delimiter'])
|
|
5617
5593
|
catfileheadercshex = GetFileChecksum(
|
|
5618
5594
|
fileheader, fprechecksumtype, True, formatspecs)
|
|
@@ -5680,15 +5656,14 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_dict__, verbose=False,
|
|
|
5680
5656
|
fid = int(catheaderdata[18], 16)
|
|
5681
5657
|
finode = int(catheaderdata[19], 16)
|
|
5682
5658
|
flinkcount = int(catheaderdata[20], 16)
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
catfextrafields = int(catheaderdata[27], 16)
|
|
5659
|
+
catfdev = int(catheaderdata[21], 16)
|
|
5660
|
+
catfdev_minor = int(catheaderdata[22], 16)
|
|
5661
|
+
catfdev_major = int(catheaderdata[23], 16)
|
|
5662
|
+
catfseeknextfile = catheaderdata[24]
|
|
5663
|
+
catfextrasize = int(catheaderdata[25], 16)
|
|
5664
|
+
catfextrafields = int(catheaderdata[26], 16)
|
|
5690
5665
|
extrafieldslist = []
|
|
5691
|
-
extrastart =
|
|
5666
|
+
extrastart = 27
|
|
5692
5667
|
extraend = extrastart + catfextrafields
|
|
5693
5668
|
extrafieldslist = []
|
|
5694
5669
|
if(extrastart < extraend):
|
|
@@ -5878,18 +5853,19 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentas
|
|
|
5878
5853
|
return False
|
|
5879
5854
|
if(catdel != formatspecs['format_delimiter']):
|
|
5880
5855
|
return False
|
|
5881
|
-
catheader = ReadFileHeaderData(catfp,
|
|
5856
|
+
catheader = ReadFileHeaderData(catfp, 4, formatspecs['format_delimiter'])
|
|
5882
5857
|
if(curloc > 0):
|
|
5883
5858
|
catfp.seek(curloc, 0)
|
|
5884
5859
|
catversion = re.findall("([\\d]+)", catstring)
|
|
5885
|
-
|
|
5860
|
+
fostype = catheader[0]
|
|
5861
|
+
fprenumfiles = catheader[1]
|
|
5886
5862
|
fnumfiles = int(fprenumfiles, 16)
|
|
5887
|
-
fprechecksumtype = catheader[
|
|
5888
|
-
fprechecksum = catheader[
|
|
5863
|
+
fprechecksumtype = catheader[2]
|
|
5864
|
+
fprechecksum = catheader[3]
|
|
5889
5865
|
fileheader = AppendNullByte(catstring, formatspecs['format_delimiter'])
|
|
5890
5866
|
fnumfileshex = format(int(fnumfiles), 'x').lower()
|
|
5891
5867
|
fileheader = fileheader + \
|
|
5892
|
-
AppendNullBytes([fnumfileshex, fprechecksumtype],
|
|
5868
|
+
AppendNullBytes([fostype, fnumfileshex, fprechecksumtype],
|
|
5893
5869
|
formatspecs['format_delimiter'])
|
|
5894
5870
|
catfileheadercshex = GetFileChecksum(
|
|
5895
5871
|
fileheader, fprechecksumtype, True, formatspecs)
|
|
@@ -6029,15 +6005,14 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentas
|
|
|
6029
6005
|
catfid = int(catheaderdata[18], 16)
|
|
6030
6006
|
catfinode = int(catheaderdata[19], 16)
|
|
6031
6007
|
catflinkcount = int(catheaderdata[20], 16)
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
catfextrafields = int(catheaderdata[27], 16)
|
|
6008
|
+
catfdev = int(catheaderdata[21], 16)
|
|
6009
|
+
catfdev_minor = int(catheaderdata[22], 16)
|
|
6010
|
+
catfdev_major = int(catheaderdata[23], 16)
|
|
6011
|
+
catfseeknextfile = catheaderdata[24]
|
|
6012
|
+
catfextrasize = int(catheaderdata[25], 16)
|
|
6013
|
+
catfextrafields = int(catheaderdata[26], 16)
|
|
6039
6014
|
extrafieldslist = []
|
|
6040
|
-
extrastart =
|
|
6015
|
+
extrastart = 27
|
|
6041
6016
|
extraend = extrastart + catfextrafields
|
|
6042
6017
|
extrafieldslist = []
|
|
6043
6018
|
if(extrastart < extraend):
|
|
@@ -6110,7 +6085,7 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentas
|
|
|
6110
6085
|
if(not contentasfile):
|
|
6111
6086
|
catfcontents = catfcontents.read()
|
|
6112
6087
|
catlist['ffilelist'].append({'fid': realidnum, 'fidalt': fileidnum, 'fheadersize': catfheadsize, 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': catftype, 'fname': catfname, 'fbasedir': catfbasedir, 'flinkname': catflinkname, 'fsize': catfsize, 'fatime': catfatime, 'fmtime': catfmtime, 'fctime': catfctime, 'fbtime': catfbtime, 'fmode': catfmode, 'fchmode': catfchmode, 'ftypemod': catftypemod, 'fwinattributes': catfwinattributes, 'fcompression': catfcompression, 'fcsize': catfcsize, 'fuid': catfuid, 'funame': catfuname, 'fgid': catfgid, 'fgname': catfgname, 'finode': catfinode, 'flinkcount': catflinkcount,
|
|
6113
|
-
'
|
|
6088
|
+
'fdev': catfdev, 'fminor': catfdev_minor, 'fmajor': catfdev_major, 'fseeknextfile': catfseeknextfile, 'fheaderchecksumtype': catheaderdata[-4], 'fcontentchecksumtype': catheaderdata[-3], 'fnumfields': catfnumfields + 2, 'frawheader': catheaderdata, 'fextrafields': catfextrafields, 'fextrafieldsize': catfextrasize, 'fextralist': extrafieldslist, 'fheaderchecksum': catfcs, 'fcontentchecksum': catfccs, 'fhascontents': pyhascontents, 'fcontentstart': catfcontentstart, 'fcontentend': catfcontentend, 'fcontentasfile': contentasfile, 'fcontents': catfcontents})
|
|
6114
6089
|
fileidnum = fileidnum + 1
|
|
6115
6090
|
realidnum = realidnum + 1
|
|
6116
6091
|
if(returnfp):
|
|
@@ -6327,14 +6302,6 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, followlink=False, listonly=
|
|
|
6327
6302
|
getfdev = GetDevMajorMinor(fdev)
|
|
6328
6303
|
fdev_minor = getfdev[0]
|
|
6329
6304
|
fdev_major = getfdev[1]
|
|
6330
|
-
frdev = fstatinfo.st_dev
|
|
6331
|
-
if(hasattr(fstatinfo, "st_rdev")):
|
|
6332
|
-
frdev = fstatinfo.st_rdev
|
|
6333
|
-
else:
|
|
6334
|
-
frdev = fstatinfo.st_dev
|
|
6335
|
-
getfrdev = GetDevMajorMinor(frdev)
|
|
6336
|
-
frdev_minor = getfrdev[0]
|
|
6337
|
-
frdev_major = getfrdev[1]
|
|
6338
6305
|
if(ftype == 1 or ftype == 2 or ftype == 3 or ftype == 4 or ftype == 5 or ftype == 6):
|
|
6339
6306
|
fsize = "0"
|
|
6340
6307
|
if(ftype == 0 or ftype == 7):
|
|
@@ -6371,11 +6338,6 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, followlink=False, listonly=
|
|
|
6371
6338
|
fgname = ""
|
|
6372
6339
|
except ImportError:
|
|
6373
6340
|
fgname = ""
|
|
6374
|
-
fdev_minor = fdev_minor
|
|
6375
|
-
fdev_major = fdev_major
|
|
6376
|
-
frdev_minor = frdev_minor
|
|
6377
|
-
frdev_major = frdev_major
|
|
6378
|
-
flinkcount = flinkcount
|
|
6379
6341
|
if(hasattr(fstatinfo, "st_file_attributes")):
|
|
6380
6342
|
fwinattributes = fstatinfo.st_file_attributes
|
|
6381
6343
|
else:
|
|
@@ -6403,7 +6365,7 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, followlink=False, listonly=
|
|
|
6403
6365
|
extrasizelen = len(extrasizestr)
|
|
6404
6366
|
extrasizelenhex = format(extrasizelen, 'x').lower()
|
|
6405
6367
|
catoutlist = [ftypehex, fname, flinkname, format(int(fsize), 'x').lower(), format(int(fatime), 'x').lower(), format(int(fmtime), 'x').lower(), format(int(fctime), 'x').lower(), format(int(fbtime), 'x').lower(), format(int(fmode), 'x').lower(), format(int(fwinattributes), 'x').lower(), fcompression, format(int(fcsize), 'x').lower(), format(int(fuid), 'x').lower(
|
|
6406
|
-
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(
|
|
6368
|
+
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(fdev), 'x').lower(), format(int(fdev_minor), 'x').lower(), format(int(fdev_major), 'x').lower(), "+1", extrasizelenhex, format(catfextrafields, 'x').lower()]
|
|
6407
6369
|
catoutlen = len(catoutlist) + len(extradata) + 3
|
|
6408
6370
|
catoutlenhex = format(catoutlen, 'x').lower()
|
|
6409
6371
|
catoutlist.insert(0, catoutlenhex)
|
|
@@ -6457,8 +6419,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, followlink=False, listonly=
|
|
|
6457
6419
|
fcontents.seek(0, 0)
|
|
6458
6420
|
if(not contentasfile):
|
|
6459
6421
|
fcontents = fcontents.read()
|
|
6460
|
-
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
6461
|
-
|
|
6422
|
+
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
6423
|
+
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': "+1", 'fheaderchecksumtype': checksumtype, 'fcontentchecksumtype': checksumtype, 'fnumfields': catfnumfields + 2, 'frawheader': catheaderdata, 'fextrafields': catfextrafields, 'fextrafieldsize': extrasizelen, 'fextralist': extrafieldslist, 'fheaderchecksum': int(catfileheadercshex, 16), 'fcontentchecksum': int(catfilecontentcshex, 16), 'fhascontents': pyhascontents, 'fcontentstart': catfcontentstart, 'fcontentend': catfcontentend, 'fcontentasfile': contentasfile, 'fcontents': fcontents})
|
|
6462
6424
|
fileidnum = fileidnum + 1
|
|
6463
6425
|
return catlist
|
|
6464
6426
|
|
|
@@ -6572,10 +6534,9 @@ def TarFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
|
|
|
6572
6534
|
curfid = curfid + 1
|
|
6573
6535
|
if(ftype == 2):
|
|
6574
6536
|
flinkname = member.linkname
|
|
6537
|
+
fdev = os.makedev(member.devmajor, member.devminor)
|
|
6575
6538
|
fdev_minor = member.devminor
|
|
6576
6539
|
fdev_major = member.devmajor
|
|
6577
|
-
frdev_minor = member.devminor
|
|
6578
|
-
frdev_major = member.devmajor
|
|
6579
6540
|
if(ftype == 1 or ftype == 2 or ftype == 3 or ftype == 4 or ftype == 5 or ftype == 6):
|
|
6580
6541
|
fsize = "0"
|
|
6581
6542
|
elif(ftype == 0 or ftype == 7):
|
|
@@ -6614,7 +6575,7 @@ def TarFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
|
|
|
6614
6575
|
extrasizelen = len(extrasizestr)
|
|
6615
6576
|
extrasizelenhex = format(extrasizelen, 'x').lower()
|
|
6616
6577
|
catoutlist = [ftypehex, fname, flinkname, format(int(fsize), 'x').lower(), format(int(fatime), 'x').lower(), format(int(fmtime), 'x').lower(), format(int(fctime), 'x').lower(), format(int(fbtime), 'x').lower(), format(int(fmode), 'x').lower(), format(int(fwinattributes), 'x').lower(), fcompression, format(int(fcsize), 'x').lower(), format(int(fuid), 'x').lower(
|
|
6617
|
-
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(
|
|
6578
|
+
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(fdev), 'x').lower(), format(int(fdev_minor), 'x').lower(), format(int(fdev_major), 'x').lower(), "+1", extrasizelenhex, format(catfextrafields, 'x').lower()]
|
|
6618
6579
|
catoutlen = len(catoutlist) + len(extradata) + 3
|
|
6619
6580
|
catoutlenhex = format(catoutlen, 'x').lower()
|
|
6620
6581
|
catoutlist.insert(0, catoutlenhex)
|
|
@@ -6668,8 +6629,8 @@ def TarFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
|
|
|
6668
6629
|
fcontents.seek(0, 0)
|
|
6669
6630
|
if(not contentasfile):
|
|
6670
6631
|
fcontents = fcontents.read()
|
|
6671
|
-
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
6672
|
-
'
|
|
6632
|
+
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
6633
|
+
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': "+1", 'fheaderchecksumtype': checksumtype, 'fcontentchecksumtype': checksumtype, 'fnumfields': catfnumfields + 2, 'frawheader': catheaderdata, 'fextrafields': catfextrafields, 'fextrafieldsize': extrasizelen, 'fextralist': extrafieldslist, 'fheaderchecksum': int(catfileheadercshex, 16), 'fcontentchecksum': int(catfilecontentcshex, 16), 'fhascontents': pyhascontents, 'fcontentstart': catfcontentstart, 'fcontentend': catfcontentend, 'fcontentasfile': contentasfile, 'fcontents': fcontents})
|
|
6673
6634
|
fileidnum = fileidnum + 1
|
|
6674
6635
|
return catlist
|
|
6675
6636
|
|
|
@@ -6753,10 +6714,9 @@ def ZipFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
|
|
|
6753
6714
|
fcurinode = curfid
|
|
6754
6715
|
finode = fcurinode
|
|
6755
6716
|
curfid = curfid + 1
|
|
6717
|
+
fdev = 0
|
|
6756
6718
|
fdev_minor = 0
|
|
6757
6719
|
fdev_major = 0
|
|
6758
|
-
frdev_minor = 0
|
|
6759
|
-
frdev_major = 0
|
|
6760
6720
|
if(ftype == 5):
|
|
6761
6721
|
fsize = "0"
|
|
6762
6722
|
elif(ftype == 0):
|
|
@@ -6850,7 +6810,7 @@ def ZipFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
|
|
|
6850
6810
|
extrasizelen = len(extrasizestr)
|
|
6851
6811
|
extrasizelenhex = format(extrasizelen, 'x').lower()
|
|
6852
6812
|
catoutlist = [ftypehex, fname, flinkname, format(int(fsize), 'x').lower(), format(int(fatime), 'x').lower(), format(int(fmtime), 'x').lower(), format(int(fctime), 'x').lower(), format(int(fbtime), 'x').lower(), format(int(fmode), 'x').lower(), format(int(fwinattributes), 'x').lower(), fcompression, format(int(fcsize), 'x').lower(), format(int(fuid), 'x').lower(
|
|
6853
|
-
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(
|
|
6813
|
+
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(fdev), 'x').lower(), format(int(fdev_minor), 'x').lower(), format(int(fdev_major), 'x').lower(), "+1", extrasizelenhex, format(catfextrafields, 'x').lower()]
|
|
6854
6814
|
catoutlen = len(catoutlist) + len(extradata) + 3
|
|
6855
6815
|
catoutlenhex = format(catoutlen, 'x').lower()
|
|
6856
6816
|
catoutlist.insert(0, catoutlenhex)
|
|
@@ -6904,8 +6864,8 @@ def ZipFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
|
|
|
6904
6864
|
fcontents.seek(0, 0)
|
|
6905
6865
|
if(not contentasfile):
|
|
6906
6866
|
fcontents = fcontents.read()
|
|
6907
|
-
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
6908
|
-
'
|
|
6867
|
+
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
6868
|
+
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': "+1", 'fheaderchecksumtype': checksumtype, 'fcontentchecksumtype': checksumtype, 'fnumfields': catfnumfields + 2, 'frawheader': catheaderdata, 'fextrafields': catfextrafields, 'fextrafieldsize': extrasizelen, 'fextralist': extrafieldslist, 'fheaderchecksum': int(catfileheadercshex, 16), 'fcontentchecksum': int(catfilecontentcshex, 16), 'fhascontents': pyhascontents, 'fcontentstart': catfcontentstart, 'fcontentend': catfcontentend, 'fcontentasfile': contentasfile, 'fcontents': fcontents})
|
|
6909
6869
|
fileidnum = fileidnum + 1
|
|
6910
6870
|
return catlist
|
|
6911
6871
|
|
|
@@ -7008,10 +6968,9 @@ if(rarfile_support):
|
|
|
7008
6968
|
fcurinode = curfid
|
|
7009
6969
|
finode = fcurinode
|
|
7010
6970
|
curfid = curfid + 1
|
|
6971
|
+
fdev = 0
|
|
7011
6972
|
fdev_minor = 0
|
|
7012
6973
|
fdev_major = 0
|
|
7013
|
-
frdev_minor = 0
|
|
7014
|
-
frdev_major = 0
|
|
7015
6974
|
if(ftype == 5):
|
|
7016
6975
|
fsize = "0"
|
|
7017
6976
|
if(ftype == 0):
|
|
@@ -7099,7 +7058,7 @@ if(rarfile_support):
|
|
|
7099
7058
|
extrasizelen = len(extrasizestr)
|
|
7100
7059
|
extrasizelenhex = format(extrasizelen, 'x').lower()
|
|
7101
7060
|
catoutlist = [ftypehex, fname, flinkname, format(int(fsize), 'x').lower(), format(int(fatime), 'x').lower(), format(int(fmtime), 'x').lower(), format(int(fctime), 'x').lower(), format(int(fbtime), 'x').lower(), format(int(fmode), 'x').lower(), format(int(fwinattributes), 'x').lower(), fcompression, format(int(fcsize), 'x').lower(), format(int(fuid), 'x').lower(
|
|
7102
|
-
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(
|
|
7061
|
+
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(fdev), 'x').lower(), format(int(fdev_minor), 'x').lower(), format(int(fdev_major), 'x').lower(), "+1", extrasizelenhex, format(catfextrafields, 'x').lower()]
|
|
7103
7062
|
catoutlen = len(catoutlist) + len(extradata) + 3
|
|
7104
7063
|
catoutlenhex = format(catoutlen, 'x').lower()
|
|
7105
7064
|
catoutlist.insert(0, catoutlenhex)
|
|
@@ -7153,8 +7112,8 @@ if(rarfile_support):
|
|
|
7153
7112
|
fcontents.seek(0, 0)
|
|
7154
7113
|
if(not contentasfile):
|
|
7155
7114
|
fcontents = fcontents.read()
|
|
7156
|
-
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
7157
|
-
'
|
|
7115
|
+
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
7116
|
+
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': "+1", 'fheaderchecksumtype': checksumtype, 'fcontentchecksumtype': checksumtype, 'fnumfields': catfnumfields + 2, 'frawheader': catheaderdata, 'fextrafields': catfextrafields, 'fextrafieldsize': extrasizelen, 'fextralist': extrafieldslist, 'fheaderchecksum': int(catfileheadercshex, 16), 'fcontentchecksum': int(catfilecontentcshex, 16), 'fhascontents': pyhascontents, 'fcontentstart': catfcontentstart, 'fcontentend': catfcontentend, 'fcontentasfile': contentasfile, 'fcontents': fcontents})
|
|
7158
7117
|
fileidnum = fileidnum + 1
|
|
7159
7118
|
return catlist
|
|
7160
7119
|
|
|
@@ -7221,10 +7180,9 @@ if(py7zr_support):
|
|
|
7221
7180
|
fcurinode = curfid
|
|
7222
7181
|
finode = fcurinode
|
|
7223
7182
|
curfid = curfid + 1
|
|
7183
|
+
fdev = 0
|
|
7224
7184
|
fdev_minor = 0
|
|
7225
7185
|
fdev_major = 0
|
|
7226
|
-
frdev_minor = 0
|
|
7227
|
-
frdev_major = 0
|
|
7228
7186
|
if(ftype == 5):
|
|
7229
7187
|
fsize = "0"
|
|
7230
7188
|
fatime = int(member.creationtime.timestamp())
|
|
@@ -7292,7 +7250,7 @@ if(py7zr_support):
|
|
|
7292
7250
|
extrasizelen = len(extrasizestr)
|
|
7293
7251
|
extrasizelenhex = format(extrasizelen, 'x').lower()
|
|
7294
7252
|
catoutlist = [ftypehex, fname, flinkname, format(int(fsize), 'x').lower(), format(int(fatime), 'x').lower(), format(int(fmtime), 'x').lower(), format(int(fctime), 'x').lower(), format(int(fbtime), 'x').lower(), format(int(fmode), 'x').lower(), format(int(fwinattributes), 'x').lower(), fcompression, format(int(fcsize), 'x').lower(), format(int(fuid), 'x').lower(
|
|
7295
|
-
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(
|
|
7253
|
+
), funame, format(int(fgid), 'x').lower(), fgname, format(int(fcurfid), 'x').lower(), format(int(fcurinode), 'x').lower(), format(int(flinkcount), 'x').lower(), format(int(fdev), 'x').lower(), format(int(fdev_minor), 'x').lower(), format(int(fdev_major), 'x').lower(), "+1", extrasizelenhex, format(catfextrafields, 'x').lower()]
|
|
7296
7254
|
catoutlen = len(catoutlist) + len(extradata) + 3
|
|
7297
7255
|
catoutlenhex = format(catoutlen, 'x').lower()
|
|
7298
7256
|
catoutlist.insert(0, catoutlenhex)
|
|
@@ -7346,8 +7304,8 @@ if(py7zr_support):
|
|
|
7346
7304
|
fcontents.seek(0, 0)
|
|
7347
7305
|
if(not contentasfile):
|
|
7348
7306
|
fcontents = fcontents.read()
|
|
7349
|
-
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
7350
|
-
'
|
|
7307
|
+
catlist['ffilelist'].append({'fid': fileidnum, 'fidalt': fileidnum, 'fheadersize': int(catheaersize, 16), 'fhstart': catfhstart, 'fhend': catfhend, 'ftype': ftype, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
7308
|
+
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': "+1", 'fheaderchecksumtype': checksumtype, 'fcontentchecksumtype': checksumtype, 'fnumfields': catfnumfields + 2, 'frawheader': catheaderdata, 'fextrafields': catfextrafields, 'fextrafieldsize': extrasizelen, 'fextralist': extrafieldslist, 'fheaderchecksum': int(catfileheadercshex, 16), 'fcontentchecksum': int(catfilecontentcshex, 16), 'fhascontents': pyhascontents, 'fcontentstart': catfcontentstart, 'fcontentend': catfcontentend, 'fcontentasfile': contentasfile, 'fcontents': fcontents})
|
|
7351
7309
|
fileidnum = fileidnum + 1
|
|
7352
7310
|
return catlist
|
|
7353
7311
|
|
|
@@ -7555,14 +7513,12 @@ def RePackArchiveFile(infile, outfile, compression="auto", compresswholefile=Tru
|
|
|
7555
7513
|
fcompression = listcatfiles['ffilelist'][reallcfi]['fcompression']
|
|
7556
7514
|
fcsize = format(
|
|
7557
7515
|
int(listcatfiles['ffilelist'][reallcfi]['fcsize']), 'x').lower()
|
|
7516
|
+
fdev = format(
|
|
7517
|
+
int(listcatfiles['ffilelist'][reallcfi]['fdev']), 'x').lower()
|
|
7558
7518
|
fdev_minor = format(
|
|
7559
7519
|
int(listcatfiles['ffilelist'][reallcfi]['fminor']), 'x').lower()
|
|
7560
7520
|
fdev_major = format(
|
|
7561
7521
|
int(listcatfiles['ffilelist'][reallcfi]['fmajor']), 'x').lower()
|
|
7562
|
-
frdev_minor = format(
|
|
7563
|
-
int(listcatfiles['ffilelist'][reallcfi]['frminor']), 'x').lower()
|
|
7564
|
-
frdev_major = format(
|
|
7565
|
-
int(listcatfiles['ffilelist'][reallcfi]['frmajor']), 'x').lower()
|
|
7566
7522
|
fseeknextfile = listcatfiles['ffilelist'][reallcfi]['fseeknextfile']
|
|
7567
7523
|
if(len(listcatfiles['ffilelist'][reallcfi]['fextralist']) > listcatfiles['ffilelist'][reallcfi]['fextrafields'] and len(listcatfiles['ffilelist'][reallcfi]['fextralist']) > 0):
|
|
7568
7524
|
listcatfiles['ffilelist'][reallcfi]['fextrafields'] = len(
|
|
@@ -7639,10 +7595,9 @@ def RePackArchiveFile(infile, outfile, compression="auto", compresswholefile=Tru
|
|
|
7639
7595
|
int(flinkinfo['fwinattributes']), 'x').lower()
|
|
7640
7596
|
fcompression = flinkinfo['fcompression']
|
|
7641
7597
|
fcsize = format(int(flinkinfo['fcsize']), 'x').lower()
|
|
7598
|
+
fdev = format(int(flinkinfo['fdev']), 'x').lower()
|
|
7642
7599
|
fdev_minor = format(int(flinkinfo['fminor']), 'x').lower()
|
|
7643
7600
|
fdev_major = format(int(flinkinfo['fmajor']), 'x').lower()
|
|
7644
|
-
frdev_minor = format(int(flinkinfo['frminor']), 'x').lower()
|
|
7645
|
-
frdev_major = format(int(flinkinfo['frmajor']), 'x').lower()
|
|
7646
7601
|
fseeknextfile = flinkinfo['fseeknextfile']
|
|
7647
7602
|
if(len(flinkinfo['fextralist']) > flinkinfo['fextrafields'] and len(flinkinfo['fextralist']) > 0):
|
|
7648
7603
|
flinkinfo['fextrafields'] = len(flinkinfo['fextralist'])
|
|
@@ -7671,7 +7626,7 @@ def RePackArchiveFile(infile, outfile, compression="auto", compresswholefile=Tru
|
|
|
7671
7626
|
if(fcompression == "none"):
|
|
7672
7627
|
fcompression = ""
|
|
7673
7628
|
catoutlist = [ftypehex, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression, fcsize,
|
|
7674
|
-
fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev_minor, fdev_major,
|
|
7629
|
+
fuid, funame, fgid, fgname, fcurfid, fcurinode, flinkcount, fdev, fdev_minor, fdev_major, fseeknextfile]
|
|
7675
7630
|
catfp = AppendFileHeaderWithContent(
|
|
7676
7631
|
catfp, catoutlist, extradata, fcontents.read(), checksumtype, formatspecs)
|
|
7677
7632
|
fcontents.close()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|