示例#1
0
    def test_AES_CFB(self):
        for i in range(MAX_COVER_NOISE):
            # Encode
            jt65msgs = [
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44",
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"
            ]
            jt65data = jts.jt65encodemessages(jt65msgs, False)
            stegmsg = "DEF CON 22"
            key = ''.join(
                random.choice(string.ascii_letters + string.digits)
                for n in xrange(random.randint(10, 30)))
            hidekey = jts.getnoisekey(key)
            cipherdata = jts.createciphermsgs(
                len(jt65data), stegmsg, "AES",
                "AES is totes secure, right? Yeah", "", "CFB", False)
            finalmsgs = jts.steginject(jt65data, i, cipherdata, hidekey, False)

            # Decode
            finalresultmsgs = list(finalmsgs)
            stegdata = jts.retrievesteg(finalmsgs, hidekey, False)
            resultstegmsg = jts.deciphersteg(
                stegdata, "AES", "AES is totes secure, right? Yeah", "CFB",
                False)
            decodedjt65msgs = jts.decodemessages(finalmsgs, False)
            self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
            for i in range(len(jt65msgs)):
                self.assertEqual(jt65msgs[i].rstrip(),
                                 decodedjt65msgs[i].rstrip())
            self.assertEqual(stegmsg.rstrip(), resultstegmsg.rstrip())
示例#2
0
    def test_NoCipher_WithSteg_Extra(self):
        for i in range(MAX_COVER_NOISE):
            # Encode with more JT65 msgs than necessary
            jt65msgs = [
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44",
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"
            ]
            jt65data = jts.jt65encodemessages(jt65msgs, False)
            stegmsg = "BEACON FTW AND DEF CON 22"
            key = ''.join(
                random.choice(string.ascii_letters + string.digits)
                for n in xrange(random.randint(10, 30)))
            hidekey = jts.getnoisekey(key)
            cipherdata = jts.createciphermsgs(len(jt65data), stegmsg, "none",
                                              "", "", "", False)
            finalmsgs = jts.steginject(jt65data, i, cipherdata, hidekey, False)

            # Decode
            finalresultmsgs = list(finalmsgs)
            stegdata = jts.retrievesteg(finalmsgs, hidekey, False)
            resultstegmsg = jts.deciphersteg(stegdata, "none", "", "", False)
            decodedjt65msgs = jts.decodemessages(finalmsgs, False)
            self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
            for i in range(len(jt65msgs)):
                self.assertEqual(jt65msgs[i].rstrip(),
                                 decodedjt65msgs[i].rstrip())
            self.assertEqual(stegmsg.rstrip(), resultstegmsg.rstrip())
示例#3
0
    def test_NoCipher_WithSteg_WAV(self):
        for i in range(MAX_COVER_NOISE):
            # Encode
            jt65msgs = ["KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"]
            jt65data = jts.jt65encodemessages(jt65msgs, False)
            stegmsg = "BEACON FTW AND DEF CON 22"
            key = ''.join(random.choice(string.ascii_letters + string.digits)
                          for n in xrange(random.randint(10, 30)))
            hidekey = jts.getnoisekey(key)
            cipherdata = jts.createciphermsgs(
                len(jt65data), stegmsg, "none", "", "", "", False)
            finalmsgs = jts.steginject(jt65data, i, cipherdata, hidekey, False)
            for index, value in enumerate(finalmsgs):
                tones = jt65sound.toneswithsync(value)
                jt65sound.outputwavfile(
                    "test_output-00" + str(index) + ".wav", tones)

            # Decode
            result1 = jt65sound.inputwavfile("test_output-000.wav")
            result2 = jt65sound.inputwavfile("test_output-001.wav")
            symbols1, confidence1, wavmsg1, s2db, freq, a1, a2 = result1[0]
            symbols2, confidence2, wavmsg2, s2db, freq, a1, a2 = result2[0]
            os.remove("test_output-000.wav")
            os.remove("test_output-001.wav")
            finalresultmsgs = [symbols1, symbols2]
            stegdata = jts.retrievesteg(finalresultmsgs, hidekey, False)
            resultstegmsg = jts.deciphersteg(stegdata, "none", "", "", False)
            decodedjt65msgs = jts.decodemessages(finalresultmsgs, False)
            self.assertEqual(len(result1), 1)
            self.assertEqual(len(result2), 1)
            self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
            for i in range(len(jt65msgs)):
                self.assertEqual(
                    jt65msgs[i].rstrip(), decodedjt65msgs[i].rstrip())
            self.assertEqual(stegmsg.rstrip(), resultstegmsg.rstrip())
