コード例 #1
0
def send_message():
    selected_frnd = select_frnd()
    original_image = raw_input('what is the name of original image? ')
    secret_text = raw_input('what is your text? ')
    output_path = 'output.jpg'
    Steganography.encode(original_image, output_path, secret_text)
    print 'Messgae encoded'
コード例 #2
0
def send_message():
    selected_friend = select_frnd()


    original_image = raw_input("What is the name of your image? ")
    output_path = "output.jpg"
    message = raw_input("What is your secret message? ")
    if len(message) == 0:
        print "please enter something "
    elif message == "sos" or "save me " or "help me" or "save me please":
        print "hold on"
    elif message == "False" or "hack" or "#" or "@" or "?":
        print "spychat aint free"
        #no such symbols should be accepted
    else:
        print"your message is accepted" \

    Steganography.encode( original_image , output_path , message )
    message_sent_to = friends[selected_friend].name

    print "Message Encrypted"

    new_chat =  ChatMessage(spy.name, message_sent_to , message , True)
    friends[selected_friend].chat.append(new_chat)

    with open("chats.csv", "a") as chat1data:
        writer = csv.writer(chat1data)
        writer.writerow([spy.name, message_sent_to, new_chat.message, new_chat.time, new_chat.sent_by_me])
コード例 #3
0
    def send_secret_message(self):
        self.time = datetime.now()
        #calling method to get friend
        friend = Friends.select_a_friend()

        if friend is None:
            return
        self.sendto = friend.name

        #getting message in any cost
        while len(self._message) == 0:
            self._message = raw_input("Enter the message\n")
        #checking length
        if len(self._message) > 100:
            print "You talk to much .Message must be of max 100 letters"
        else:
            #message for specific words
            if self._message.upper() == "SOS":
                print "I will save you"
            elif self._message.upper() == "SAVE ME":
                print "You will be saved"
            Friends.no +=1
            self.output_file = "C:\Users\Garg\PycharmProjects\FirstProject\spychat\Encryptedimage" + str(Friends.no) + ".jpg"

            #encrypting the message
            Steganography.encode("C:\Users\Garg\PycharmProjects\FirstProject\spychat\image\python.jpg", self.output_file, self._message)
            #adding to message list
            friend.messages.append(self)
コード例 #4
0
ファイル: main.py プロジェクト: Manisharya5/Spychat
def send_message():
    frnd_choice = slect_a_friend()
    original_image = raw_input("enter the name of image:")
    output_image = "output.jpg"
    text = raw_input("enter the secrate message here:")
    Steganography.encode(original_image, output_image, text)
    print("your message is sent SUCCESSFULLY:")
コード例 #5
0
ファイル: menu.py プロジェクト: ArpitAneja/SpyChat
def send_a_message(spy):
    show_menu = True
    while show_menu:
        print colored("which friend you want to communicate with?", "yellow")
        index = select_a_friend(spy)
        # checks if user has a friend or not
        if index < 0:
            show_menu = False
        else:
            selected_friend = friends[index].name
            # selected_friend contains index of friend selected via select_a_friend function
            original_image = raw_input(colored("enter name of image you want to encode secret message with(.jpg format): ", "yellow"))
            # checking if mentioned file exist in os or not
            if os.path.exists(original_image):
                # checking extension of image if its in jpg
                if os.path.splitext(original_image)[1] == ".jpg":
                    output_path = 'output.jpg'
                    text = raw_input(colored("enter secret message you want to hide: ", "yellow"))
                    if text in special_text:
                        text = colored(text + ": its a emergency reach me as soon as possible!!", "red", attrs=['bold'])
                    # encode method of Steganography library will hide secrete message in selected image
                    Steganography.encode(original_image, output_path, text)
                    # storing chats in chatmessage
                    chat = ChatMessage(sent_by_me=spy.name, friend_name=selected_friend, time=datetime.now().strftime("%d %B %Y"), message=text)
                    chats.append(chat)
                    # writing chats in chats.csv
                    with open("chats.csv", 'a') as chat_record:
                        writer = csv.writer(chat_record)
                        writer.writerow([chat.sent_by_me, chat.friend_name, chat.time, chat.message])
                    print colored("your secret message is sent", "blue")
                    show_menu = False
                else:
                    print colored("file not in .jpg format", "red")
            else:
                print colored("file does not exist", "red")
