예제 #1
0
파일: tkip.py 프로젝트: bonfa/netsec
	def decryptPayload(self):
		#printTKIP_parameters(self.tk,self.iv,self.ta,self.ciphertext)
		# Creo la mixing function
		mixingFunction = TKIPmixingFunction(self.tk,self.ta,self.tsc)
		
		# Calcolo il wep seed (tupla)
		wepSeed = mixingFunction.getWepSeed()
		#printWepSeed(wepSeed)		
	
		# Passo da stringa a tupla
		lunghezza = len(self.ciphertext)
		stringFormat = str(lunghezza)+'B'
		cipher_tuple = struct.unpack(stringFormat,self.ciphertext)

		ivTuple = ()

		# Decripto la tupla
		decryptor = WepDecryption(ivTuple,wepSeed,cipher_tuple)	
			
		# Estraggo il plaintext --> tupla
		plaintextAndIcv = decryptor.getPlaintextAndIcv()
		
		#print 'PLAINTEXT = ' + str(plaintextAndIcv)
	
		# Controllo il MIC
		if self.checkMic(plaintextAndIcv[:-4]):
			# ritorno il plaintext
			return plaintextAndIcv
		else:
			#errore MIC
			raise TKIPError('checkMic()','MIC does not match')
예제 #2
0
	def test_tkipMixingFunction_8(self):
		'''
		testo la mixing function nella sua interezza
		'''
		tk = struct.pack('16B',0xC8,0xAD,0xC1,0x6A,0x8B,0x4D,0xDA,0x3B,0x4D,0xD5,0xB6,0x54,0x38,0x35,0x9B,0x05)
		ta = struct.pack('6B',0x94,0x5E,0x24,0x4E,0x4D,0x6E)
		tsc = struct.pack('6B',0XF9,0x30,0xB7,0x73,0x15,0x8B)
		mixingFunction = TKIPmixingFunction(tk,ta,tsc)
		processedWepSeed = mixingFunction.getWepSeed()
		expectedWepSeed = (0x30,0x30,0xF9,0x31,0x55,0xCE,0x29,0x34,0x37,0xCC,0x76,0x71,0x27,0x16,0xAB,0x8F)
예제 #3
0
	def test_tkipMixingFunction_7(self):
		'''
		testo la mixing function nella sua interezza
		'''
		tk = struct.pack('16B',0xC8,0xAD,0xC1,0x6A,0x8B,0x4D,0xDA,0x3B,0x4D,0xD5,0xB6,0x54,0x38,0x35,0x9B,0x05)
		ta = struct.pack('6B',0x94,0x5E,0x24,0x4E,0x4D,0x6E)
		tsc = struct.pack('6B',0XF8,0x30,0xB7,0x73,0x15,0x8B)
		mixingFunction = TKIPmixingFunction(tk,ta,tsc)
		processedWepSeed = mixingFunction.getWepSeed()
		expectedWepSeed = (0x30,0x30,0xF8,0x65,0x0D,0xA0,0x73,0xEA,0x61,0x4E,0xA8,0xF4,0x74,0xEE,0x03,0x19)
예제 #4
0
	def test_tkipMixingFunction_6(self):
		'''
		testo la mixing function nella sua interezza
		'''
		tk = struct.pack('16B',0x98,0x3A,0x16,0xEF,0x4F,0xAC,0xB3,0x51,0xAA,0x9E,0xCC,0x27,0x1D,0x73,0x09,0xE2)
		ta = struct.pack('6B',0x50,0x9C,0x4B,0x17,0x27,0xD9)
		tsc = struct.pack('6B',0x8D,0x05,0xFC,0x10,0xA4,0xF0)
		mixingFunction = TKIPmixingFunction(tk,ta,tsc)
		processedWepSeed = mixingFunction.getWepSeed()
		expectedWepSeed = (0x05,0x25,0x8D,0x09,0xF8,0x15,0x43,0xB7,0x6A,0x59,0x6F,0xC2,0xC6,0x73,0x8B,0x30)
예제 #5
0
	def test_tkipMixingFunction_4(self):
		'''
		testo la mixing function nella sua interezza
		'''
		tk = struct.pack('16B',0x63,0x89,0x3B,0x25,0x08,0x40,0xB8,0xAE,0x0B,0xD0,0xFA,0x7E,0x61,0xD2,0x78,0x3E)
		ta = struct.pack('6B',0x64,0xF2,0xEA,0xED,0xDC,0x25)
		tsc = struct.pack('6B',0x00,0x00,0x43,0xFD,0xDC,0x20)
		mixingFunction = TKIPmixingFunction(tk,ta,tsc)
		processedWepSeed = mixingFunction.getWepSeed()
		expectedWepSeed = (0x00,0x20,0x00,0x49,0x8C,0xA4,0x71,0xFC,0xFB,0xFA,0xA1,0x6E,0x36,0x10,0xF0,0x05)
예제 #6
0
	def test_tkipMixingFunction_3(self):
		'''
		testo la mixing function nella sua interezza
		'''
		tk = struct.pack('16B',0x63,0x89,0x3B,0x25,0x08,0x40,0xB8,0xAE,0x0B,0xD0,0xFA,0x7E,0x61,0xD2,0x78,0x3E)
		ta = struct.pack('6B',0x64,0xF2,0xEA,0xED,0xDC,0x25)
		tsc = struct.pack('6B',0xFF,0xFF,0x43,0xFD,0xDC,0x20)
		mixingFunction = TKIPmixingFunction(tk,ta,tsc)
		processedWepSeed = mixingFunction.getWepSeed()
		expectedWepSeed = (0xFF,0x7F,0xFF,0x93,0x81,0x0F,0xC6,0xE5,0x8F,0x5D,0xD3,0x26,0x25,0x15,0x44,0xCE)
예제 #7
0
	def test_tkipMixingFunction_2(self):
		'''
		testo la mixing function nella sua interezza
		'''
		tk = struct.pack('16B',0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F)
		ta = struct.pack('6B',0x10,0x22,0x33,0x44,0x55,0x66)
		tsc = struct.pack('6B',0x01,0x00,0x00,0x00,0x00,0x00)
		mixingFunction = TKIPmixingFunction(tk,ta,tsc)
		processedWepSeed = mixingFunction.getWepSeed()
		expectedWepSeed = (0x00,0x20,0x01,0x90,0xFF,0xDC,0x31,0x43,0x89,0xA9,0xD9,0xD0,0x74,0xFD,0x20,0xAA)