Last active
August 17, 2016 01:32
-
-
Save thurask/1111dab3cbca4b0a281c2299c4b1f327 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from bbarchivist import hashutils | |
from bbarchivist import utilities | |
DEBUG = False | |
base = "E:\Google Drive\Autoloaders\BB10" | |
if DEBUG: | |
oses = ["10.3.3.746", "10.0.9.2372"] | |
rads = ["10.3.3.745", "10.0.9.2373"] | |
swvs = ["Dev Autoloader", "10.0.9.348"] | |
sers = ["10.3.3", "10.0.9"] | |
else: | |
oses = ['10.3.3.746', '10.3.2.2888', '10.3.2.2876', '10.3.2.2813', '10.3.2.2789', '10.3.2.2639', '10.3.2.2381', '10.3.2.2339', '10.3.2.2252', '10.3.2.876', '10.3.2.858', '10.3.2.840', '10.3.2.798', '10.3.2.680', '10.3.2.283', '10.3.1.2744', '10.3.1.2726', '10.3.1.2708', '10.3.1.2582', '10.3.1.2576', '10.3.1.2558', '10.3.1.2267', '10.3.1.2243', '10.3.1.2072', '10.3.1.1955', '10.3.1.1520', '10.3.1.1448', '10.3.1.1298', '10.3.1.1154', '10.3.1.997', '10.3.1.634', '10.3.0.1418', '10.3.0.1172', '10.3.0.1154', '10.3.0.1052', '10.3.0.700', '10.3.0.442', '10.2.2.1609', '10.2.2.1531', '10.2.1.3442', '10.2.1.3412', '10.2.1.3358', '10.2.1.3337', '10.2.1.3289', '10.2.1.3253', '10.2.1.3247', '10.2.1.3175', '10.2.1.2947', '10.2.1.2758', '10.2.1.2294', '10.2.1.2273', '10.2.1.2234', '10.2.1.2228', '10.2.1.2180', '10.2.1.2174', '10.2.1.2141', '10.2.1.1927', '10.2.1.1925', '10.2.1.1057', '10.2.0.1809', '10.2.0.1803', '10.2.0.1793', '10.2.0.1791', '10.2.0.1767', '10.2.0.1761', '10.2.0.1725', '10.2.0.1521', '10.2.0.1445', '10.2.0.1443', '10.2.0.1233', '10.2.0.1157', '10.2.0.783', '10.2.0.341', '10.1.0.4828', '10.1.0.4780', '10.1.0.4699', '10.1.0.4651', '10.1.0.4633', '10.1.0.4537', '10.1.0.2420', '10.1.0.2354', '10.1.0.2342', '10.1.0.2151', '10.1.0.2121', '10.1.0.2074', '10.1.0.2062', '10.1.0.2050', '10.1.0.2038', '10.1.0.2025', '10.1.0.2009', '10.1.0.1916', '10.1.0.1910', '10.1.0.1762', '10.1.0.1756', '10.1.0.1720', '10.1.0.1627', '10.1.0.1609', '10.1.0.1485', '10.1.0.1483', '10.1.0.1022', '10.1.0.1002', '10.0.10.927', '10.0.10.822', '10.0.10.738', '10.0.10.690', '10.0.10.684', '10.0.10.672', '10.0.10.648', '10.0.10.263', '10.0.10.263', '10.0.10.261', '10.0.9.2743', '10.0.9.2709', '10.0.9.2598', '10.0.9.2592', '10.0.9.2466', '10.0.9.2460', '10.0.9.2372', '10.0.9.2320', '10.0.9.2246', '10.0.9.1675', '10.0.9.1103', '10.0.9.388'] | |
rads = ['10.3.3.745', '10.3.2.2877', '10.3.2.2877', '10.3.2.2814', '10.3.2.2790', '10.3.2.2640', '10.3.2.2382', '10.3.2.2340', '10.3.2.2253', '10.3.2.798', '10.3.2.859', '10.3.2.841', '10.3.2.799', '10.3.2.681', '10.3.2.282', '10.3.1.2745', '10.3.1.2727', '10.3.1.2709', '10.3.1.2583', '10.3.1.2577', '10.3.1.2559', '10.3.1.2268', '10.3.1.2244', '10.3.1.2073', '10.3.1.1956', '10.3.1.1521', '10.3.1.1449', '10.3.1.1299', '10.3.1.1155', '10.3.1.996', '10.3.1.633', '10.3.0.1419', '10.3.0.1155', '10.3.0.1155', '10.3.0.1053', '10.3.0.699', '10.3.0.441', '10.2.2.1532', '10.2.2.1532', '10.2.1.3140', '10.2.1.3140', '10.2.1.3359', '10.2.1.3338', '10.2.1.3290', '10.2.1.3182', '10.2.1.3140', '10.2.1.3140', '10.2.1.2948', '10.2.1.2759', '10.2.1.2142', '10.2.1.2274', '10.2.1.2235', '10.2.1.2229', '10.2.1.2181', '10.2.1.2175', '10.2.1.2142', '10.2.1.1926', '10.2.1.1899', '10.2.1.1056', '10.2.0.1810', '10.2.0.1804', '10.2.0.1792', '10.2.0.1792', '10.2.0.1768', '10.2.0.1762', '10.2.0.1726', '10.2.0.1522', '10.2.0.1444', '10.2.0.1444', '10.2.0.1234', '10.2.0.1156', '10.2.0.784', '10.2.0.340', '10.1.0.4829', '10.1.0.4781', '10.1.0.4700', '10.1.0.4652', '10.1.0.4634', '10.1.0.4538', '10.1.0.2421', '10.1.0.2355', '10.1.0.2343', '10.1.0.2152', '10.1.0.2122', '10.1.0.2075', '10.1.0.2063', '10.1.0.2051', '10.1.0.2039', '10.1.0.2026', '10.1.0.2010', '10.1.0.1917', '10.1.0.1911', '10.1.0.1763', '10.1.0.1757', '10.1.0.1721', '10.1.0.1628', '10.1.0.1610', '10.1.0.1484', '10.1.0.1484', '10.1.0.1021', '10.1.0.1003', '10.0.10.928', '10.0.10.823', '10.0.10.739', '10.0.10.691', '10.0.10.685', '10.0.10.673', '10.0.10.649', '10.0.10.262', '10.0.10.262', '10.0.10.262', '10.0.9.2744', '10.0.9.2710', '10.0.9.2599', '10.0.9.2593', '10.0.9.2467', '10.0.9.2461', '10.0.9.2373', '10.0.9.2319', '10.0.9.2247', '10.0.9.1674', '10.0.9.1102', '10.0.9.387'] | |
swvs = ['Dev Autoloader', '10.3.2.2848', '10.3.2.2836', '10.3.2.2530', '10.3.2.2514', '10.3.2.2474', '10.3.2.2250', '10.3.2.2226', '10.3.2.2168', '10.3.2.668', '10.3.2.556', '10.3.2.544', '10.3.2.516', '10.3.2.440', 'Dev Autoloader', '10.3.1.1889', '10.3.1.1877', '10.3.1.1865', '10.3.1.1784', '10.3.1.1779', '10.3.1.1767', '10.3.1.1581', '10.3.1.1565', '10.3.1.1450', '10.3.1.1372', '10.3.1.989', '10.3.1.941', '10.3.1.841', '10.3.1.747', 'Dev Autoloader', 'Dev Autoloader', '10.3.0.908', '10.3.0.754', '10.3.0.738', '10.3.0.675', 'Dev Autoloader', 'Dev Autoloader', '10.2.2.984', '10.2.2.932', '10.2.1.3062', '10.2.1.3054', '10.2.1.3023', '10.2.1.3014', '10.2.1.2991', '10.2.1.2976', '10.2.1.2977', '10.2.1.2941', '10.2.1.2788', '10.2.1.2674', '10.2.1.2192', '10.2.1.2179', '10.2.1.2160', '10.2.1.2156', '10.2.1.2126', '10.2.1.2122', '10.2.1.2102', 'Dev Autoloader', '10.2.1.537', 'Dev Autoloader', '10.2.0.431', '10.2.0.429', 'Dev Autoloader', '10.2.0.424', '10.2.0.415', '10.2.0.413', '10.2.0.405', '10.2.0.224', 'Dev Autoloader', '10.2.0.210', '10.2.0.262', 'Dev Autoloader', '10.2.0.110', 'Dev Autoloader', '10.1.0.4211', '10.1.0.4200', '10.1.0.4189', '10.1.0.4184', '10.1.0.4181', '10.1.0.4160', '10.1.0.2320', '10.1.0.2312', '10.1.0.2309', '10.1.0.2039', '10.1.0.2030', '10.1.0.2019', '10.1.0.2016', '10.1.0.2014', '10.1.0.2011', '10.1.0.2006', '10.1.0.2002', '10.1.0.317', '10.1.0.314', '10.1.0.282', '10.1.0.278', '10.1.0.273', '10.1.0.264', '10.1.0.260', 'Dev Autoloader', '10.1.0.238', '10.1.0.138', '10.1.0.132', '10.0.10.131', '10.0.10.116', '10.0.10.99', '10.0.10.90', '10.0.10.88', '10.0.10.85', '10.0.10.82', '10.9.10.35', 'Dev Autoloader', '10.0.10.58', '10.0.9.422', '10.0.9.412', '10.0.9.389', '10.0.9.388', '10.0.9.361', '10.0.9.359', '10.0.9.348', '10.9.9.339', '10.0.9.331', '10.0.9.253', '10.0.9.156', '10.0.9.44'] | |
sers = ['10.3.3', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.2', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.1', '10.3.0', '10.3.0', '10.3.0', '10.3.0', '10.3.0', '10.3.0', '10.2.2', '10.2.2', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.1', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.2.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.1.0', '10.0.10', '10.0.10', '10.0.10', '10.0.10', '10.0.10', '10.0.10', '10.0.10', '10.0.10', '10.0.10', '10.0.10', '10.0.9', '10.0.9', '10.0.9', '10.0.9', '10.0.9', '10.0.9', '10.0.9', '10.0.9', '10.0.9', '10.0.9', '10.0.9', '10.0.9'] | |
for idx, itm in enumerate(oses): | |
print(itm) | |
fpath = os.path.join(base, sers[idx], itm) | |
files = os.listdir(fpath) | |
absfiles = [os.path.join(fpath, x) for x in files if x.endswith(".7z")] | |
premhashes = [x.replace(".7z", ".7z.cksum") for x in absfiles] | |
if DEBUG: | |
fname = "!{0}_OSINFO!.txt".format(itm) | |
else: | |
fname = os.path.join(fpath, "!{0}_OSINFO!.txt".format(itm)) | |
if os.path.exists(fname): | |
pass | |
else: | |
with open(fname, "w") as afile: | |
afile.write("OS: {0}\n".format(itm)) | |
afile.write("Radio: {0}\n".format(rads[idx])) | |
afile.write("Software: {0}\n".format(swvs[idx])) | |
afile.write("{0}\n".format("~"*40)) | |
for indx, file in enumerate(absfiles): | |
fsize = os.stat(file).st_size | |
afile.write("File: {0}\n".format(os.path.basename(file))) | |
afile.write("\tSize: {0} ({1})\n".format(fsize, utilities.fsizer(fsize))) | |
afile.write("\tHashes:\n") | |
with open(premhashes[indx], "r") as oldfile: | |
olddata = oldfile.read() | |
oldhashes = (olddata.replace(" ", "\n")).split("\n") | |
afile.write("\t\t{1}: {0}\n".format(oldhashes[1], oldhashes[0])) | |
afile.write("\t\t{1}: {0}\n".format(oldhashes[4], oldhashes[3])) | |
afile.write("\t\t{1}: {0}\n".format(oldhashes[7], oldhashes[6])) | |
#afile.write("\t\tMD5: {0}\n".format(hashutils.hm5(file))) | |
#afile.write("\t\tSHA1: {0}\n".format(hashutils.hs1(file))) | |
#afile.write("\t\tSHA256: {0}\n".format(hashutils.hs256(file))) | |
afile.write("\t\tSHA512: {0}\n".format(hashutils.hs512(file).upper())) | |
if indx != len(absfiles) - 1: | |
afile.write("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment