--- wifite.orig	2013-08-03 12:06:00.000000000 +0800
+++ wifite	2013-08-03 13:55:43.140584142 +0800
@@ -1701,12 +1701,12 @@
 	proc = Popen(cmd, stdout=PIPE, stderr=DN)
 	proc.wait()
 	for line in proc.communicate()[0].split('\n'):
-		if line.endswith('Key (msg 1/4)') or line.endswith('Key (msg 3/4)'):
+		if line.endswith('Key (Message 1 of 4)') or line.endswith('Key (Message 3 of 4)'):
 			while line.startswith(' ') or line.startswith('\t'): line = line[1:]
 			line = line.replace('\t', ' ')
 			while line.find('  ') != -1: line = line.replace('  ', ' ')
 			return line.split(' ')[2]
-		elif line.endswith('Key (msg 2/4)') or line.endswith('Key (msg 4/4)'):
+		elif line.endswith('Key (Message 2 of 4)') or line.endswith('Key (Message 4 of 4)'):
 			while line.startswith(' ') or line.startswith('\t'): line = line[1:]
 			line = line.replace('\t', ' ')
 			while line.find('  ') != -1: line = line.replace('  ', ' ')
@@ -1995,18 +1995,10 @@
 				
 				fields = line.split(' ')
 				
-				# Sometimes tshark doesn't display the full header for "Key (msg 3/4)" on the 3rd handshake.
-				# This catches this glitch and fixes it.
-				if len(fields) < 8: 
-					continue
-				elif len(fields) == 8:
-					fields.append('(msg')
-					fields.append('3/4)')
-				
 				src = fields[2].lower() # Source MAC address
 				dst = fields[4].lower() # Destination MAC address
-				#msg = fields[9][0]      # The message number (1, 2, 3, or 4)
-				msg = fields[-1][0]
+				msg = fields[9][0]      # The message number (1, 2, 3, or 4)
+				#msg = fields[-1][0]
 				
 				# First, third msgs in 4-way handshake are from the target to client
 				if msg_num % 2 == 1 and (src != target.bssid.lower() or dst != client): continue
