I'm trying this out. In the output from fromstring, I added the following
imageStr = str(parts[4]) imageStr = imageStr.replace('[','') imageStr = imageStr.replace(']','') imageArr = np.fromstring(imageStr, dtype=int, sep=' ') print("[x] imageArr type %s" % type(imageArr)) print("[x] imageArr ", imageArr)And this is now the output:
Output: [*] Waiting for messages. To exit press CTRL+C
[x] message '0,1617735054,1617735054620256300,4,[104 126 180 87]'
[x] message type <class 'str'>
[x] parts ['0', '1617735054', '1617735054620256300', '4', '[104 126 180 87]']
[x] parts len 5
[x] imageStr 104 126 180 87
[x] imageStr type <class 'str'>
[x] imageArr type <class 'numpy.ndarray'>
[x] imageArr [104 126 180 87]
Looks like the '[]' had to be removed from the string, and Numpy puts them back when converting to the int array.