#!/bin/bash

if [[ $1 == '' || '-h' || 'help' ]]
then

 echo "You need to declare a file name like so parseScan scan.pcap"

else

tshark -r $1 -T json scan.json

cat scan.json | grep 'ip.dst":' > tmpfile.txt

grep -v '192.168.' tmpfile.txt | sort | uniq > results.txt

sed -i '/255.255.255.255/d' results.txt

sed -i 's/ //g' results.txt

sed -i 's/"ip.dst":"//g' results.txt

sed -i 's/",//g' results.txt

rm tmpfile.txt

 fi
 