示例#4
0
 def test_NoCipher_NoSteg(self):
     # Encode
     jt65msgs = ["KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"]
     jt65data = jts.jt65encodemessages(jt65msgs, False)
     expectedresult = [
         np.array([
             39, 19, 16, 44, 29, 13, 58, 19, 13, 14, 20, 44, 17, 20, 25, 31,
             46, 2, 29, 35, 56, 17, 11, 20, 39, 51, 7, 30, 26, 11, 17, 27,
             21, 11, 30, 34, 46, 48, 15, 53, 14, 26, 12, 7, 5, 8, 42, 41,
             37, 19, 16, 35, 63, 20, 3, 12, 38, 26, 8, 37, 22, 23, 29
         ]),
         np.array([
             1, 22, 21, 42, 33, 8, 40, 58, 13, 54, 19, 19, 58, 6, 5, 10, 29,
             24, 34, 1, 53, 33, 30, 43, 17, 51, 29, 38, 52, 58, 55, 9, 49,
             50, 24, 61, 0, 52, 51, 20, 25, 58, 15, 41, 53, 48, 6, 57, 10,
             25, 11, 30, 16, 20, 47, 6, 0, 43, 6, 18, 38, 3, 29
         ])
     ]
     self.assertEqual(len(expectedresult), len(jt65data))
     for i in range(len(expectedresult)):
         self.assertEqual(jt65data[i].tolist(), expectedresult[i].tolist())
     # Decode
     decodedjt65msgs = jts.decodemessages(jt65data, False)
     self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
     for i in range(len(jt65msgs)):
         self.assertEqual(jt65msgs[i].rstrip(), decodedjt65msgs[i].rstrip())
示例#5
0
    def test_OTP_Extra(self):
        for i in range(MAX_COVER_NOISE):
            # Encode with more JT65 msgs than necessary
            jt65msgs = [
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44", "KB2BBC KA1AAB DD44",
                "KA1AAB KB2BBC DD44", "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"]
            jt65data = jts.jt65encodemessages(jt65msgs, False)
            stegmsg = "BEACON FTW AND DEF CON 22"
            key = ''.join(random.choice(string.ascii_letters + string.digits)
                          for n in xrange(random.randint(10, 30)))
            hidekey = jts.getnoisekey(key)
            cipherdata = jts.createciphermsgs(
                len(jt65data), stegmsg, "OTP", "I LOVE SECURITY AND STUFF", "", "", False)
            finalmsgs = jts.steginject(jt65data, i, cipherdata, hidekey, False)

            # Decode
            finalmsgscopy = copy.deepcopy(finalmsgs)
            jt65stegmsgs = []
            decodedjt65msgs = jts.decodemessages(finalmsgs, False)

            for i in range(len(finalmsgscopy)):
                if jts.validatesteg(decodedjt65msgs[i], finalmsgscopy[i], hidekey, STEG_DETECTION_ERROR_THRESHOLD, False):
                    jt65stegmsgs.append(finalmsgscopy[i])
            stegdata = jts.retrievesteg(jt65stegmsgs, hidekey, False)
            resultstegmsg = jts.deciphersteg(
                stegdata, "OTP", "I LOVE SECURITY AND STUFF", "", False)

            self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
            for i in range(len(jt65msgs)):
                self.assertEqual(
                    jt65msgs[i].rstrip(), decodedjt65msgs[i].rstrip())
            self.assertEqual(stegmsg.rstrip(), resultstegmsg.rstrip())
