54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
|
|
import stegano.lsb as lsb
|
||
|
|
|
||
|
|
|
||
|
|
class auth():
|
||
|
|
def __init__(self):
|
||
|
|
login = input('LOGIN: ')
|
||
|
|
passwd = input('PASSWD: ')
|
||
|
|
|
||
|
|
if len(login.strip()) != 0 and len(passwd.strip()):
|
||
|
|
main()
|
||
|
|
|
||
|
|
|
||
|
|
class main():
|
||
|
|
def __init__(self):
|
||
|
|
|
||
|
|
menu = '''
|
||
|
|
|
||
|
|
[1] - Спрятать текст в файле PNG или JPG
|
||
|
|
[2] - Раскрыть текст из файла PNG или JPG
|
||
|
|
help - вывести эту справку
|
||
|
|
exit - выход
|
||
|
|
|
||
|
|
|
||
|
|
'''
|
||
|
|
print(menu)
|
||
|
|
|
||
|
|
while True:
|
||
|
|
cmd = input('CMD: ')
|
||
|
|
|
||
|
|
if len(cmd.strip()) != 0:
|
||
|
|
if len(cmd.strip()) == 'help':
|
||
|
|
print(menu)
|
||
|
|
elif len(cmd.strip()) == 'exit':
|
||
|
|
break
|
||
|
|
elif len(cmd.strip()) == '1':
|
||
|
|
img = input('Введите полный путь до файла PNG или JPG: ')
|
||
|
|
text = input("Введите текст который нужно скрыть в файле: ")
|
||
|
|
|
||
|
|
if len(img.strip()) != 0 and len(text.strip()) != 0:
|
||
|
|
output = lsb.hide(img, text)
|
||
|
|
output.save('output.png')
|
||
|
|
print('Текст сохранен в файле "output.png"')
|
||
|
|
|
||
|
|
elif len(cmd.strip()) == '2':
|
||
|
|
img = input('Введите полный путь до файла PNG или JPG: ')
|
||
|
|
|
||
|
|
if len(img.strip()) != 0:
|
||
|
|
output = lsb.reveal(img)
|
||
|
|
output.save('output.txt')
|
||
|
|
print('Текст сохранен в файле "output.txt"')
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
auth()
|