Here's the MD5 reader.
For some reason it would fuck up randomly when reading files, it happened most of the times when I left my PC on overnight. I tried to force the terminal to print the filename and thread number, which somehow fixed it and made it slightly faster, thought the speed might just be placebo.
What I'm guessing is that since it left the terminal on hold for a fuckton of time, it eventually broke something because lol scripting language on intensive tasks, and making it to print each file forces the terminal to update instead of just stand there and drifting into death.
Because of that it now prints the starting date and end date at the end of the batch.
Usage is:
python scriptname.py numberofthread [anything here if you want it to clear the a.txt file instead of just writing to the end of it]
or just
scriptname.py * numberofthread [anything here if you want it to clear the a.txt file instead of just writing to the end of it]
import glob, os, subprocess, sys, datetime, Queue, threading def writeHash(threadNum, file): hashProcess = subprocess.Popen(["CertUtil", "-hashfile", file, "MD5"], stdout=subprocess.PIPE) hash = str(hashProcess.communicate()[0]).split("\n")[1] hash = hash.replace(" ","") hash = "md5:"+hash q.put([threadNum, hash]) startDate = datetime.datetime.now() os.chdir("./") if(len(sys.argv)>3): #for retards without python in path open("a.txt", 'w').close() threadNum = 2 if(len(sys.argv)>2): threadNum = int(sys.argv[2]) threads = [] for i in range(threadNum): threads.append(threading.Thread(target=writeHash, args=(0,0))) #placeholder threads[i].daemon = True q = Queue.Queue() outFile = open("a.txt", 'a') curThread = 0 count = 0 podracing = False for file in glob.glob("f*/*"): print(str(curThread) + ": " + file) if(podracing): result = q.get() curThread = result[0] hash = result[1] outFile.write(hash) outFile.flush() threads[curThread] = threading.Thread(target=writeHash, args=(curThread, file)) threads[curThread].daemon = True threads[curThread].start() if(podracing): #should be faster than the operation below continue curThread += 1 if(curThread == (threadNum-1)): podracing = True outFile.close() print(startDate) print(datetime.datetime.now())