Posted by updatereal on March Mon 19th 7:29 PM - Never Expires
download | new post
- #! /usr/bin/python
- from md5 import md5
- import os
- def hashLocal(thefile):
- f = file("base/" + thefile, 'rb')
- hsh = md5()
- while 1:
- data = f.read(2048)
- if not data: break
- hsh.update(data)
- f.close()
- return hsh.hexdigest()
- def downloadHash():
- os.system("wget -N http://instagib.jorgepena.be/downloads/packages/md5hash")
- def downloadFile(thefile):
- url = "http://instagib.jorgepena.be/downloads/packages/" + thefile
- dest = "base/" + thefile
- print "Downloading " + thefile + " from " + url + " to " + dest
- os.system("wget -P base/ " + url + " -N")
- # Begin
- print "Downloading the hash file..."
- downloadHash()
- failed = 0
- for line in open('md5hash', 'r'):
- print "---------------------------------------------"
- filename = line[34:].rstrip() # Get the file name
- print "File: " + filename
- rHash = line[:32]
- print "Remote Hash: " + rHash
- lHash = hashLocal(filename)
- print "Local Hash: " + lHash
- if rHash != lHash:
- print "MD5 Hash Mismatch..."
- failed = failed + 1
- downloadFile(filename)
- else:
- print "Successful Hash Comparison"
- if failed == 0:
- print "No updates available"
- else:
- print "Downloaded " + string(failed) + " updates"
Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.