mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Fixed #12. More tests to come.
This commit is contained in:
parent
091f33c521
commit
7a5c23ef2f
3 changed files with 6 additions and 15 deletions
7
bin/lsb
7
bin/lsb
|
@ -81,13 +81,6 @@ if arguments.command == 'hide':
|
||||||
elif arguments.command == 'reveal':
|
elif arguments.command == 'reveal':
|
||||||
secret = lsb.reveal(arguments.input_image_file)
|
secret = lsb.reveal(arguments.input_image_file)
|
||||||
if arguments.secret_binary != None:
|
if arguments.secret_binary != None:
|
||||||
"""data = tools.base642binary(secret)
|
|
||||||
from PIL import Image
|
|
||||||
import io
|
|
||||||
file_like = io.BytesIO(data)
|
|
||||||
file_like.seek(0)
|
|
||||||
image = Image.open(file_like)
|
|
||||||
image.save(arguments.secret_binary)"""
|
|
||||||
data = tools.base642binary(secret)
|
data = tools.base642binary(secret)
|
||||||
with open(arguments.secret_binary, "wb") as f:
|
with open(arguments.secret_binary, "wb") as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -36,7 +36,7 @@ with open('CHANGELOG.rst', 'r') as f:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='Stegano',
|
name='Stegano',
|
||||||
version='0.6.7',
|
version='0.6.8',
|
||||||
author='Cédric Bonhomme',
|
author='Cédric Bonhomme',
|
||||||
author_email='cedric@cedricbonhomme.org',
|
author_email='cedric@cedricbonhomme.org',
|
||||||
packages=packages,
|
packages=packages,
|
||||||
|
|
|
@ -89,15 +89,13 @@ def binary2base64(binary_file):
|
||||||
printable string.
|
printable string.
|
||||||
"""
|
"""
|
||||||
# Use mode = "rb" to read binary file
|
# Use mode = "rb" to read binary file
|
||||||
fin = open(binary_file, "rb")
|
with open(binary_file, "rb") as bin_file:
|
||||||
binary_data = fin.read()
|
encoded_string = base64.b64encode(bin_file.read())
|
||||||
fin.close()
|
return encoded_string.decode()
|
||||||
# Encode binary to base64 string (printable)
|
|
||||||
return base64.b64encode(binary_data)
|
|
||||||
|
|
||||||
def base642binary(b64_fname):
|
def base642binary(b64_fname):
|
||||||
"""
|
"""
|
||||||
Convert a printable file to a binary file.
|
Convert a printable file to a binary file.
|
||||||
"""
|
"""
|
||||||
b64_fname += b'==='
|
b64_fname += '==='
|
||||||
return base64.decodestring(b64_fname)
|
return base64.b64decode(b64_fname)
|
||||||
|
|
Loading…
Add table
Reference in a new issue