コード例 #6
0
            def send_message():
                while True:
                    friend_choice = select_friend()
                    try:  #ERROR HANDLING FOR WRONG INPUT
                        friends[friend_choice]
                    except ValueError:
                        print '\nInvalid number'
                        print 'Please choose again '
                        continue
                    except:
                        print 'Please choose a valid friend\n'
                        continue
                    break
                while True:
                    try:
                        original_image = raw_input(
                            '\tNAME OF IMAGE:')  #NAME OF IMAGE TO BE SENDED
                        output_path = 'output.jpg'
                        text = raw_input('\tENTER THE TEXT:'
                                         )  #TEXT TO BE HIDDEN INSIDE IMAGE
                        print 'LOADING.....\n'
                        print '\tYOUR MESSAGE IS BEING READY\n'
                        Steganography.encode(original_image, output_path,
                                             text)  #ENCODING OF IMAGE
                    except IOError:  #ERROE HANDLING FOR INVALID FILE
                        print 'NO SUCH IMAGE OR FILE EXIST.PLEASE TRY AGAIN'
                        continue
                    break

                new_chat = chatmessage(text, True)
                friends[friend_choice].chats.append(new_chat)  #APPEND CHATS
コード例 #7
0
def send_message():
    friend_choice = select_friend()
    original_image = raw_input(
        "In Which Image File You Want to Hide Your Message? (Enter Image File Name without Any extension Like .jpg) \t"
    ) + '.jpg'
    text = raw_input("Type Your Secure Message Now: \t")
    Secured_image = raw_input(
        "Enter Name (without extension .jpg) For Newly Generated Secure Message File : \t"
    )
    #set the name for the out secure image with text
    output_path = Secured_image + '.jpg'
    Steganography.encode(original_image, output_path, text)
    #split text message to check any special message involved or not
    temp = text.split(' ')
    #If a Smart send a message with special words such as SOS, SAVE ME etc. you should display an appropriate message
    special = ['SOS', 'sos' 'Help', 'help', 'HELP', 'Save', 'SAVE', 'save']
    for any in special:
        if any in temp:
            temp[temp.index(
                any
            )] = ' Please Help Me. i am In Denger. Contact me as soon as Possible'
    #replece with new full length message
    text = str.join(' ', temp)
    # store Date and Time
    new_chat = {"message": text, "time": datetime.now(), "sent_by_me": True}
    friends[friend_choice].chats.append(new_chat)
    print '\n\tYour secret message is ready! in File " %s "' % output_path
コード例 #8
0
ファイル: main.py プロジェクト: mudra19/spy
def send_message():
    #call the fuction select_friend which returns the position of friend whom we want to send the message
    #store it in a variable friend_choise

    friend_choise = select_friend()
    #input original image upon which text will be encoded

    original_img = raw_input('What is the name of the image')

    #save the path of the ouput image which will carry our message in output_path variable
    output_path = 'output.jpg'

    #input and store secret message in variable text

    text = raw_input('What do you want to say?')

    #original img is the carrier and output path has hidden text in it

    Steganography.encode(original_img, output_path, text)
    #save the secret message alongwith the time at which it was send using class ChatMessage

    new_chat = ChatMessage(text, True)

    #append the message to the friend's chat instance

    friends[friend_choise].chats.append(new_chat)

    print 'you secret message image is ready'
コード例 #9
0
ファイル: send_message.py プロジェクト: vivek997/Spychat-1
def send_message():
    friend_choice = friends[select_a_friend()].name

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

    # encoding the message
    Steganography.encode(original_image, output_path, text)

    # the message will be stored in chat
    new_chat = ChatMessage(spy_name=spy_1.name,
                           friend_name=friend_choice,
                           time=datetime.now().strftime("%d %B %Y"),
                           message=text)
    #append new_chat in chats list.
    chats.append(new_chat)
    print("your secret message is ready.")

    with open('chats.csv', 'a') as chats_data:
        writer = csv.writer(chats_data)
        writer.writerow([
            new_chat.spy_name, new_chat.friend_name, new_chat.time,
            new_chat.message
        ])
