Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(prog='stegano-red')
    subparsers = parser.add_subparsers(help='sub-command help', dest='command')

    parser_hide = subparsers.add_parser('hide', help='hide help')
    parser_hide.add_argument("-i",
                             "--input",
                             dest="input_image_file",
                             help="Image file")
    parser_hide.add_argument("-m",
                             dest="secret_message",
                             help="Your secret message to hide (non binary).")
    parser_hide.add_argument("-o",
                             "--output",
                             dest="output_image_file",
                             help="Image file")

    parser_reveal = subparsers.add_parser('reveal', help='reveal help')
    parser_reveal.add_argument("-i",
                               "--input",
                               dest="input_image_file",
                               help="Image file")

    arguments = parser.parse_args()

    if arguments.command == 'hide':
        secret = red.hide(arguments.input_image_file, arguments.secret_message)
        secret.save(arguments.output_image_file)

    elif arguments.command == 'reveal':
        secret = red.reveal(arguments.input_image_file)
        print(secret)
Exemplo n.º 2
0
    def test_hide_and_reveal(self):
        messages_to_hide = ["a", "foo", "Hello World!", ":Python:"]

        for message in messages_to_hide:
            secret = red.hide("./tests/sample-files/Lenna.png", message)
            secret.save("./image.png")

            clear_message = red.reveal("./image.png")

            self.assertEqual(message, message)