Hack Tendance3
Hack Tendance3
def decrypt_text(text):
cipher_suite = Fernet(ENCRYPTION_KEY)
decrypted_text = cipher_suite.decrypt(text.encode())
return decrypted_text.decode()
def main():
print(
"\n[Welcome to Image Text Hider. This script can hide text inside an
image]\n"
)
print("To hide text inside an image:")
print(
"USAGE: python img_text_hider.py hide img_name_with_path.jpg 'This is my
secret message' output_file_name.jpg\n"
)
print("To reveal the hidden text inside an image:")
print("USAGE: python img_text_hider.py reveal hidden_img_name.jpg\n")
# Hide command
hide_parser = subparsers.add_parser("hide", help="Hide text behind an image")
hide_parser.add_argument("image", help="Path to the image file")
hide_parser.add_argument("text", help="Text to hide")
hide_parser.add_argument(
"output", help="Output path for the image with hidden text"
)
hide_parser.add_argument("--password", help="Password for encryption")
# Reveal command
reveal_parser = subparsers.add_parser("reveal", help="Reveal text from an
image")
reveal_parser.add_argument("image", help="Path to the image file")
reveal_parser.add_argument("--password", help="Password for decryption")
args = parser.parse_args()
if args.command == "hide":
if os.path.exists(args.image):
hide_text_in_image(args.image, args.text, args.output, args.password)
else:
print(
"The specified image path does not exist. Please check the image
path and file name with extension."
)
elif args.command == "reveal":
if os.path.exists(args.image):
revealed_text = reveal_text_from_image(args.image, args.password)
if revealed_text:
print(f"Revealed text: [{revealed_text}]")
else:
print(
"The specified image path does not exist. Please check the image
path and file name with extension."
)
if __name__ == "__main__":
main()