def getstegresult(stegcollection, cipher, key, aesmode, verbose): # Decodes an entire series of steg messages, or notifies you if you have # some steg messages but are awaiting more transmissions to decode if cipher == "none": return True, "", True, jts.deciphersteg( stegcollection, cipher, key, aesmode, verbose, False) # Steg has already been unprepped else: localarray = stegcollection[0] if verbose: print "localarray : " + str(localarray) localarray = jts.jt65tobytes(localarray) if getstatusbyte(localarray) & 0x80 != 0x80: # The first packet in the collection does not represet a 'start' # packet, reset the collection and catch the next one return False, "Monitored steg mid-transmission, resetting for next transmission.", True, "" # The first packet represents a 'start' packet, do we have all the # packets? expectedpackets = getstatusbyte(localarray) & 0x7F if expectedpackets <= len(stegcollection): return True, "", True, jts.deciphersteg(stegcollection, cipher, key, aesmode, verbose, False) # The multi-packet transmission is not complete yet return False, "(" + str(len(stegcollection)) + "/" + str( expectedpackets) + ") total packets received.", False, ""
def test_PackUnpack(self): for i in range(RANDOM_TEST_LOOP_COUNT): randomJT65bytes = np.array( [random.randint(0, JT65_MAX_SYMBOL) for r in range(12)]) byteresult = jts.jt65tobytes(randomJT65bytes) jt65result = jts.bytestojt65(byteresult) self.assertEqual(len(byteresult), 9) self.assertEqual(len(jt65result), 12) self.assertEqual(jt65result.tolist(), randomJT65bytes.tolist())
def getstegresult(stegcollection, cipher, key, aesmode, verbose): # Decodes an entire series of steg messages, or notifies you if you have # some steg messages but are awaiting more transmissions to decode if cipher == "none": return ( True, "", True, jts.deciphersteg(stegcollection, cipher, key, aesmode, verbose, False), ) # Steg has already been unprepped else: localarray = stegcollection[0] if verbose: print "localarray : " + str(localarray) localarray = jts.jt65tobytes(localarray) if getstatusbyte(localarray) & 0x80 != 0x80: # The first packet in the collection does not represet a 'start' # packet, reset the collection and catch the next one return False, "Monitored steg mid-transmission, resetting for next transmission.", True, "" # The first packet represents a 'start' packet, do we have all the # packets? expectedpackets = getstatusbyte(localarray) & 0x7F if expectedpackets <= len(stegcollection): return True, "", True, jts.deciphersteg(stegcollection, cipher, key, aesmode, verbose, False) # The multi-packet transmission is not complete yet return ( False, "(" + str(len(stegcollection)) + "/" + str(expectedpackets) + ") total packets received.", False, "", )
def test_PackNegative(self): for i in range(RANDOM_TEST_LOOP_COUNT): randomJT65bytes = np.array( [random.randint(0, JT65_MAX_SYMBOL) for r in range(12)]) byteresult = jts.jt65tobytes(randomJT65bytes) self.assertNotEqual(byteresult.tolist(), randomJT65bytes.tolist())