示例#6
0
    def test_OTP(self):
        for i in range(MAX_COVER_NOISE):
            # Encode
            jt65msgs = ["KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44",
                        "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"]
            jt65data = jts.jt65encodemessages(jt65msgs, False)
            stegmsg = "BEACON FTW AND DEF CON 22"
            key = ''.join(random.choice(string.ascii_letters + string.digits)
                          for n in xrange(random.randint(10, 30)))
            hidekey = jts.getnoisekey(key)
            cipherdata = jts.createciphermsgs(
                len(jt65data), stegmsg, "OTP", "I LOVE SECURITY AND STUFF", "", "", False)
            finalmsgs = jts.steginject(jt65data, i, cipherdata, hidekey, False)

            # Decode
            finalresultmsgs = list(finalmsgs)
            stegdata = jts.retrievesteg(finalmsgs, hidekey, False)
            resultstegmsg = jts.deciphersteg(
                stegdata, "OTP", "I LOVE SECURITY AND STUFF", "", False)
            decodedjt65msgs = jts.decodemessages(finalmsgs, False)
            self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
            for i in range(len(jt65msgs)):
                self.assertEqual(
                    jt65msgs[i].rstrip(), decodedjt65msgs[i].rstrip())
            self.assertEqual(stegmsg.rstrip(), resultstegmsg.rstrip())
示例#7
0
    def test_AES_CFB_WAV(self):
        for i in range(MAX_COVER_NOISE):
            # Encode
            jt65msgs = [
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44",
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"
            ]
            jt65data = jts.jt65encodemessages(jt65msgs, False)
            stegmsg = "DEF CON 22"
            key = ''.join(
                random.choice(string.ascii_letters + string.digits)
                for n in xrange(random.randint(10, 30)))
            hidekey = jts.getnoisekey(key)
            cipherdata = jts.createciphermsgs(
                len(jt65data), stegmsg, "AES",
                "AES is totes secure, right? Yeah", "", "CFB", False)
            finalmsgs = jts.steginject(jt65data, i, cipherdata, hidekey, False)
            for index, value in enumerate(finalmsgs):
                tones = jt65sound.toneswithsync(value)
                jt65sound.outputwavfile("test_output-00" + str(index) + ".wav",
                                        tones)

            # Decode
            result1 = jt65sound.inputwavfile("test_output-000.wav")
            result2 = jt65sound.inputwavfile("test_output-001.wav")
            result3 = jt65sound.inputwavfile("test_output-002.wav")
            result4 = jt65sound.inputwavfile("test_output-003.wav")
            symbols1, confidence1, wavmsg1, s2db, freq, a1, a2 = result1[0]
            symbols2, confidence2, wavmsg2, s2db, freq, a1, a2 = result2[0]
            symbols3, confidence3, wavmsg3, s2db, freq, a1, a2 = result3[0]
            symbols4, confidence4, wavmsg4, s2db, freq, a1, a2 = result4[0]
            os.remove("test_output-000.wav")
            os.remove("test_output-001.wav")
            os.remove("test_output-002.wav")
            os.remove("test_output-003.wav")
            finalresultmsgs = [symbols1, symbols2, symbols3, symbols4]
            stegdata = jts.retrievesteg(finalresultmsgs, hidekey, False)
            resultstegmsg = jts.deciphersteg(
                stegdata, "AES", "AES is totes secure, right? Yeah", "CFB",
                False)
            decodedjt65msgs = jts.decodemessages(finalresultmsgs, False)
            self.assertEqual(len(result1), 1)
            self.assertEqual(len(result2), 1)
            self.assertEqual(len(result3), 1)
            self.assertEqual(len(result4), 1)
            self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
            for i in range(len(jt65msgs)):
                self.assertEqual(jt65msgs[i].rstrip(),
                                 decodedjt65msgs[i].rstrip())
            self.assertEqual(stegmsg.rstrip(), resultstegmsg.rstrip())
