mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-06-28 11:16:14 +02:00
The generator provided to lsbset.hide() lsbset.reveal() is now a function. Closes #5.
This commit is contained in:
parent
a0f6f24d7c
commit
f8668a978e
3 changed files with 29 additions and 23 deletions
12
bin/lsb-set
12
bin/lsb-set
|
@ -20,12 +20,14 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
__author__ = "Cedric Bonhomme"
|
||||
__version__ = "$Revision: 0.5 $"
|
||||
__version__ = "$Revision: 0.5.1 $"
|
||||
__date__ = "$Date: 2016/03/18 $"
|
||||
__revision__ = "$Date: 2016/05/22 $"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
try:
|
||||
from stegano import lsbset
|
||||
from stegano.lsbset import generators
|
||||
except:
|
||||
print("Install stegano: sudo pip install Stegano")
|
||||
|
||||
|
@ -67,6 +69,10 @@ parser.set_defaults(input_image_file = './pictures/Lenna.png',
|
|||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
try:
|
||||
generator = getattr(generators, options.generator_function)()
|
||||
except AttributeError as e:
|
||||
raise e
|
||||
|
||||
if options.hide:
|
||||
if options.secret_message != "" and options.secret_file == "":
|
||||
|
@ -74,7 +80,7 @@ if options.hide:
|
|||
elif options.secret_message == "" and options.secret_file != "":
|
||||
secret = tools.binary2base64(options.secret_file)
|
||||
|
||||
img_encoded = lsbset.hide(options.input_image_file, secret, options.generator_function)
|
||||
img_encoded = lsbset.hide(options.input_image_file, secret, generator)
|
||||
try:
|
||||
img_encoded.save(options.output_image_file)
|
||||
except Exception as e:
|
||||
|
@ -83,7 +89,7 @@ if options.hide:
|
|||
|
||||
elif options.reveal:
|
||||
try:
|
||||
secret = lsbset.reveal(options.input_image_file, options.generator_function)
|
||||
secret = lsbset.reveal(options.input_image_file, generator)
|
||||
except IndexError:
|
||||
print("Impossible to detect message.")
|
||||
exit(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue