aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-05-16 13:55:32 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-05-16 13:55:32 -0300
commit33b36b739e93f9c43c67e34d4fb753d6ac53fff3 (patch)
tree71c581f17969ad7e2f5ff6f39ab3c55526d9cdca
parent4e935dbe2b86d887f38bdcddd6f00042f28d7b9a (diff)
downloadckandumper-33b36b739e93f9c43c67e34d4fb753d6ac53fff3.tar.gz
ckandumper-33b36b739e93f9c43c67e34d4fb753d6ac53fff3.tar.bz2
Compute sha256sum of downloaded file
-rwxr-xr-xckandumper6
1 files changed, 6 insertions, 0 deletions
diff --git a/ckandumper b/ckandumper
index 46c9a51..e85b15d 100755
--- a/ckandumper
+++ b/ckandumper
@@ -24,6 +24,7 @@ import asyncio
import argparse
import sys, os, json
from urllib.parse import urlencode
+from hashlib import sha256
from tqdm import tqdm
class DownloadMultiple:
@@ -93,6 +94,11 @@ class DownloadMultiple:
output.write(str(datetime.datetime.now()) + '\n')
output.close()
+ content = open(local_filename, 'rb')
+ output = open(local_filename + '.sha256', 'w')
+ output.write(sha256(content.read()).hexdigest() + ' ' + os.path.basename(local_filename) + '\n')
+ output.close()
+
if not str(proc.returncode) in self.globalstats['exitstatus']:
self.globalstats['exitstatus'][str(proc.returncode)] = []