示例#8
0
def performwavdecode(filename, stegcollection):
    # Decode a single wav file
    containssteg = False
    messages = jt65sound.inputwavfile(filename, verbose=args.verbose)

    for currentmsg in messages:
        symbols, confidence, msg, s2db, freq, a1, a2 = currentmsg
        numpymsg = np.array(symbols)
        jt65data = []
        jt65data.append(numpymsg)
        jt65datacopy = copy.deepcopy(
            jt65data
        )  # Necessary on some version of Python due to 'unprepmsg' not preserving list

        # Retrieve JT65 valid messages
        jt65msgs = jts.decodemessages(jt65data, args.verbose)

        if STEG_ENABLED:
            containssteg = jts.validatesteg(jt65msgs[0], symbols, hidekey,
                                            STEG_DETECTION_ERROR_THRESHOLD,
                                            args.verbose)

        if containssteg:
            # Retrieve steg message
            stegdata = jts.retrievesteg(
                jt65datacopy, hidekey, args.verbose,
                True)  # Unprep the steg to get actual bytes
            stegcollection.append(stegdata[0])

            # Determine if we have a steg result
            containsstegresult, stegstatus, resetcollection, stegmsg = getstegresult(
                stegcollection, args.cipher, args.key, args.aesmode,
                args.verbose)

            if resetcollection:
                stegcollection[:] = [
                ]  # Reset the steg collection for the next incoming message

        # Print result
        for index, value in enumerate(jt65msgs):
            print "\nDecoded JT65 message " + str(
                index
            ) + " : " + colorama.Fore.BLUE + value + colorama.Fore.RESET

        if containssteg and containsstegresult:
            print "\nHidden message : " + colorama.Fore.RED + stegmsg + colorama.Fore.RESET

        elif containssteg:
            print "\n" + colorama.Fore.RED + "Steg detected! " + colorama.Fore.YELLOW + stegstatus + colorama.Fore.RESET
示例#9
0
def performwavdecode(filename, stegcollection):
    # Decode a single wav file
    containssteg = False
    messages = jt65sound.inputwavfile(filename, verbose=args.verbose)

    for currentmsg in messages:
        symbols, confidence, msg, s2db, freq, a1, a2 = currentmsg
        numpymsg = np.array(symbols)
        jt65data = []
        jt65data.append(numpymsg)
        jt65datacopy = copy.deepcopy(
            jt65data
        )  # Necessary on some version of Python due to 'unprepmsg' not preserving list

        # Retrieve JT65 valid messages
        jt65msgs = jts.decodemessages(jt65data, args.verbose)

        if STEG_ENABLED:
            containssteg = jts.validatesteg(jt65msgs[0], symbols, hidekey, STEG_DETECTION_ERROR_THRESHOLD, args.verbose)

        if containssteg:
            # Retrieve steg message
            stegdata = jts.retrievesteg(
                jt65datacopy, hidekey, args.verbose, True
            )  # Unprep the steg to get actual bytes
            stegcollection.append(stegdata[0])

            # Determine if we have a steg result
            containsstegresult, stegstatus, resetcollection, stegmsg = getstegresult(
                stegcollection, args.cipher, args.key, args.aesmode, args.verbose
            )

            if resetcollection:
                stegcollection[:] = []  # Reset the steg collection for the next incoming message

        # Print result
        for index, value in enumerate(jt65msgs):
            print "\nDecoded JT65 message " + str(index) + " : " + colorama.Fore.BLUE + value + colorama.Fore.RESET

        if containssteg and containsstegresult:
            print "\nHidden message : " + colorama.Fore.RED + stegmsg + colorama.Fore.RESET

        elif containssteg:
            print "\n" + colorama.Fore.RED + "Steg detected! " + colorama.Fore.YELLOW + stegstatus + colorama.Fore.RESET
