I wanted to extract IP on a Tcpdump Command output.
tcpdump -nei eth0 and src 10.10.10.1
Sample Output of Above Command. As the output was very big I have posted it in below link.
https://pastebin.pl/view/3b6ab16d
Commands Which I tried
tcpdump -nei eth0 and src 10.10.10.1 | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
tcpdump -nei eth0 and src 10.10.10.1 | awk '{sub(/^.*> /, "", $0); sub(/:.*$/,"", $0); sub(/\.[^\.][^\.]*$/,"",$0); print $0}'
I wanted the Output to be Like
140.345.12.45
140.345.12.45
140.345.12.45
140.345.12.45
140.345.12.45
140.345.12.45
Only the IP Address. Someone please help me.. T.I.A