import PySimpleGUI as sg
import stego

def hide():
    # Changing the color theme of the GUI
    sg.theme('Topanga')

    # Defining the layout of the window with the secret message and the image
    layout = [
        [sg.Text('Please enter the secret message')],
        [sg.Text('Secret Message', size=(15, 1)), sg.InputText(key='msg')],
        [sg.Text('Please select an image')],
        [sg.Text('Image:', size=(8, 1)), sg.Input(key='img'), sg.FileBrowse()],
        [sg.Text('Output Folder:'), sg.Input(key='folder'), sg.FolderBrowse(target='folder')],
        [sg.Submit(), sg.Cancel()]
    ]

    window = sg.Window('Hide Image', layout)
    # Reading values of the text fields and checking if we cancel the program
    event, values = window.read()
    if event in (sg.WIN_CLOSED, 'Cancel'):
        window.close()
        exit()

    # Checking if all the fields were completed in order to run the program
    while values['msg'] == '' or values['img'] == '' or values['folder'] == '':
        # If some field was empty pop up an error
        if event == 'Submit':
            sg.popup('Error: You must enter all parameters')
        # If you cancel the program, exit
        else:
            window.close()
            exit()

        # Read the values of the fields again
        event, values = window.read()

    # Checking if the selected image is a png, jpg or bmp file
    while values['img'].endswith('.png') == False and values['img'].endswith('.jpg') == False and values[
        'img'].endswith('.bmp') == False and values['img'].endswith('.jpeg') == False:
        # If not pop up an error
        if event == 'Submit':
            sg.popup('Error: You must enter a valid image file (jpg, png or bmp)')
        # If you cancel the program, exit
        else:
            window.close()
            exit()

        # Read the values of the fields again
        event, values = window.read()

    # We save the data of the fields and close the window
    data = values['msg']
    file_encode = values['img']
    outputPath = values['folder']

    window.close()
    print("THIS IS THE CONTENT")
    print(file_encode)

    return data, file_encode, outputPath

def unhide():
    # Changing the color theme of the GUI
    sg.theme('Topanga')

    # Defining the layout of the window with the secret message and the image
    layout2 = [
        [sg.Text('Please select the image with the secret message')],
        [sg.Text('Image:', size=(8, 1)), sg.Input(key='img2'), sg.FileBrowse()],
        [sg.Submit(), sg.Cancel()]
    ]

    window2 = sg.Window('Unhide image', layout2)
    # Reading values of the text fields and checking if we cancel the program
    event2, values2 = window2.read()
    if event2 in (sg.WIN_CLOSED, 'Cancel'):
        window2.close()
        exit()

    # Checking if all the fields were completed in order to run the program
    while values2['img2'] == '':
        # If some field was empty pop up an error
        if event2 == 'Submit':
            sg.popup('Error: You must select an image')
        # If you cancel the program, exit
        else:
            window2.close()
            exit()

        # Read the values of the fields again
        event2, values2 = window2.read()

    # Checking if the selected image is a png, jpg or bmp file
    while not values2['img2'].endswith('.bmp') and not values2['img2'].endswith('.png'):
        # If not pop up an error
        if event2 == 'Submit':
            sg.popup('Error: You must enter a valid image file (bmp or png)')
        # If you cancel the program, exit
        else:
            window2.close()
            exit()

        # Read the values of the fields again
        event2, values2 = window2.read()

    # We save the data of the fields and close the window

    file_decode = values2['img2']

    data = stego.stego_find(file_decode)

    sg.popup(data)

    window2.close()

    return

# Changing the color theme of the GUI
sg.theme('Topanga')

# Defining the layout of the window with the secret message and the image
layout3 = [
    [sg.Text('Welcome to StegoBMP, select a steganography option')],
    [[sg.Button('Hide')], [sg.Button('Unhide')]]
]

window3 = sg.Window('StegoBMP', layout3)
# Reading values of the text fields and checking if we cancel the program
event3, values2 = window3.read()

if event3 in (sg.WIN_CLOSED, 'Cancel'):
    window3.close()
    exit()

if event3 == 'Hide':
    window3.close()
    data, file_encode, outputPath = hide()
    data += '\0'
    print(file_encode)
    name = file_encode.rsplit("/", 1)[1]
    print(name)
    name = name.split(".")[0]
    print(name)

    # The image output is always .png but this can be changed for another format without aggressive compression like bmp
    file_output = outputPath + "/" + name + "_output.png"
    print(file_output)
    stego.stego_hide(file_encode, data.encode('ascii'), file_output)

if event3 == 'Unhide':
    window3.close()
    unhide()
6a22a745ba0515d8e7b79516116943bd93ebc0b1
<mask token>


def hide():
    sg.theme('Topanga')
    layout = [[sg.Text('Please enter the secret message')], [sg.Text(
        'Secret Message', size=(15, 1)), sg.InputText(key='msg')], [sg.Text
        ('Please select an image')], [sg.Text('Image:', size=(8, 1)), sg.
        Input(key='img'), sg.FileBrowse()], [sg.Text('Output Folder:'), sg.
        Input(key='folder'), sg.FolderBrowse(target='folder')], [sg.Submit(
        ), sg.Cancel()]]
    window = sg.Window('Hide Image', layout)
    event, values = window.read()
    if event in (sg.WIN_CLOSED, 'Cancel'):
        window.close()
        exit()
    while values['msg'] == '' or values['img'] == '' or values['folder'] == '':
        if event == 'Submit':
            sg.popup('Error: You must enter all parameters')
        else:
            window.close()
            exit()
        event, values = window.read()
    while values['img'].endswith('.png') == False and values['img'].endswith(
        '.jpg') == False and values['img'].endswith('.bmp'
        ) == False and values['img'].endswith('.jpeg') == False:
        if event == 'Submit':
            sg.popup(
                'Error: You must enter a valid image file (jpg, png or bmp)')
        else:
            window.close()
            exit()
        event, values = window.read()
    data = values['msg']
    file_encode = values['img']
    outputPath = values['folder']
    window.close()
    print('THIS IS THE CONTENT')
    print(file_encode)
    return data, file_encode, outputPath


def unhide():
    sg.theme('Topanga')
    layout2 = [[sg.Text('Please select the image with the secret message')],
        [sg.Text('Image:', size=(8, 1)), sg.Input(key='img2'), sg.
        FileBrowse()], [sg.Submit(), sg.Cancel()]]
    window2 = sg.Window('Unhide image', layout2)
    event2, values2 = window2.read()
    if event2 in (sg.WIN_CLOSED, 'Cancel'):
        window2.close()
        exit()
    while values2['img2'] == '':
        if event2 == 'Submit':
            sg.popup('Error: You must select an image')
        else:
            window2.close()
            exit()
        event2, values2 = window2.read()
    while not values2['img2'].endswith('.bmp') and not values2['img2'
        ].endswith('.png'):
        if event2 == 'Submit':
            sg.popup('Error: You must enter a valid image file (bmp or png)')
        else:
            window2.close()
            exit()
        event2, values2 = window2.read()
    file_decode = values2['img2']
    data = stego.stego_find(file_decode)
    sg.popup(data)
    window2.close()
    return


<mask token>

<mask token>


def hide():
    sg.theme('Topanga')
    layout = [[sg.Text('Please enter the secret message')], [sg.Text(
        'Secret Message', size=(15, 1)), sg.InputText(key='msg')], [sg.Text
        ('Please select an image')], [sg.Text('Image:', size=(8, 1)), sg.
        Input(key='img'), sg.FileBrowse()], [sg.Text('Output Folder:'), sg.
        Input(key='folder'), sg.FolderBrowse(target='folder')], [sg.Submit(
        ), sg.Cancel()]]
    window = sg.Window('Hide Image', layout)
    event, values = window.read()
    if event in (sg.WIN_CLOSED, 'Cancel'):
        window.close()
        exit()
    while values['msg'] == '' or values['img'] == '' or values['folder'] == '':
        if event == 'Submit':
            sg.popup('Error: You must enter all parameters')
        else:
            window.close()
            exit()
        event, values = window.read()
    while values['img'].endswith('.png') == False and values['img'].endswith(
        '.jpg') == False and values['img'].endswith('.bmp'
        ) == False and values['img'].endswith('.jpeg') == False:
        if event == 'Submit':
            sg.popup(
                'Error: You must enter a valid image file (jpg, png or bmp)')
        else:
            window.close()
            exit()
        event, values = window.read()
    data = values['msg']
    file_encode = values['img']
    outputPath = values['folder']
    window.close()
    print('THIS IS THE CONTENT')
    print(file_encode)
    return data, file_encode, outputPath