示例#10
0
 def test_NoCipher_NoSteg(self):
     # Encode
     jt65msgs = ["KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"]
     jt65data = jts.jt65encodemessages(jt65msgs, False)
     expectedresult = [np.array(
         [39, 19, 16, 44, 29, 13, 58, 19, 13, 14, 20, 44, 17, 20, 25, 31, 46, 2, 29, 35, 56, 17, 11, 20, 39,
          51, 7, 30, 26, 11, 17, 27, 21, 11, 30, 34, 46, 48, 15, 53, 14, 26, 12, 7, 5, 8, 42, 41, 37, 19,
          16, 35, 63, 20, 3, 12, 38, 26, 8, 37, 22, 23, 29]),
         np.array(
             [1, 22, 21, 42, 33, 8, 40, 58, 13, 54, 19, 19, 58, 6, 5, 10, 29, 24, 34, 1, 53, 33, 30, 43, 17,
                 51, 29, 38, 52, 58, 55, 9, 49, 50, 24, 61, 0, 52, 51, 20, 25, 58, 15, 41, 53, 48, 6, 57, 10, 25,
                 11, 30, 16, 20, 47, 6, 0, 43, 6, 18, 38, 3, 29])]
     self.assertEqual(len(expectedresult), len(jt65data))
     for i in range(len(expectedresult)):
         self.assertEqual(jt65data[i].tolist(), expectedresult[i].tolist())
     # Decode
     decodedjt65msgs = jts.decodemessages(jt65data, False)
     self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
     for i in range(len(jt65msgs)):
         self.assertEqual(jt65msgs[i].rstrip(), decodedjt65msgs[i].rstrip())
示例#11
0
 def test_DecodeMessages(self):
     msgs = [
         np.array([
             39, 19, 16, 44, 29, 13, 58, 19, 13, 14, 20, 44, 17, 20, 25, 31,
             46, 2, 29, 35, 56, 17, 11, 20, 39, 51, 7, 30, 26, 11, 17, 27,
             21, 11, 30, 34, 46, 48, 15, 53, 14, 26, 12, 7, 5, 8, 42, 41,
             37, 19, 16, 35, 63, 20, 3, 12, 38, 26, 8, 37, 22, 23, 29
         ]),
         np.array([
             1, 22, 21, 42, 33, 8, 40, 58, 13, 54, 19, 19, 58, 6, 5, 10, 29,
             24, 34, 1, 53, 33, 30, 43, 17, 51, 29, 38, 52, 58, 55, 9, 49,
             50, 24, 61, 0, 52, 51, 20, 25, 58, 15, 41, 53, 48, 6, 57, 10,
             25, 11, 30, 16, 20, 47, 6, 0, 43, 6, 18, 38, 3, 29
         ]),
         np.array([
             39, 19, 16, 44, 29, 13, 58, 19, 13, 14, 20, 44, 17, 20, 25, 31,
             46, 2, 29, 35, 56, 17, 11, 20, 39, 51, 7, 30, 26, 11, 17, 27,
             21, 11, 30, 34, 46, 48, 15, 53, 14, 26, 12, 7, 5, 8, 42, 41,
             37, 19, 16, 35, 63, 20, 3, 12, 38, 26, 8, 37, 22, 23, 29
         ]),
         np.array([
             1, 22, 21, 42, 33, 8, 40, 58, 13, 54, 19, 19, 58, 6, 5, 10, 29,
             24, 34, 1, 53, 33, 30, 43, 17, 51, 29, 38, 52, 58, 55, 9, 49,
             50, 24, 61, 0, 52, 51, 20, 25, 58, 15, 41, 53, 48, 6, 57, 10,
             25, 11, 30, 16, 20, 47, 6, 0, 43, 6, 18, 38, 3, 29
         ]),
         np.array([
             39, 19, 16, 44, 29, 13, 58, 19, 13, 14, 20, 44, 17, 20, 25, 31,
             46, 2, 29, 35, 56, 17, 11, 20, 39, 51, 7, 30, 26, 11, 17, 27,
             21, 11, 30, 34, 46, 48, 15, 53, 14, 26, 12, 7, 5, 8, 42, 41,
             37, 19, 16, 35, 63, 20, 3, 12, 38, 26, 8, 37, 22, 23, 29
         ])
     ]
     expectedresult = [
         "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44", "KB2BBC KA1AAB DD44",
         "KA1AAB KB2BBC DD44", "KB2BBC KA1AAB DD44"
     ]
     result = jts.decodemessages(msgs, False)
     self.assertEqual(len(expectedresult), len(result))
     for i in range(len(expectedresult)):
         self.assertEqual(result[i].rstrip(), expectedresult[i])
