Exemplo n.º 1
0
def send_message():
    #select a friend
    friend_choice = select_friend()

    #select an image for steganography
    original_image = raw_input("Enter the name of the image: ")
    output_path = "output.jpg"

    #message to be hidden using steganography
    text = raw_input("What would you like to say? ")

    #hiding message using steganography
    Steganography.encode(original_image, output_path, text)

    #check if secret text left empty
    if text != "":
        new_chat = chatMessage(text, True)
        friends[friend_choice].chats.append(new_chat)
        print "\nYour secret message has been created and ready for use!"
        #appending messages to a text file
        file = open("message.txt", "a")
        file.write(text)
        file.write(",")
        file.close()
    else:
        print "\nIt seems you didn\'t enter the secret message. Please try again!!!"
Exemplo n.º 2
0
def send_message():
	print("Choose the friend to whom you want to send the message")
	friend_choice = select_friend()
	message=[]
	message1 = raw_input("Enter the message to be send: ")
	formatted_time=time.asctime( time.localtime(time.time()) )
	message.append(message1)
	message.append(formatted_time)
	new_chat_message = chatMessage(message, True)

	friends[friend_choice].chats.append(new_chat_message)
	print("Your message has been sent to %s" %friends[friend_choice].name)
Exemplo n.º 3
0
def load_chat():
    read_chat = open('chat.csv', 'rt')
    reader = csv.reader(read_chat)
    for row in reader:
        name = row[0]
        msg = chatMessage(row[1], row[2])
        #friend_choice=select_friend()
        for i in range(len(friends)):
            if friends[i].name == name:
                friends[i].chats.append(msg)
                #print(friends[i].chats)

    read_chat.close()
Exemplo n.º 4
0
def read_message():
    # Selecting friend from which we want to read the message.
    sender = select_friend()
    # output path describing the location of the file.
    output_path = raw_input("What is The Name of File.")
    # Decoding the message send in the given image.
    secret_text = Steganography.decode(output_path)
    # storing that message to new_chat send by friend
    new_chat = chatMessage(secret_text, False)
    # print the message send by friend
    print secret_text
    # friend sended message to enlisted in the message send by the selected friend
    friend[sender].chat.append(new_chat)
    # printing to notify that message is being saved.
    print "Your Secret Message is been Saved."
Exemplo n.º 5
0
def send_message():
    print("Choose the friend to whom you want to send the message")
    friend_choice = select_friend()

    message1 = []
    original_image = input("Enter the name of the image")
    output_path = 'output.bmp'
    message = input("Enter the message to be send: ")
    Steganography.encode(original_image, output_path, message)
    send_chat_time = time.ctime()
    message1.append(message)
    message1.append(send_chat_time)

    new_chat_message = chatMessage(message1, True)

    friends[friend_choice].chats.append(new_chat_message)
    print("Your message has been sent by:- %s" % friends[friend_choice].name)
    print('sending time:- %s' % (send_chat_time))
Exemplo n.º 6
0
def read_message():
    print("Choose the friend whose message you want to read")
    friend_choice = select_friend()
    read_message1 = []
    Read_chat_time = time.ctime()
    #read_message1.append(send_message())
    read_message1.append(Read_chat_time)

    output_path = input("What is the output_path name")
    message = Steganography.decode(output_path)
    new_chat_message = chatMessage(message, False)

    friends[friend_choice].chats.append(new_chat_message)

    if len(friends[friend_choice].chats) == 0:
        print("You have no conversation with %s" % friends[friend_choice].name)
    else:
        for i in range(len(friends[friend_choice].chats)):
            print(friends[friend_choice].chats[i].message)
            print("read_message_time :- %s " % (read_message1))
Exemplo n.º 7
0
def send_message():
    # calling function select_friend
    friend_choice = select_friend()
    # Describing the name and location of original image
    original_image = raw_input("Name of The Image:")
    # Describing the path where our output message is stored
    output_path = 'output.jpg'
    sub = ' '
    # What message do we want to send to the user
    text = raw_input("What Secret Message:")
    if text.count(sub) >= 20:
        print "Error."
    # The message is encoded through the Steganography encode method
    else:
        Steganography.encode(original_image, output_path, text)
        # Message is send by me.
        new_chat = chatMessage(text, True)
        # Adding details to friend list about chat send by me/user
        friend[friend_choice].chat.append(new_chat)
        # printing message to notify that  message is sent.
        print "Your Chat Message is Ready."
Exemplo n.º 8
0
def read_message():
    #choose the sender
    sender = select_friend()

    #decode the secret message using an image
    output_path = raw_input("What is the name of the output file? ")
    secret_text = Steganography.decode(output_path)
    print secret_text

    #if spy sends any SOS message
    if secret_text == "SOS" or secret_text == "SAVE ME" or secret_text == "HELP ME":
        print "The spy is in a trouble"
    else:
        new_chat = chatMessage(secret_text, False)
        friends[sender].chats.append(new_chat)
        #displaying the secret text
        print "Your decoded secret message is " + colored(secret_text, "blue")

    #reading messages from the file
    file = open("message.txt", "r")
    str = file.read()
    print "Messages stored in file are: %s" % colored(str, "blue")