def unhide():
    sg.theme('Topanga')
    layout2 = [[sg.Text('Please select the image with the secret message')],
        [sg.Text('Image:', size=(8, 1)), sg.Input(key='img2'), sg.
        FileBrowse()], [sg.Submit(), sg.Cancel()]]
    window2 = sg.Window('Unhide image', layout2)
    event2, values2 = window2.read()
    if event2 in (sg.WIN_CLOSED, 'Cancel'):
        window2.close()
        exit()
    while values2['img2'] == '':
        if event2 == 'Submit':
            sg.popup('Error: You must select an image')
        else:
            window2.close()
            exit()
        event2, values2 = window2.read()
    while not values2['img2'].endswith('.bmp') and not values2['img2'
        ].endswith('.png'):
        if event2 == 'Submit':
            sg.popup('Error: You must enter a valid image file (bmp or png)')
        else:
            window2.close()
            exit()
        event2, values2 = window2.read()
    file_decode = values2['img2']
    data = stego.stego_find(file_decode)
    sg.popup(data)
    window2.close()
    return


sg.theme('Topanga')
<mask token>
if event3 in (sg.WIN_CLOSED, 'Cancel'):
    window3.close()
    exit()
if event3 == 'Hide':
    window3.close()
    data, file_encode, outputPath = hide()
    data += '\x00'
    print(file_encode)
    name = file_encode.rsplit('/', 1)[1]
    print(name)
    name = name.split('.')[0]
    print(name)
    file_output = outputPath + '/' + name + '_output.png'
    print(file_output)
    stego.stego_hide(file_encode, data.encode('ascii'), file_output)
if event3 == 'Unhide':
    window3.close()
    unhide()

<mask token>


def hide():
    sg.theme('Topanga')
    layout = [[sg.Text('Please enter the secret message')], [sg.Text(
        'Secret Message', size=(15, 1)), sg.InputText(key='msg')], [sg.Text
        ('Please select an image')], [sg.Text('Image:', size=(8, 1)), sg.
        Input(key='img'), sg.FileBrowse()], [sg.Text('Output Folder:'), sg.
        Input(key='folder'), sg.FolderBrowse(target='folder')], [sg.Submit(
        ), sg.Cancel()]]
    window = sg.Window('Hide Image', layout)
    event, values = window.read()
    if event in (sg.WIN_CLOSED, 'Cancel'):
        window.close()
        exit()
    while values['msg'] == '' or values['img'] == '' or values['folder'] == '':
        if event == 'Submit':
            sg.popup('Error: You must enter all parameters')
        else:
            window.close()
            exit()
        event, values = window.read()
    while values['img'].endswith('.png') == False and values['img'].endswith(
        '.jpg') == False and values['img'].endswith('.bmp'
        ) == False and values['img'].endswith('.jpeg') == False:
        if event == 'Submit':
            sg.popup(
                'Error: You must enter a valid image file (jpg, png or bmp)')
        else:
            window.close()
            exit()
        event, values = window.read()
    data = values['msg']
    file_encode = values['img']
    outputPath = values['folder']
    window.close()
    print('THIS IS THE CONTENT')
    print(file_encode)
    return data, file_encode, outputPath


def unhide():
    sg.theme('Topanga')
    layout2 = [[sg.Text('Please select the image with the secret message')],
        [sg.Text('Image:', size=(8, 1)), sg.Input(key='img2'), sg.
        FileBrowse()], [sg.Submit(), sg.Cancel()]]
    window2 = sg.Window('Unhide image', layout2)
    event2, values2 = window2.read()
    if event2 in (sg.WIN_CLOSED, 'Cancel'):
        window2.close()
        exit()
    while values2['img2'] == '':
        if event2 == 'Submit':
            sg.popup('Error: You must select an image')
        else:
            window2.close()
            exit()
        event2, values2 = window2.read()
    while not values2['img2'].endswith('.bmp') and not values2['img2'
        ].endswith('.png'):
        if event2 == 'Submit':
            sg.popup('Error: You must enter a valid image file (bmp or png)')
        else:
            window2.close()
            exit()
        event2, values2 = window2.read()
    file_decode = values2['img2']
    data = stego.stego_find(file_decode)
    sg.popup(data)
    window2.close()
    return


sg.theme('Topanga')
layout3 = [[sg.Text('Welcome to StegoBMP, select a steganography option')],
    [[sg.Button('Hide')], [sg.Button('Unhide')]]]
