I have managed to filter the items I want, but they are in a kind of column.
I did it this way:
import os
cmd = os.popen('arping -I enp1s0 -c 2 192.168.0.1')
arr = cmd.read().split('\n')
for line in arr:
if 'Unicast' in line:
a = line.split()
b = a[4]
c = b[1:18]
print c
The result of print c
, is the MAC address of the IP, in which case it exits that way.
Example:
AA:BB:CC:DD:EE:00
AA:BB:CC:DD:EE:00
AA:BB:CC:DD:EE:01
How can I get all the content on the bottom line, such as line 1, 2 or 3. I want to get AA:BB:CC:DD:EE:01
and put it in a variable.