From 4aac55ec7716471091191d66229ec6bab907cac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonhomme?= Date: Mon, 1 Nov 2021 13:52:16 +0100 Subject: [PATCH] chg: [core ] various minor fixes. --- pyproject.toml | 2 +- stegano/exifHeader/exifHeader.py | 4 ++-- stegano/lsbset/lsbset.py | 2 +- stegano/steganalysis/statistics.py | 5 +---- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9bfbf7e..9f67c27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,9 +22,9 @@ classifiers = [ "Intended Audience :: Science/Research", "Topic :: Security", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)" ] diff --git a/stegano/exifHeader/exifHeader.py b/stegano/exifHeader/exifHeader.py index 8918331..1b67d9d 100644 --- a/stegano/exifHeader/exifHeader.py +++ b/stegano/exifHeader/exifHeader.py @@ -37,13 +37,13 @@ def hide( from zlib import compress from base64 import b64encode - if secret_file != None: + if secret_file is not None: with open(secret_file, "r") as f: secret_message = f.read() try: text = compress(b64encode(bytes(secret_message, "utf-8"))) - except: + except Exception: text = compress(b64encode(secret_message)) img = tools.open_image(input_image_file) diff --git a/stegano/lsbset/lsbset.py b/stegano/lsbset/lsbset.py index 3a9583e..2d0230b 100644 --- a/stegano/lsbset/lsbset.py +++ b/stegano/lsbset/lsbset.py @@ -128,7 +128,7 @@ def reveal( if count == tools.ENCODINGS[encoding]: bitab.append(chr(buff)) buff, count = 0, 0 - if bitab[-1] == ":" and limit == None: + if bitab[-1] == ":" and limit is None: if "".join(bitab[:-1]).isdigit(): limit = int("".join(bitab[:-1])) else: diff --git a/stegano/steganalysis/statistics.py b/stegano/steganalysis/statistics.py index dde980e..4e90b3f 100644 --- a/stegano/steganalysis/statistics.py +++ b/stegano/steganalysis/statistics.py @@ -22,13 +22,11 @@ __author__ = "Cedric Bonhomme" __version__ = "$Revision: 0.2 $" __date__ = "$Date: 2010/10/01 $" -__revision__ = "$Date: 2016/08/26 $" +__revision__ = "$Date: 2021/11/01 $" __license__ = "GPLv3" import typing -import operator -from PIL import Image from collections import Counter from collections import OrderedDict @@ -37,7 +35,6 @@ def steganalyse(img): """ Steganlysis of the LSB technique. """ - encoded = img.copy() width, height = img.size colours_counter = Counter() # type: typing.Counter[int] for row in range(height):