コード例 #10
0
def send_message():
    # select a friend to whom message is to be send
    friend_choice = select_friend()

    original_image = raw_input(
        "What is the name of the image?")  # image to be encoded (encoded.png)
    output_path = 'secret_image.jpg'  # output image. Result
    text = raw_input("What do you want to say?"
                     )  # Message you want to send encoded in image
    Steganography.encode(original_image, output_path,
                         text)  # inbuilt function of steganography encode()

    # split text message to check any special message involved or not
    message = text.split(' ')
    # If a Smart send a message with special words such as SOS, SAVE ME etc. you should display an appropriate message
    cases = [
        'SOS', 'Help', 'HELP', 'SoS', 'sos', 'ASAP', 'asap', 'save me',
        'SAVE ME'
    ]
    for any in cases:
        if any in message:
            print "Immediate action required"

    # newchat dictonary which notes timestamp of send message using datetime module
    new_chat = ChatMessage(text, True)

    friends[friend_choice]['chats'].append(new_chat)
    print "Your secret message is ready!"
コード例 #11
0
def send_message():
    friend_choice = select_friend()
    print "index = " + str(friend_choice)

    original_image = raw_input(
        "What is the name of the image?"
    )  # Ask the user for the name of the image they want to encode the secret message with.
    output_path = "output.jpg"
    text = raw_input(
        "What do you want to say?"
    )  # Ask the user for the secret message they want to hide.
    list_of = text.split(" ")
    if len(
            list_of
    ) >= 100:  #to maintain the average number of words(here I take 100) spoken by a spy everytime you receive a message from a particular spy.
        print "Message limit exceeded!Please enter text less than 100 words."
    else:
        print "your secret message has been ready!"

        Steganography.encode(
            original_image, output_path, text
        )  # Using the Steganography library hide the message inside the image

        new_chat = ChatMessage(text, True)

        friends[friend_choice].chats.append(new_chat)
コード例 #12
0
ファイル: main.py プロジェクト: sanjaymehra/Sanjay
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"
コード例 #13
0
def send_message():
    selected_friend = select_frnd()
    receiver = friends[selected_friend].name
    original_image = raw_input(
        "what is the name of original image? ")  #here take it as .PNG
    output_path = "secret.jpg"  #name of image
    secret_text = raw_input("what is your secret message? ")
    Steganography.encode(original_image, output_path, secret_text)
    print "message encoded"
    special_msg = [
        "EMERGENCY", "selfish", "SOS", "BUSY"
        "SAVE ME", "HELP", "BE AWARE"
    ]  # list of special messages
    message = secret_text.upper()
    sp = message.split(" ")  # spliting the message
    for word in sp:  # checking for special messages in our secret_text
        for i in special_msg:
            if word.upper() == i:
                print Fore.RED + "You have send  an emergence message \n"  # Printing message in red color
                print Fore.BLACK
    time = datetime.now()  # storing the current time
    with open('chats.csv', 'ab') as chats:  # opening file to append chats
        writer = csv.writer(chats)
        writer.writerow([time, spy, secret_text,
                         receiver])  # writing chats to file
    print "Your secret message is ready"
コード例 #14
0
ファイル: Send_message.py プロジェクト: Pragya99/project1
def send_message():

    # choose a friend from the list to communicate
    friend_choice = select_friend()

    # select an image in which you want to hide a secret message.
    original_image = raw_input(
        "Provide the name of the image to hide the message : ")
    pattern_i = '^[a-zA-Z]+\.jpg$'

    # name the output file
    output_image = raw_input("Provide the name of the output image  : ")
    pattern_o = '^[a-zA-Z]+\.jpg$'

    # write the secret message
    text = raw_input("Enter your message here : ")
    # Encrypt the message using Steganography library
    Steganography.encode(original_image, output_image, text)
    # the message will be stored in chat message class
    new_chat = ChatMessage(text, True)

    # along the name of friend with whom we add message
    friends[friend_choice].chats.append(new_chat)

    # Successful message after encoding
    print(colored("Your message encrypted successfully.", 'red'))

    # save the messages
    new_chat = {'message': text, 'time': datetime.now(), 'sent_by_me': True}
