Tshark piping issue
hello guys, im currently in the middle of a cyber security course, and i have a little problem.
i was given a task to write a script with Tshark to sniff a live network- then i need to filter the MAC addresses, dump them to a .txt file, and then from that script to open a new terminal and use tail -f on that .txt file to see the last mac adresses that connected to the network... something like a live monitor. however, something is not working. here is my script: (im using Kali)
tshark -D
read -p " what is the desired interface for live capture? " a
touch sniffer.log
gnome-terminal -- tail -f sniffer.log
tshark -i $a -V -l | grep -i "mac" |cut -d':' -f2-5 | sort | uniq >> sniffer.log
anything i put after the grep command makes tshark show me a packet counter and nothing more.
can you please assist me?
thank you.