Hello Everyone,
I am currently trying to write a Bash Script to call a PCAP file. The command I will use in the script will be the following:
tshark -r test.pcap -T fields -e frame.number -e frame.time -e eth.src -e eth.dst -e ip.src -e ip.dst -r ip.proto -E header=y -E separator=, quote=d -E occurance=f > pcap.csv
This command will allow me to see everything I need in a nicely formatted CSV file however I am struggling to write an interactive script to input both the name of the pcap (testfile.pcap above) and the name of the csv file (testfile.csv above) for the output to be saved to.
Does anyone know how I could put this into an interactive script so that when an admin runs the script, they can input the name of the existing pcap and the name of the csv file that the formatted information should be saved to?
So far my script contains the following:
#!/bin/bash
echo="What is the name of your PCAP input file?"
echo="What is the name of your CSV output file?
tshark -r test.pcap -T fields -e frame.number -e frame.time -e eth.src -e eth.dst -e ip.src -e ip.dst -r ip.proto -E header=y -E separator=, quote=d -E occurance=f > pcap.csv
I have been watching and reading a lot about bash scripting and I think the test.pcap and pcap.csv above should each be a variable but how do I make a variable represent something input by a user? Essentially I would like the user to be able to enter in the name of the pcap (and location if need be) to analyze, followed by the name of the csv file to send the output to.
Thanks in advance!
Tuxor