window3 = sg.Window('StegoBMP', layout3)
event3, values2 = window3.read()
if event3 in (sg.WIN_CLOSED, 'Cancel'):
    window3.close()
    exit()
if event3 == 'Hide':
    window3.close()
    data, file_encode, outputPath = hide()
    data += '\x00'
    print(file_encode)
    name = file_encode.rsplit('/', 1)[1]
    print(name)
    name = name.split('.')[0]
    print(name)
    file_output = outputPath + '/' + name + '_output.png'
    print(file_output)
    stego.stego_hide(file_encode, data.encode('ascii'), file_output)
if event3 == 'Unhide':
    window3.close()
    unhide()

import PySimpleGUI as sg
import stego


def hide():
    sg.theme('Topanga')
    layout = [[sg.Text('Please enter the secret message')], [sg.Text(
        'Secret Message', size=(15, 1)), sg.InputText(key='msg')], [sg.Text
        ('Please select an image')], [sg.Text('Image:', size=(8, 1)), sg.
        Input(key='img'), sg.FileBrowse()], [sg.Text('Output Folder:'), sg.
        Input(key='folder'), sg.FolderBrowse(target='folder')], [sg.Submit(
        ), sg.Cancel()]]
    window = sg.Window('Hide Image', layout)
    event, values = window.read()
    if event in (sg.WIN_CLOSED, 'Cancel'):
        window.close()
        exit()
    while values['msg'] == '' or values['img'] == '' or values['folder'] == '':
        if event == 'Submit':
            sg.popup('Error: You must enter all parameters')
        else:
            window.close()
            exit()
        event, values = window.read()
    while values['img'].endswith('.png') == False and values['img'].endswith(
        '.jpg') == False and values['img'].endswith('.bmp'
        ) == False and values['img'].endswith('.jpeg') == False:
        if event == 'Submit':
            sg.popup(
                'Error: You must enter a valid image file (jpg, png or bmp)')
        else:
            window.close()
            exit()
        event, values = window.read()
    data = values['msg']
    file_encode = values['img']
    outputPath = values['folder']
    window.close()
    print('THIS IS THE CONTENT')
    print(file_encode)
    return data, file_encode, outputPath


def unhide():
    sg.theme('Topanga')
    layout2 = [[sg.Text('Please select the image with the secret message')],
        [sg.Text('Image:', size=(8, 1)), sg.Input(key='img2'), sg.
        FileBrowse()], [sg.Submit(), sg.Cancel()]]
    window2 = sg.Window('Unhide image', layout2)
    event2, values2 = window2.read()
    if event2 in (sg.WIN_CLOSED, 'Cancel'):
        window2.close()
        exit()
    while values2['img2'] == '':
        if event2 == 'Submit':
            sg.popup('Error: You must select an image')
        else:
            window2.close()
            exit()
        event2, values2 = window2.read()
    while not values2['img2'].endswith('.bmp') and not values2['img2'
        ].endswith('.png'):
        if event2 == 'Submit':
            sg.popup('Error: You must enter a valid image file (bmp or png)')
        else:
            window2.close()
            exit()
        event2, values2 = window2.read()
    file_decode = values2['img2']
    data = stego.stego_find(file_decode)
    sg.popup(data)
    window2.close()
    return


sg.theme('Topanga')
layout3 = [[sg.Text('Welcome to StegoBMP, select a steganography option')],
    [[sg.Button('Hide')], [sg.Button('Unhide')]]]
window3 = sg.Window('StegoBMP', layout3)
event3, values2 = window3.read()
if event3 in (sg.WIN_CLOSED, 'Cancel'):
    window3.close()
    exit()
if event3 == 'Hide':
    window3.close()
    data, file_encode, outputPath = hide()
    data += '\x00'
    print(file_encode)
    name = file_encode.rsplit('/', 1)[1]
    print(name)
    name = name.split('.')[0]
    print(name)
    file_output = outputPath + '/' + name + '_output.png'
    print(file_output)
    stego.stego_hide(file_encode, data.encode('ascii'), file_output)
if event3 == 'Unhide':
    window3.close()
    unhide()

import PySimpleGUI as sg
import stego

