Пример #1
0
def send_message():

    friend_choice = select_a_friend()
    original_image = raw_input("\nWhat is the name of the image?")
    output_path = "output.jpg"

    default = raw_input(
        "Do you want to select from the special messages (y/n)? ")
    if default.upper() == "N":
        text = raw_input("What do you want to say? ")
    elif default.upper() == "Y":
        item_position = 1

        for message in SPECIAL_MESSAGES:
            print '%d. %s' % (item_position, message)
            item_position = item_position + 1

        message_selection = int(
            raw_input("\nChoose from the above messages ")) - 1

        if len(SPECIAL_MESSAGES) >= message_selection:
            if message_selection == 0:
                text = "This is an SOS"
            elif message_selection == 1:
                text = "Please Help Me!"

    Steganography.encode(original_image, output_path, text)

    new_chat = ChatMessage(text, True)

    friends[friend_choice].chats.append(new_chat)

    print "Your secret message image is ready!\n"
Пример #2
0
def read_message():
    sender = select_a_friend()

    output_path = raw_input("name of the file")
    secret_text = Steganography.decode(output_path)

    #to save the secret message in the decoded form
    new_chat = ChatMessage(secret_text, False)

    friends[sender].chats.append(new_chat)

    print colored("your secret message has been saved!", 'blue')
Пример #3
0
def read_message():  #define fxn to read message
    sender = select_a_friend()

    output_path = raw_input("What is the name of the file?")

    secret_text = Steganography.decode(output_path)

    new_chat = ChatMessage(secret_text, False)

    friends[sender].chats.append(new_chat)

    print "Your secret message has been saved!"
Пример #4
0
def send_message():  #define fxn to send messages
    friend_choice = select_a_friend()

    original_image = raw_input("What is the name of the image?")
    output_path = "output.jpg"
    text = raw_input("What do you want to say? ")
    Steganography.encode(original_image, output_path, text)

    new_chat = ChatMessage(text, True)

    friends[friend_choice].chats.append(new_chat)

    print "Your secret message image is ready!"
Пример #5
0
def send_message():  #SEND MESSAGE
    selected_frnd = select_frnd()
    original_image = raw_input(
        "What is your name of original image? ")  #name_of_original_name
    secret_text = raw_input("What is your Secret text? ")  #Secret_text
    output_path = "output.jpg"
    Steganography.encode(original_image, output_path, secret_text)
    print "MESSAGE ENCODE"

    new_chat = ChatMessage(
        secret_text,
        True)  #dictationary Type_variable_new chat  ( one message all info.)

    friends[selected_frnd].chats.append(new_chat)  #message_append
    print " Your secret message is ready!!!!! "  #print_message
Пример #6
0
def read_message():

    sender = select_a_friend()

    output_path = raw_input("What is the name of the file?")

    secret_text = Steganography.decode(output_path)

    new_chat = ChatMessage(secret_text, False)

    friend_list[sender].chats.append(new_chat)

    if secret_text.upper() in special_messages:
        print "We are on our way!\n"

    print "\nYour secret message has been saved!\n" + secret_text
Пример #7
0
def read_message():
    sender = select_a_friend()

    output_path = raw_input('What is the name of the file?')

    secret_text = Steganography.decode(output_path)
    print secret_text

    new_chat = ChatMessage(secret_text,False)

    friends[sender].chats.append(new_chat)
#this function will add chats to the chat list
    words=secret_text.split(' ')
    #avg=sum(len(word)for word in words)/ len(words)
    print 'The number of wors in the secret message is : ' + str(len(words))
    print 'Your secret message has been saved! ;)'
Пример #8
0
def send_message():

    friend_choice = select_a_friend()

    original_image = raw_input("\nWhat is the name of the image?")
    output_path = "landscape.jpg"
    text = raw_input("\nWhat do you want to say? ")
    Steganography.encode(original_image, output_path, text)

    new_chat = ChatMessage(text, True)

    friend_list[friend_choice].chats.append(new_chat)

    # if len(new_chat)>0:
    #
    #
    print "\nYour secret message image is ready!"
Пример #9
0
def send_message():

    friend_choice = select_a_friend()

    #original_image is that image in which we write our text, output_path indicates our that encoded img with the
    # secret message in it. and the text is our secret message. encode the secret message using encode()function
    original_image = raw_input("what is the name of your image?")
    output_path = "output.jpg"
    text = raw_input("write your text here")
    Steganography.encode(original_image, output_path, text)

    #to save the secret message
    new_chat = ChatMessage(text, True)

    #adding the chat in chats list from selected friend
    friends[friend_choice].chats.append(new_chat)

    print colored("your secret message image is ready!", 'red')
Пример #10
0
def read_message():

    sender = select_a_friend()

    output_path = raw_input("What is the name of the file?")

    secret_text = Steganography.decode(output_path)

    if 0 < len(secret_text.split(" ")) < 100:
        new_chat = ChatMessage(secret_text, False)

        print secret_text

    elif len(secret_text.split(" ")) > 100:
        del friends[sender]
        print "Friend deleted because he/she was talking too much!"
    else:
        print "Image doesn't have any messages"
Пример #11
0
def read_message():  #READ MESSAGE
    selected_frnd = select_frnd()
    output_path = raw_input("Which image you want to decode ? ")
    secret_text = Steganography.decode(output_path)
    print "Secret text is " + secret_text
    new_chat = ChatMessage(secret_text, False)

    friends[selected_frnd].chats.append(new_chat)

    if secret_text in ['BRB']:
        print "BE RIGHT BACK!!!"
    elif secret_text in ['HELP']:
        print "BACKU UP TEAM WILL REACH SOON"
    elif secret_text in ['SOS']:
        print "SAVE OUR SHIP"
    else:
        print "secret_text"
        print "Your secret message has been saved !!!!"
Пример #12
0
def read_message():

    sender = select_a_friend()

    output_path = raw_input("What is the name of the file?")

    try:
        secret_text = Steganography.decode(output_path)
    except:
        print "your message is not valid"
        return

    new_chat = ChatMessage(secret_text, False)

    friend_list[sender].chats.append(new_chat)

    print "\nYour secret message has been saved!\n" + secret_text

    if secret_text.upper() in special_messages:
        print "We are on our way!\n"

    if (len(secret_text.split(" "))) > 100:
        print "the spy" + spy.name + "was talking too much hence was deleted"
    del friend_list[sender]
Пример #13
0
def send_message():

    friend_choice = select_a_friend()

    original_image = raw_input("What is the name of the image?")
    output_path = "output.jpg"
    text = raw_input("What do you want to say? ")
    if len(text) == 0:
        print 'Try next time with a valid message!'
    elif text == 'SOS' or 'Save Me' or 'Save me Please':
        print 'Hold on!'
    elif text == 'False' or 'Hack' or '#' or '&' or '@' or '##' or '??':
        print 'SpyChat isnt meant for passing time!'
#no such symbols should be accepted
    else:
        print 'You are good to go!'

    Steganography.encode(original_image, output_path, text)

    new_chat = ChatMessage(text,True)

    friends[friend_choice].chats.append(new_chat)

    print "Your secret message image is ready!"