コード例 #15
0
ファイル: main.py プロジェクト: nikbatheja/spychat
def send_message():

#the user has to select a friend to whom he wants to send to message
# it may be from the list that has been imported or from a new friend added by the user

    friend_choice = select_a_friend()


#here we will ask the user for the image name
    original_image = raw_input('What is the name of the image?')
    output_path = 'output.jpg'

#the user will be asked to enter the text he wants to hide in the image
    text = raw_input('What do you want to say? ')
    Steganography.encode(original_image, output_path, text)

    new_chat = {
        'message': text,
        'time': datetime.now(),
        'sent_by_me': True
    }

    friends[friend_choice]['chats'].append(new_chat)

    print 'Your secret message image is ready!'
コード例 #16
0
ファイル: main.py プロジェクト: rohitrawat566/spychatproject
def send_message():  #sending a message
    select_friend = select_frnd()  #index value
    original_image = raw_input('What is the name of your image ? '
                               )  # asking the user for an input of image
    secret_text = raw_input(
        'What is your secret text ? ')  # secret text to be entered
    list = ['SOS', 'SAVE ME', 'HELP ME']  #list the special message
    if secret_text.upper() in list:  #check
        print Fore.RED + "inappropriate message"  #message to user
        print(Style.RESET_ALL)  #reset colours
    else:
        output_path = "secretout.png"  #predefined name of an image
        secret_text = str(
            select_friend
        ) + secret_text  #assigning the index with the text fro a reading a message validation

        Steganography.encode(original_image, output_path,
                             secret_text)  # encoding the message with image
        print 'Your message has been successfully encoded..'  #displaying for the user
        n = int(secret_text[:1])
        secret_text = secret_text.replace(str(n), '')

        print 'Your secret message is ready.'  #displaying for the user

        with open('chats.csv', 'a') as chats_data:

            writer = csv.writer(chats_data)

            writer.writerow([
                secret_text,
                time.strftime("%d,%m,%H"), spy.name,
                friends[select_friend].name
            ])
コード例 #17
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!!!"
コード例 #18
0
ファイル: main.py プロジェクト: Muskaan-Laroia/spyChat
def send_message():

    friend_choice = select_a_friend()

    original_image = raw_input("What is the name of the image ? ")
    output_path = "output.jpg"  #image path
    text = raw_input(
        "What secret message would you want to hide behind this image or if u want to choose among 1.SOS 2.SAVE ME 3.NEED ASSISTENCE? "
    )

    invalidchar = set(
        string.punctuation.replace("_", " ")
    )  #this checks that the secret contains space or underscore or nothing
    if any(char in invalidchar for char in text):
        print "Invalid, The secret message should not contain spaces !"
        text = raw_input(
            "Enter a valid secret message or if u want to choose among 1.SOS 2.SAVE ME 3.NEED ASSISTENCE ? "
        )

    else:
        print "Hurrah! Your secret message is good to go, wait a few seconds untill your message is encoded in the image !"

    Steganography.encode(original_image, output_path,
                         text)  #this encodes the secret message in the image

    new_chat = ChatMessage(text, True)

    friends[friend_choice].chats.append(
        new_chat)  #the chat is added to the previous chat

    print "Awesome! Your secret message-image is finally ready!"
コード例 #19
0
ファイル: main.py プロジェクト: ArpitSondh95/Spychat
def send_message():
    if (len(friends) > 0):

        friend_choice = select_a_friend()
        original_image = raw_input("*What is the name of the image:  ")
        output_path = "Image.jpg"
        text = raw_input(
            "*What secret message do you want to send in that image:  ")
        if len(text) <= 100:
            #encoding msg into the image.
            Steganography.encode(original_image, output_path, text)

            new_chat = ChatMessage(text, True)

            friends[friend_choice].chats.append(new_chat)

            print "\n-----***Your secret Message Image is sent to your online Friend***-----\n"
        else:
            print "You cannot send a message bigger than length 100...!! Try Again..!!\n"
            send_message()

    else:
        print "\nPlease add some Friends on Spychat....!!\n\n"
        yes_no = raw_input("So do you want to add Friends..(Y/N): ")
        if (yes_no.upper() == 'Y'):
            add_friend()
        else:
            print "-----@@@@Its totally Your Wish@@@@-----"
コード例 #20
0
def ButtonClick(filename):
    try:
        key_key = Name.get()
        message = (TextComments.get(1.0, 'end'))
        choice = var.get()
        if choice == 1:
            messagebox.showinfo(title="Wait",
                                message="Please wait it will take a minute")
            encrypted_message = AESCipher(key_key).encrypt(message)
            Steganography.encode(path, "secret.jpg", encrypted_message)
            messagebox.showinfo(title="Done",
                                message="Done ^__^ Your message is secure")

        elif choice == 2:
            try:
                secret_text = Steganography.decode(path)
                decrypted_text = AESCipher(key_key).decrypt(secret_text)
            except:
                messagebox.showerror("Wrong password!",
                                     "Wrong password ! Please try again ")
            if (decrypted_text == "") or (decrypted_text == " "):
                messagebox.showerror("Wrong password!",
                                     "Wrong password ! Please try again ")
            else:
                open_open = open("secure_message.txt", "w")
                open_open.writelines(decrypted_text)
                open_open.close()
                messagebox.showinfo(
                    title="Done",
                    message=
                    "Done ^__^ Your message was stored in file named'secure_message.txt' in this folder"
                )
    except:
        messagebox.showerror("Ops!", "ERROR!!")
コード例 #21
0
ファイル: spy_chat.py プロジェクト: JayRajM97/SpyChat-AV
def send_message():

        friend_select = select_friend()
        if friend_select is not False:
            input_path = raw_input("Enter the full path of the image : ")
            output_path = raw_input("Enter path where you want to store the output image : ")
            text = raw_input("Enter secret text that you want to encode : ")

            if name_valid(text) is True:
                if len(text.split()) > 100 :
                    print "You're speaking a lot, this is Intolerable!!\nYou're banished from the chat!! "
                    del friends[friend_select]
                elif len(text.split()) == 0 :
                    print "*****DON'T WASTE TIME OF YOUR FRIEND SPY !"
                else:
                    Steganography.encode(input_path , output_path , text)

                    # VARIABLE TO STORE THE DETAILS OF THE NEW CHAT DATA

                    new_chat = ChatMessage(text,True,0)
                    friends[friend_select].chats.append(new_chat)

                    if text == "SOS" or text == "SAVE ME" or text == "Vatican Cameos" or text == "HELP ME" :
                        print " *****THE MESSAGE IS FORWARDED TO ALL THE SPY'S ! THE NEAREST ONE WILL CONTACT YOU , SIT TIGHT !***** "

                    print("Your secret image is ready !")


            else:
                print " You haven't entered any secret message. Please try again!"
コード例 #22
0
def send_message(spy):  # function for sending message
    selected_friend = select_frnd()  # calling the select_friend function
    receiver = friends[selected_friend].name
    original_image = raw_input("What is the name of original image : "
                               )  # take name of original image as input
    secret_text = raw_input(
        "Enter your secret message : ")  # entering the secret message
    output_path = "output.jpg"  # name of image after encoding the message
    Steganography.encode(
        original_image, output_path,
        secret_text)  # calling encode() function to encode message in image
    print "Message Encoded"
    special_msg = ["SOS", "HELP ME", "SAVE ME", "EMERGENCY", "HELP",
                   "SAVE"]  # list of special messages
    message = secret_text.upper()
    sp = message.split(" ")  # spliting the message
    for word in sp:  # checking for special messages in our secret_text
        for i in special_msg:
            if word.upper() == i:
                print Fore.RED + "You have send  an emergence message \n"  # Printing message in red color
                print Fore.BLACK
    time = datetime.now()  # storing the current time
    with open('chats.csv', 'ab') as chats:  # opening file to append chats
        writer = csv.writer(chats)
        writer.writerow([time, spy, secret_text,
                         receiver])  # writing chats to file
    print "Your secret message is ready"
