Extracting and Coverting values from a K12 Textfile (Wireshark capture)
1. The problem statement, all variables and given/known data:
Using the Windows version of Wireshark, record at least 100 entries of normal network traffic (in a file). Pick 2 packets and analyze the contents showing the header and data information (ie what port #, service etc). You can use the Wireshark display as a confirmation by loading the file back into Wireshark. Examine the format of the Wireshark file and write a short Perl script to extract the source and destination IP address and the protocol type from each entry in the file and print it on the screen.
Now my understanding of the problem given to me for lab homework is that you write a script (Perl preferred) that can read a wireshark capture file and sort though the packet's data to grab what you want, except it should be able to work on any # of packets.
2. Relevant commands, code, scripts, algorithms:
As far as I know with this type of script I've asked several classmates and everyone is doing them differently, some are using arrays (1-4 at most) and some are using strings that break down into substrings. I've heard of the pack/unpack and hex/oct perl commands and heard that you can probably pull this off with awk/gawk
3. The attempts at a solution (include all code and scripts):
My first attempt with this was using Perl with an array but it did not work too well as I got stuck, I also tried to do it with substrings but couldn't figure that out (past courses for scripting taught 0 things about scripting but rather programming in Perl/Bash).
I will post the code for my 1st program, as for the 2nd one using strings I believe I deleted it.
As far as I know the foreach statement does not work as my clean array has nothing in it and I might've messed that up.
My second attempt was using a bash script with the awk command
I could grab what I wanted from the file but I have no idea how to manipulate it to do what I want such as coverting the hex values of the source and destination IP to decimal.
This is the code I was using but I gave up after doing some research on awk:
Those are pretty much the locations of the data I want to extract after trial & error and also looking at each packet through wireshark.
Sample of the K12 Textfile 4. School (University) and Course Number:
SAIT Southern Alberta Institute of Technology, ITSC 311
My first post, so don't kill me :)
Say i open some textfile with some example like this.
on the table are handy, bread and wine
Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this:
table
plane ... (3 Replies)
I have a file like this
############################################
# ParentFolder Flag SubFolders
Colateral 1 Source1/Checksum
CVA 1 Source1/Checksum
Test 1 VaR/Checksum
Test2 1 SVaR/Checksum
FX 1 ... (6 Replies)
Hi All,
I am connecting to Oracle DB from UNIX script. Want to capture all dates between start date and end date and store them in file. Once this is done, want to read dates one by one. How to achive this in UNIX and Oracle? Please let me know if you have any idea on the same.
Thanks and... (4 Replies)
I have a K shell script (ksh) that needs to return an email address. A C program was written (prog1) to now access the email address off of an oracle table. The call to the program in the ksh is
prog1 -p parm1
Based on Parm1 the program will read an oracle table and retrieve the email... (2 Replies)
i have an oracle function which returns two values, one is the error message if the function encounters anything and another one which returns a number
i need to capture both
and pass it on to unix shell script
how to do it (2 Replies)
I have to read the file, in each line of file i need to get 2 values using more than one search pattern.
ex: <0112 02:12:20 def > /some string/some string||some string||124
i donot have same delimiter in the line, I have to read '0112 02:12:20' which is timestamp, and last field '124' which is... (4 Replies)
Thanks in advance.
My environment is Ubuntu 9.04 desktop customized to be a high school classroom server for teaching code development. I have a unique "fake" jail called "lshell" which is very easy to setup and restricts users to commands that I dictate DISALLOWING ANYTHING ELSE. These... (6 Replies)
Hi,
I want to put values in .txt file into array. Example :
$vi repo.txt
abc
def
ghi
jkl
mno
pqr
i want the output to be like this:
$echo ${mydf}
abc
$echo ${mydf}
def
$echo ${mydf}
ghi (3 Replies)
Im trying to create a utility that can do unit conversions using a seperate formula file(one which i can add conversions to at a later date). however i'm stuck when it comes to pulling the formulas out of the formula file for use in the script.
heres a rundown of what the script does.
The... (4 Replies)