WIP: hashing the proper parts of the jpg image
This commit is contained in:
parent
ed28d01437
commit
e0d7466730
|
@ -16,7 +16,11 @@ class JpgTools:
|
|||
# process a jpg file, read only
|
||||
#
|
||||
def getJpgBin(self, fname):
|
||||
return self.processFile(fname)
|
||||
self.fh = open(fname, "rb")
|
||||
self.jpg = JpgBin()
|
||||
retval = self.jpg.processFile(self.fh)
|
||||
logging.info("processFile()=={}".format(retval))
|
||||
return self.jpg
|
||||
|
||||
#
|
||||
# process a jpg file, create new jpg with crypto keys
|
||||
|
@ -27,24 +31,3 @@ class JpgTools:
|
|||
retval = self.jpg.processFile(self.fh)
|
||||
logging.info("processFile()=={}".format(retval))
|
||||
|
||||
#
|
||||
def processFile(self, fname):
|
||||
self.fh = open(fname, "rb")
|
||||
self.jpg = JpgBin()
|
||||
retval = self.jpg.processFile(self.fh)
|
||||
logging.info("processFile()=={}".format(retval))
|
||||
return self.jpg
|
||||
|
||||
#
|
||||
def process_OLD(self, fname):
|
||||
Image.open(fname)
|
||||
# image as a sequence object containing pixel values
|
||||
bin_data = list( im.getdata() )
|
||||
# returns a string containing pixel data, using the standard "raw" encoder
|
||||
im.tostring()
|
||||
|
||||
#
|
||||
# def getJpgBin_OLD(self, fname):
|
||||
# img_h = Image.open(fname)
|
||||
# img_h.???
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ from libs.crypto_pub import Signature
|
|||
from libs.toolbox import Toolbox
|
||||
from libs.jpg_tools import JpgTools
|
||||
|
||||
fingerprint = False
|
||||
|
||||
def main():
|
||||
parseArgs()
|
||||
|
@ -21,6 +22,8 @@ def main():
|
|||
def processImage(image_fn):
|
||||
jpg = JpgTools()
|
||||
jpg_bin = jpg.getJpgBin(image_fn)
|
||||
|
||||
if (fingerprint):
|
||||
print( str(jpg_bin) )
|
||||
# sig = Signature()
|
||||
# sig.genSig(img_bin)
|
||||
|
@ -66,6 +69,7 @@ def parseArgs():
|
|||
parser.add_argument('-v', '--verbose', action='store_true', help="will set logging level to INFO")
|
||||
parser.add_argument('-vv', '--vverbose', action='store_true', help="will set logging level to DEBUG")
|
||||
parser.add_argument('-l', '--logging', action='store_true', help="will supercede the -v option and send all logging to a file, logging.DEBUG")
|
||||
parser.add_argument('-fp', '--fingerprint', action='store_true', help="fingerprint")
|
||||
args = parser.parse_args()
|
||||
|
||||
if (args.logging):
|
||||
|
@ -78,6 +82,9 @@ def parseArgs():
|
|||
else:
|
||||
logging.basicConfig(level=logging.CRITICAL)
|
||||
|
||||
if (args.fingerprint):
|
||||
fingerprint = True
|
||||
|
||||
if (args.image):
|
||||
processImage(args.image)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue