コード例 #1
0
ファイル: test.py プロジェクト: wang1540/ece364
    # sourcePath = '/home/ecegrid/a/ee364b09/Lab11/t&h/IMG_2648.png'
    # message = Message(filePath=sourcePath, messageType='ColorImage')
    # imagePath = '/home/ecegrid/a/ee364b09/Lab11/t&h/IMG_2645.png'
    # stegan = Steganography(imagePath, 'horizontal')
    # stegan.embedMessageInMedium(message, '/home/ecegrid/a/ee364b09/Lab11/t&h/tan_hui_h.png')

    # sourcePath = '/home/ecegrid/a/ee364b09/Lab11/t&h/IMG_2645(1).png'
    # message = Message(filePath=sourcePath, messageType='ColorImage')
    # imagePath = '/home/ecegrid/a/ee364b09/Lab11/t&h/IMG_2646.png'
    # stegan = Steganography(imagePath, 'horizontal')
    # stegan.embedMessageInMedium(message, '/home/ecegrid/a/ee364b09/Lab11/t&h/xinba_tan_h.png')

    sourcePath = '/home/ecegrid/a/ee364b09/Lab11/t&h/IMG_2645(1).png'
    message = Message(filePath=sourcePath, messageType='ColorImage')
    imagePath = '/home/ecegrid/a/ee364b09/Lab11/t&h/IMG_2649.png'
    stegan = Steganography(imagePath, 'vertical')
    stegan.embedMessageInMedium(
        message, '/home/ecegrid/a/ee364b09/Lab11/t&h/hui_tan_v.png')

    # sourcePath = '/home/ecegrid/a/ee364b09/Lab11/t&h/IMG_2649(1).png'
    # message = Message(filePath=sourcePath, messageType='ColorImage')
    # imagePath = '/home/ecegrid/a/ee364b09/Lab11/t&h/IMG_2645.png'
    # stegan = Steganography(imagePath, 'vertical')
    # stegan.embedMessageInMedium(message, '/home/ecegrid/a/ee364b09/Lab11/t&h/hui_tan_v.png')

    out = Image.open(imagePath)
    l, h = out.size
    print('{} and {}'.format(l, h))
    pix1 = list(out.getdata())
    out = Image.open(sourcePath)
    l, h = out.size
コード例 #2
0
ファイル: NewSteganograhy.py プロジェクト: bishop1612/ECE364
        for byt in new_list:
            for bit in byt:
                sum += int(bit) * 2**(7 - k)
                k += 1
            new_list[i] = chr(int(sum))
            new_str += new_list[i]
            k = 0
            sum = 0
            i += 1

            if i == 8000:
                break
        #Checking the right format of the message
        matches = re.findall("<message type=\"(.*)\" size", new_str)
        if len(matches) == 0:
            return (False, None)
        else:
            return (True, matches[0])


if __name__ == "__main__":
    pass
    nw = Steganography("test/bridge_dog_v.png", "vertical")
    ges = nw.extractMessageFromMedium()

    print(ges)
    #print(mes,ges)
    #nw = NewSteganography(hello)
    #mes = hello.checkIfMessageExists()
    #print(mes)