コード例 #23
0
def send_message():  #sending a message
    select_friend = select_frnd()  #index value
    original_image = raw_input('What is the name of your original image ? '
                               )  # asking the user for an input of image
    secret_text = raw_input(
        'What is your secret text message ? ')  # secret text to be entered
    list = ['SOS', 'HELP ME',
            'SAVE ME']  # if message is these words it will not be encoded
    if secret_text.upper() in list:
        print Fore.RED + 'Inappropriate message..'
        print(Style.RESET_ALL)
    else:
        output_path = "secret.jpg"  #predefined name of an image
        secret_text = str(
            select_friend
        ) + secret_text  #assigning the index with the text for reading a message validation
        Steganography.encode(original_image, output_path,
                             secret_text)  # encoding the message with image
        print 'Your message has been successfully encoded..'  #displaying for the user
        print 'Your secret message is ready.'  #displaying for the user

    with open('chat.csv', 'a') as chats_data:
        writer = csv.writer(chats_data)
        writer.writerow([
            secret_text,
            time.strftime("%d %m %H"), spy.name, friends[select_friend].name
        ])
コード例 #24
0
def send_message():

    friend_choice = select_a_friend()

    original_image = raw_input("Now tell me the name of the image")

    output_path = "output.jpg"

    #message you want to say to your friend
    text = raw_input("What message would you like to send??????? ")

    Steganography.encode(original_image, output_path, text)

    new_chat = ChatMessage(text, True)
    # your message is appended
    friends[friend_choice].chats.append(new_chat)

    #calculate average words spoken by a spy in order the record
    words = text.split()
    average = sum(len(word) for word in words) / len(words)
    average = float(average)
    print "Average number of words spoken by a spy is", average

    if len(text) > 0:
        print "Your secret message image is ready! Now the unauthorized users can't read your message"

    else:
        print "Please enter secret message....You can't go further!!!!!"
コード例 #25
0
ファイル: main.py プロジェクト: NAVJOTSINGH04/spychat
def send_message():
    friend_choice = select_friend()

    original_image = raw_input(
        "What is the name of your image?\n "
    )  #name of teh image in which you want to hide the message
    output_path = "hidden.jpg"  #the image in which the msg will be encoded
    msg = raw_input("What is the secret message to your friend? \n")
    msg_new = msg.upper()
    msg_new = msg_new.split(" ")  #split the string from the spaces into a list
    for val in msg_new:
        if val in special_msg:  #check is there is any special messgea
            print "You should see the message immediately, there can be emergency!!!!"

    Steganography.encode(original_image, output_path,
                         msg)  #encodes the msg into a new image

    new_chat = Chat(friends[friend_choice].name, msg, True)
    friends[friend_choice].chats.append(
        new_chat)  #appned this chat into the friends chat
    with open("chat.csv.txt", "a") as chats_data:
        chater = csv.writer(chats_data)
        chater.writerow([
            new_chat.name, new_chat.message, new_chat.sent_by_me, new_chat.time
        ])  #write the chat details into chats.csv file

    print "Your secret message has been sent to your friend."
コード例 #26
0
ファイル: main.py プロジェクト: AyushJS52/spychat
def send_a_message():
    friend_choice = friends[select_a_friend()].name

    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 text in special_words:
        text = colored(text + ": IT'S EMMERGENCY!!", "red")
    #encoding the message
    Steganography.encode(original_image, output_path, text)

    # the message will be stored in chat message class
    new_chat = ChatMessage(spy_name=spy_1.name,
                           friend_name=friend_choice,
                           time=datetime.now().strftime("%d %B %Y"),
                           message=text)

    # name of the friend along which we add message.
    chats.append(new_chat)
    print("your secret message is ready.")

    with open('chats.csv', 'a') as chats_data:
        writer = csv.writer(chats_data)
        writer.writerow([
            new_chat.spy_name, new_chat.friend_name, new_chat.time,
            new_chat.message
        ])
