mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-13 09:28:31 +02:00
list available choices for the arguments when necessary
This commit is contained in:
parent
61b6ec7175
commit
8f73d9e733
3 changed files with 29 additions and 9 deletions
|
@ -1,10 +1,15 @@
|
||||||
Release History
|
Release History
|
||||||
===============
|
===============
|
||||||
|
|
||||||
0.8.1 (not yet released)
|
0.8.1 (2017-05-16)
|
||||||
------------------------
|
------------------
|
||||||
* it is now possible to specify the encoding (UTF-8 or UTF-32LE) of the message
|
* it is now possible to specify the encoding (UTF-8 or UTF-32LE) of the message
|
||||||
to hide/reveal through the command line.
|
to hide/reveal through the command line;
|
||||||
|
* the help of the command line now displays the available choices for the
|
||||||
|
arguments, if it is necessary (list of available encodings, list of available
|
||||||
|
generators);
|
||||||
|
* tests expected results lies now in a dedicated folder;
|
||||||
|
* a script has been added in order to get proper exit code check for mypy.
|
||||||
|
|
||||||
0.8 (2017-05-06)
|
0.8 (2017-05-06)
|
||||||
----------------
|
----------------
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
__author__ = "Cedric Bonhomme"
|
__author__ = "Cedric Bonhomme"
|
||||||
__version__ = "$Revision: 0.6 $"
|
__version__ = "$Revision: 0.7 $"
|
||||||
__date__ = "$Date: 2016/08/04 $"
|
__date__ = "$Date: 2016/08/04 $"
|
||||||
|
__revision__ = "$Date: 2017/05/16 $"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -40,7 +41,8 @@ parser_hide = subparsers.add_parser('hide', help='hide help')
|
||||||
# Original image
|
# Original image
|
||||||
parser_hide.add_argument("-i", "--input", dest="input_image_file",
|
parser_hide.add_argument("-i", "--input", dest="input_image_file",
|
||||||
required=True, help="Input image file.")
|
required=True, help="Input image file.")
|
||||||
parser_hide.add_argument("-e", "--encoding", dest="encoding", default="UTF-8",
|
parser_hide.add_argument("-e", "--encoding", dest="encoding",
|
||||||
|
choices=tools.ENCODINGS.keys(),
|
||||||
help="Specify the encoding of the message to hide." +
|
help="Specify the encoding of the message to hide." +
|
||||||
" UTF-8 (default) or UTF-32LE.")
|
" UTF-8 (default) or UTF-32LE.")
|
||||||
|
|
||||||
|
@ -61,7 +63,8 @@ parser_hide.add_argument("-o", "--output", dest="output_image_file",
|
||||||
parser_reveal = subparsers.add_parser('reveal', help='reveal help')
|
parser_reveal = subparsers.add_parser('reveal', help='reveal help')
|
||||||
parser_reveal.add_argument("-i", "--input", dest="input_image_file",
|
parser_reveal.add_argument("-i", "--input", dest="input_image_file",
|
||||||
required=True, help="Input image file.")
|
required=True, help="Input image file.")
|
||||||
parser_reveal.add_argument("-e", "--encoding", dest="encoding", default="UTF-8",
|
parser_reveal.add_argument("-e", "--encoding", dest="encoding",
|
||||||
|
choices=tools.ENCODINGS.keys(),
|
||||||
help="Specify the encoding of the message to reveal." +
|
help="Specify the encoding of the message to reveal." +
|
||||||
" UTF-8 (default) or UTF-32LE.")
|
" UTF-8 (default) or UTF-32LE.")
|
||||||
parser_reveal.add_argument("-o", dest="secret_binary",
|
parser_reveal.add_argument("-o", dest="secret_binary",
|
||||||
|
|
|
@ -20,11 +20,12 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
__author__ = "Cedric Bonhomme"
|
__author__ = "Cedric Bonhomme"
|
||||||
__version__ = "$Revision: 0.6 $"
|
__version__ = "$Revision: 0.7 $"
|
||||||
__date__ = "$Date: 2016/03/18 $"
|
__date__ = "$Date: 2016/03/18 $"
|
||||||
__revision__ = "$Date: 2016/08/04 $"
|
__revision__ = "$Date: 2017/05/16 $"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
|
|
||||||
|
import inspect
|
||||||
import crayons
|
import crayons
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -44,9 +45,15 @@ parser_hide = subparsers.add_parser('hide', help='hide help')
|
||||||
# Original image
|
# Original image
|
||||||
parser_hide.add_argument("-i", "--input", dest="input_image_file",
|
parser_hide.add_argument("-i", "--input", dest="input_image_file",
|
||||||
required=True, help="Input image file.")
|
required=True, help="Input image file.")
|
||||||
|
parser_hide.add_argument("-e", "--encoding", dest="encoding",
|
||||||
|
choices=tools.ENCODINGS.keys(),
|
||||||
|
help="Specify the encoding of the message to hide." +
|
||||||
|
" UTF-8 (default) or UTF-32LE.")
|
||||||
|
|
||||||
# Generator
|
# Generator
|
||||||
parser_hide.add_argument("-g", "--generator", dest="generator_function",
|
parser_hide.add_argument("-g", "--generator", dest="generator_function",
|
||||||
|
choices=[generator[0] for generator in \
|
||||||
|
inspect.getmembers(generators, inspect.isfunction)],
|
||||||
required=True, help="Generator")
|
required=True, help="Generator")
|
||||||
|
|
||||||
group_secret = parser_hide.add_mutually_exclusive_group(required=True)
|
group_secret = parser_hide.add_mutually_exclusive_group(required=True)
|
||||||
|
@ -66,7 +73,13 @@ parser_hide.add_argument("-o", "--output", dest="output_image_file",
|
||||||
parser_reveal = subparsers.add_parser('reveal', help='reveal help')
|
parser_reveal = subparsers.add_parser('reveal', help='reveal help')
|
||||||
parser_reveal.add_argument("-i", "--input", dest="input_image_file",
|
parser_reveal.add_argument("-i", "--input", dest="input_image_file",
|
||||||
required=True, help="Input image file.")
|
required=True, help="Input image file.")
|
||||||
|
parser_reveal.add_argument("-e", "--encoding", dest="encoding",
|
||||||
|
choices=tools.ENCODINGS.keys(),
|
||||||
|
help="Specify the encoding of the message to reveal." +
|
||||||
|
" UTF-8 (default) or UTF-32LE.")
|
||||||
parser_reveal.add_argument("-g", "--generator", dest="generator_function",
|
parser_reveal.add_argument("-g", "--generator", dest="generator_function",
|
||||||
|
choices=[generator[0] for generator in \
|
||||||
|
inspect.getmembers(generators, inspect.isfunction)],
|
||||||
required=True, help="Generator")
|
required=True, help="Generator")
|
||||||
parser_reveal.add_argument("-o", dest="secret_binary",
|
parser_reveal.add_argument("-o", dest="secret_binary",
|
||||||
help="Output for the binary secret (Text or any binary file).")
|
help="Output for the binary secret (Text or any binary file).")
|
||||||
|
@ -119,7 +132,6 @@ elif arguments.command == 'reveal':
|
||||||
print(secret)
|
print(secret)
|
||||||
|
|
||||||
elif arguments.command == 'list-generators':
|
elif arguments.command == 'list-generators':
|
||||||
import inspect
|
|
||||||
all_generators = inspect.getmembers(generators, inspect.isfunction)
|
all_generators = inspect.getmembers(generators, inspect.isfunction)
|
||||||
for generator in all_generators:
|
for generator in all_generators:
|
||||||
print('Generator id:')
|
print('Generator id:')
|
||||||
|
|
Loading…
Add table
Reference in a new issue