def hide():
    # Changing the color theme of the GUI
    sg.theme('Topanga')

    # Defining the layout of the window with the secret message and the image
    layout = [
        [sg.Text('Please enter the secret message')],
        [sg.Text('Secret Message', size=(15, 1)), sg.InputText(key='msg')],
        [sg.Text('Please select an image')],
        [sg.Text('Image:', size=(8, 1)), sg.Input(key='img'), sg.FileBrowse()],
        [sg.Text('Output Folder:'), sg.Input(key='folder'), sg.FolderBrowse(target='folder')],
        [sg.Submit(), sg.Cancel()]
    ]

    window = sg.Window('Hide Image', layout)
    # Reading values of the text fields and checking if we cancel the program
    event, values = window.read()
    if event in (sg.WIN_CLOSED, 'Cancel'):
        window.close()
        exit()

    # Checking if all the fields were completed in order to run the program
    while values['msg'] == '' or values['img'] == '' or values['folder'] == '':
        # If some field was empty pop up an error
        if event == 'Submit':
            sg.popup('Error: You must enter all parameters')
        # If you cancel the program, exit
        else:
            window.close()
            exit()

        # Read the values of the fields again
        event, values = window.read()

    # Checking if the selected image is a png, jpg or bmp file
    while values['img'].endswith('.png') == False and values['img'].endswith('.jpg') == False and values[
        'img'].endswith('.bmp') == False and values['img'].endswith('.jpeg') == False:
        # If not pop up an error
        if event == 'Submit':
            sg.popup('Error: You must enter a valid image file (jpg, png or bmp)')
        # If you cancel the program, exit
        else:
            window.close()
            exit()

        # Read the values of the fields again
        event, values = window.read()

    # We save the data of the fields and close the window
    data = values['msg']
    file_encode = values['img']
    outputPath = values['folder']

    window.close()
    print("THIS IS THE CONTENT")
    print(file_encode)

    return data, file_encode, outputPath

def unhide():
    # Changing the color theme of the GUI
    sg.theme('Topanga')

    # Defining the layout of the window with the secret message and the image
    layout2 = [
        [sg.Text('Please select the image with the secret message')],
        [sg.Text('Image:', size=(8, 1)), sg.Input(key='img2'), sg.FileBrowse()],
        [sg.Submit(), sg.Cancel()]
    ]

    window2 = sg.Window('Unhide image', layout2)
    # Reading values of the text fields and checking if we cancel the program
    event2, values2 = window2.read()
    if event2 in (sg.WIN_CLOSED, 'Cancel'):
        window2.close()
        exit()

    # Checking if all the fields were completed in order to run the program
    while values2['img2'] == '':
        # If some field was empty pop up an error
        if event2 == 'Submit':
            sg.popup('Error: You must select an image')
        # If you cancel the program, exit
        else:
            window2.close()
            exit()

        # Read the values of the fields again
        event2, values2 = window2.read()

    # Checking if the selected image is a png, jpg or bmp file
    while not values2['img2'].endswith('.bmp') and not values2['img2'].endswith('.png'):
        # If not pop up an error
        if event2 == 'Submit':
            sg.popup('Error: You must enter a valid image file (bmp or png)')
        # If you cancel the program, exit
        else:
            window2.close()
            exit()

        # Read the values of the fields again
        event2, values2 = window2.read()

    # We save the data of the fields and close the window

    file_decode = values2['img2']

    data = stego.stego_find(file_decode)

    sg.popup(data)

    window2.close()

    return

# Changing the color theme of the GUI
sg.theme('Topanga')

# Defining the layout of the window with the secret message and the image
layout3 = [
    [sg.Text('Welcome to StegoBMP, select a steganography option')],
    [[sg.Button('Hide')], [sg.Button('Unhide')]]
]

window3 = sg.Window('StegoBMP', layout3)
# Reading values of the text fields and checking if we cancel the program
event3, values2 = window3.read()

if event3 in (sg.WIN_CLOSED, 'Cancel'):
    window3.close()
    exit()

if event3 == 'Hide':
    window3.close()
    data, file_encode, outputPath = hide()
    data += '\0'
    print(file_encode)
    name = file_encode.rsplit("/", 1)[1]
    print(name)
    name = name.split(".")[0]
    print(name)

    # The image output is always .png but this can be changed for another format without aggressive compression like bmp
    file_output = outputPath + "/" + name + "_output.png"
    print(file_output)
    stego.stego_hide(file_encode, data.encode('ascii'), file_output)

if event3 == 'Unhide':
    window3.close()
    unhide()