示例#12
0
    def test_OTP_Extra(self):
        for i in range(MAX_COVER_NOISE):
            # Encode with more JT65 msgs than necessary
            jt65msgs = [
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44",
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44",
                "KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"
            ]
            jt65data = jts.jt65encodemessages(jt65msgs, False)
            stegmsg = "BEACON FTW AND DEF CON 22"
            key = ''.join(
                random.choice(string.ascii_letters + string.digits)
                for n in xrange(random.randint(10, 30)))
            hidekey = jts.getnoisekey(key)
            cipherdata = jts.createciphermsgs(len(jt65data), stegmsg, "OTP",
                                              "I LOVE SECURITY AND STUFF", "",
                                              "", False)
            finalmsgs = jts.steginject(jt65data, i, cipherdata, hidekey, False)

            # Decode
            finalmsgscopy = copy.deepcopy(finalmsgs)
            jt65stegmsgs = []
            decodedjt65msgs = jts.decodemessages(finalmsgs, False)

            for i in range(len(finalmsgscopy)):
                if jts.validatesteg(decodedjt65msgs[i], finalmsgscopy[i],
                                    hidekey, STEG_DETECTION_ERROR_THRESHOLD,
                                    False):
                    jt65stegmsgs.append(finalmsgscopy[i])
            stegdata = jts.retrievesteg(jt65stegmsgs, hidekey, False)
            resultstegmsg = jts.deciphersteg(stegdata, "OTP",
                                             "I LOVE SECURITY AND STUFF", "",
                                             False)

            self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
            for i in range(len(jt65msgs)):
                self.assertEqual(jt65msgs[i].rstrip(),
                                 decodedjt65msgs[i].rstrip())
            self.assertEqual(stegmsg.rstrip(), resultstegmsg.rstrip())
示例#13
0
    def test_NoCipher_NoSteg_WAV(self):
        # Encode
        jt65msgs = ["KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"]
        jt65data = jts.jt65encodemessages(jt65msgs, False)
        for index, value in enumerate(jt65data):
            tones = jt65sound.toneswithsync(value)
            jt65sound.outputwavfile("test_output-00" + str(index) + ".wav",
                                    tones)

        # Decode
        result1 = jt65sound.inputwavfile("test_output-000.wav")
        result2 = jt65sound.inputwavfile("test_output-001.wav")
        symbols1, confidence1, wavmsg1, s2db, freq, a1, a2 = result1[0]
        symbols2, confidence2, wavmsg2, s2db, freq, a1, a2 = result2[0]
        os.remove("test_output-000.wav")
        os.remove("test_output-001.wav")
        resultjt65data = [symbols1, symbols2]
        decodedjt65msgs = jts.decodemessages(resultjt65data, False)
        self.assertEqual(len(result1), 1)
        self.assertEqual(len(result2), 1)
        self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
        for i in range(len(jt65msgs)):
            self.assertEqual(jt65msgs[i].rstrip(), decodedjt65msgs[i].rstrip())
