I am processing a 7 PCAP file by splitting the file based on MAC address this is fine but I have various variables where I want to iterate through
${macs[*]} - I have a list 10 of different MAC address I would like to iterate through them ${devices[0]} - I have a list of 10 devices e.g. Samsung, Phillips I want to add a number to each file
for pcf in $pcap_file
do
for mac in ${macs[*]}
do
echo "$mac" >&2
/usr/bin/tshark -r "$pcf" -Y "eth.addr eq $mac" -w ${devices[0]}.pcap
done
done
At the moment I am manually uncommenting/commenting them
macs=( d0:45:a8:00:67:5e )
macs=( 44:65:0d:56:cc:d3 )
macs=( 70:ee:50:34:34:43 )
devices=('Samsunghub_1' 'Samsunghub_2' 'Samsunghub_3' 'Samsunghub_4' 'Samsunghub_5' 'Samsunghub_6' 'Samsunghub_7')
devices=('Echo_1' 'Echo_2' 'Echo_3' 'Echo_4' 'Echo_5' 'Echo_6' 'Echo_7')
devices=('netamo_1' 'netamo_2' 'netamo_3' 'netamo_4' 'netamo_5' 'netamo_6' 'netamo_7')
I want to iterate through each PCAP file extract based on the MAC address then label each one based on the "devices" but adding a number at the end