コード例 #27
0
ファイル: main.py プロジェクト: crypterx/SpyChat
def send_message():
    try:
        friend_select = select_friend()
        if friend_select is not False:
            input_path = raw_input("Enter the full path of the image : ")
            output_path = raw_input(
                "Enter path where you want to store the output image : ")
            text = raw_input("Enter secret text that you want to encode : ")
            if name_valid(text) is True:
                if len(text.split()) > 100:
                    print(
                        "\033[1;34m  You're speaking a lot, this is Intolerable!!\nYou're banished from the chat!!   \033[1m;34m"
                    )
                    del friends[friend_select]
                else:
                    Steganography.encode(input_path, output_path, text)
                    # VARIABLE TO STORE THE DETAILS OF THE NEW CHAT DATA
                    new_chat = ChatMessage(text, True, 0)
                    friends[friend_select].chats.append(new_chat)

                    print("Your secret image is ready !")
            else:
                print(
                    "\033[1;34m      You haven't entered any secret message. Please try again!   \033[1m;34m"
                )

    except IOError:
        print(
            "\033[1;34m   No such file or directory found!!\nEnter a valid path and try again!!   \033[1m;34m"
        )
コード例 #28
0
def send_message():

    friend_choice = select_a_friend(
    )  #send to the select_a_friend function and storing the value in friend_choice variable
    if friend_choice + 1 <= len(
            friends):  #check if the number enetered is a part of list or not
        original_image = raw_input(
            "What is the name of the image?"
        )  #stores te name and the pat of the image to be scripted
        output_path = 'output.jpg'  #scripted image is stored in this variable
        text = raw_input(
            "What do you want to say? Word Limit-100")  #secret text
        Steganography.encode(original_image, output_path,
                             text)  #the image is encoded using stegnography

        new_chat = ChatMessage(
            text, True)  #meassge added to the chat as send by the user

        friends[friend_choice].chats.append(
            new_chat)  #message appended in the chat of a particular friend

        print colored("Your secret message image is ready!", 'green')
    else:
        print colored("Invalid Input!!",
                      'red')  #the serial number does not exist
コード例 #29
0
ファイル: spychat.py プロジェクト: kanakgeu/SPY-CHATS
def send_a_message(name):
    global flag
    position = select_a_friend(name)
    if position == 'null':
        return (0)
    else:
        f_name = spy_list[name]['friends'].keys()[position]
        from steganography.steganography import Steganography
        path_name = "C:\Users\Kanak Goel\Desktop"
        img_name = raw_input("What is the image name?: ")
        path = path_name +"\\" + img_name
        print "your path with specified image name is: " + path
        d_img_name = raw_input("What name should be the output file?: ")
        d_path = "C:\Users\Kanak Goel\Desktop"
        overall_path = d_path + "\\" + d_img_name
        print overall_path
        text = raw_input("Enter the TEXT to encode: ")
        from datetime import datetime
        date = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        flag = flag + 1
        spy_list[name]['friends'][f_name]['chat'].update({flag: {"secret_message": text, "time": date,"boolean": True}})
        print "Come down..................................."
        q= text.strip().split(" ")
        Steganography.encode(path, overall_path, text)
        print "\nMessage has been encoded and sent to %s.\n" % (
            str(spy_list[name]['friends'].keys()[position]))
コード例 #30
0
ファイル: main.py プロジェクト: rohityadav7946/spychat
def send_message():
    ###function to send secret message
    friend_choice = friends[select_friend()].name

    original_image = raw_input("What is the name of the image?")
    output_path = 'output.jpg'
    ##giving the new name to the encided image
    text = raw_input("What do you want to say?")
    if text in special_words:
        text = colored(text + ": IT'S EMMERGENCY!! Come for help", "red")

    Steganography.encode(original_image, output_path, text)
    ##encoding process
    new_chat = ChatMessage(spy_name=spy_1.name,
                           friend_name=friend_choice,
                           time=datetime.now().strftime("%d %B %Y"),
                           message=text)
    ##storing date and time of function

    chats.append(new_chat)
    ####appending the chat to the friends list

    print "Your secret message is ready!"

    with open('chats.csv', 'a') as chats_data:
        writer = csv.writer(chats_data)
        writer.writerow([
            new_chat.spy_name, new_chat.friend_name, new_chat.time,
            new_chat.message
        ])