示例#14
0
    def test_NoCipher_NoSteg_WAV(self):
        # Encode
        jt65msgs = ["KB2BBC KA1AAB DD44", "KA1AAB KB2BBC DD44"]
        jt65data = jts.jt65encodemessages(jt65msgs, False)
        for index, value in enumerate(jt65data):
            tones = jt65sound.toneswithsync(value)
            jt65sound.outputwavfile(
                "test_output-00" + str(index) + ".wav", tones)

        # Decode
        result1 = jt65sound.inputwavfile("test_output-000.wav")
        result2 = jt65sound.inputwavfile("test_output-001.wav")
        symbols1, confidence1, wavmsg1, s2db, freq, a1, a2 = result1[0]
        symbols2, confidence2, wavmsg2, s2db, freq, a1, a2 = result2[0]
        os.remove("test_output-000.wav")
        os.remove("test_output-001.wav")
        resultjt65data = [symbols1, symbols2]
        decodedjt65msgs = jts.decodemessages(resultjt65data, False)
        self.assertEqual(len(result1), 1)
        self.assertEqual(len(result2), 1)
        self.assertEqual(len(decodedjt65msgs), len(jt65msgs))
        for i in range(len(jt65msgs)):
            self.assertEqual(jt65msgs[i].rstrip(), decodedjt65msgs[i].rstrip())
示例#15
0
            finalmsgs.append(jts.randomcover(msg, [], args.noise, args.verbose))

    # Send to output
    processoutput(finalmsgs, args.stdout, args.wavout, args.wsjt, args.freq, args.mode, args.verbose)

# Decode
elif args.decode:
    stegpresent = False

    # Process input to JT numpy arrays
    jt65data = processinput(args.stdin, args.wavin, args.verbose)
    jt65datacopy = copy.deepcopy(jt65data)
    jt65stegmsgs = []

    # Retrieve JT65 valid messages
    jt65msgs = jts.decodemessages(jt65data, args.verbose)

    if STEG_ENABLED:
        for i in range(len(jt65datacopy)):
            if jts.validatesteg(jt65msgs[i], jt65datacopy[i], hidekey, STEG_DETECTION_ERROR_THRESHOLD, args.verbose):
                jt65stegmsgs.append(jt65datacopy[i])
                stegpresent = True

    # Retrieve steg message
    stegdata = jts.retrievesteg(jt65stegmsgs, hidekey, args.verbose)

    # Decipher steg message
    stegmsg = jts.deciphersteg(stegdata, args.cipher, args.key, args.aesmode, args.verbose)

    # Print result
    for index, value in enumerate(jt65msgs):
示例#16
0
    # Send to output
    processoutput(finalmsgs, args.stdout, args.wavout, args.wsjt, args.freq,
                  args.mode, args.verbose)

# Decode
elif args.decode:
    stegpresent = False

    # Process input to JT numpy arrays
    jt65data = processinput(args.stdin, args.wavin, args.verbose)
    jt65datacopy = copy.deepcopy(jt65data)
    jt65stegmsgs = []

    # Retrieve JT65 valid messages
    jt65msgs = jts.decodemessages(jt65data, args.verbose)

    if STEG_ENABLED:
        for i in range(len(jt65datacopy)):
            if jts.validatesteg(jt65msgs[i], jt65datacopy[i], hidekey,
                                STEG_DETECTION_ERROR_THRESHOLD, args.verbose):
                jt65stegmsgs.append(jt65datacopy[i])
                stegpresent = True

    # Retrieve steg message
    stegdata = jts.retrievesteg(jt65stegmsgs, hidekey, args.verbose)

    # Decipher steg message
    stegmsg = jts.deciphersteg(stegdata, args.cipher, args.key, args.aesmode,
                               args.verbose)