コード例 #31
0
ファイル: tests.py プロジェクト: subc/steganography
def test_stegano():
    path = "/tmp/image/a.jpg"
    output_path = "/tmp/image/b.jpg"
    text = 'The quick brown fox jumps over the lazy dog.'

    Steganography.encode(path, output_path, text)
    secrete_text = Steganography.decode(output_path)
    assert secrete_text == text
コード例 #32
0
def send_message():
    frnd = select_friend()
    avg = 0
    pattern = '^[a-zA-Z0-9\s]+\.jpg$'
    while True:
        original_image = raw_input('Name of image:')
        if re.match(pattern, original_image) != None:
            break
        else:
            print 'File should must have .jpg extension'
    while True:
        output_image = raw_input('Name of output image:')
        if re.match(pattern, output_image):
            break
        else:
            print 'File should must have .jpg extension'
    while True:
        text = raw_input('Enter your message:')
        pattern = '^[a-zA-Z0-9@$%&\s]+$'
        if re.match(pattern, text) != None:
            break
        else:
            print 'Enter alphabets only'
    msg1 = 'SAVE ME'
    msg2 = 'HELP'
    msg3 = 'SOS'
    msg4 = 'EMERGENCY'
    # help1 = text.find(msg1) + text.find(msg1.lower())
    # help2 = text.find(msg2) + text.find(msg2.lower())
    # help3 = text.find(msg3) + text.find(msg3.lower())
    # help4 = text.find(msg4) + text.find(msg4.lower())
    # Checking for an emergency message
    if msg1 or msg1.lower() or msg2.lower() or msg3.lower() or msg4.lower() in text:
        # Encryption of image:
        try:
            Steganography.encode(original_image, output_image, text)
            avg = len(text)
            new_chat = ChatMessage(text, True, avg, frnd)
            friends[frnd].chats.append(new_chat)
            print '\nIt seems you are in danger.'
            print 'Don\'t you worry my friend.'
            print 'I\'m on my way.'
            print "Your secret message image is ready!"
        except IOError:
            print 'No such file present in your directory.'
            print 'Try:demo.jpg\n'
            sleep(0.5)
    else:
        # Encryption of image:
        try:
            Steganography.encode(original_image, output_image, text)
            new_chat = ChatMessage(text, True, avg, frnd)
            friends[frnd].chats.append(new_chat)
            print "Your emergency secret message image is ready!"
        except IOError:
            print 'No such file present in your directory.'
            print 'Try:demo.jpg\n'
            sleep(0.5)
コード例 #33
0
ファイル: main.py プロジェクト: gauravsharma27/spy_chat
def send_a_message():
    select_friend = select_a_friend()
    original_image = raw_input("what is the name ofthe image")
    output_path = original_image
    text = raw_input("what message do u want to send ? ")
    if len(text) <= 0:
        print("u cannot send empty message!!!!")
    elif len(text) > 100:
        print("you exceed the message limit .. please try again later!!!!")
        del friends[select_friend]
    else:
        Steganography.encode(original_image, output_path, text)
        chats = chatmessage(text, True)
        friends[select_friend].chat.append(chats)
        print("your secret message is ready.")
コード例 #34
0
# Demo of Steganography

from steganography.steganography import Steganography

fo = open("messages.txt", "r")
lines = fo.readlines()

counter = 1
for line in lines:
    original_image = "original_images\\%d.jpg"%(counter)
    output_image = "encrypted_images\\secret%d.jpg"%(counter)
    message = line
    Steganography.encode(original_image, output_image, message)
    print("%d Successful"%(counter))
    counter += 1