LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 10-16-2010, 06:30 PM   #1
JoeBloggs1759
LQ Newbie
 
Registered: Oct 2010
Posts: 1

Rep: Reputation: 0
Tcpdump parsing for string and sending a notification by email


Hi guy I'm not very good at scripting but here is the problem that I need some scripting help with:

In a particular application when a user ticks a check box (that they shouldn't) the data with the user session information changes enough to break the system:

Bad data: 0x0030 2d33 3238 372d 3100 5450 474c 4f30 3131 -3287-1.TPGLO011

Good data:0x0030 2d33 3238 372d 3101 5450 474c 4f30 3131 -3287-1.TPGLO012

This is from a tcpdump running all the time on a server with lots of disk space using these options:
tcpdump -n -i eth2 -s 0 -w /data/trace7

I then use:
tcpdump -n -r trace6 -s 0 -X -tttt | grep -n -B4 TPGLO | grep -B4 3100

..to find the offending user, in the case above it was TPGLO011 and get them to remove the check box.

We have no control of the users as there are thousands of them around the world. The app is installed and managed locally but the ID is given by us so we can identify them.

How can I automate a script to send an email with that bit of data to the helpdesk....?
 
Old 10-17-2010, 11:58 AM   #2
x-nc
Member
 
Registered: Feb 2007
Location: VA, USA
Distribution: CentOS, Fedora
Posts: 53

Rep: Reputation: 4
Quote:
Originally Posted by JoeBloggs1759 View Post
[I]n a particular application when a user ticks a check box (that they shouldn't) the data with the user session information changes enough to break the system:

Bad data: 0x0030 2d33 3238 372d 3100 5450 474c 4f30 3131 -3287-1.TPGLO011

Good data:0x0030 2d33 3238 372d 3101 5450 474c 4f30 3131 -3287-1.TPGLO012

This is from a tcpdump running all the time on a server with lots of disk space using these options:
tcpdump -n -i eth2 -s 0 -w /data/trace7

I then use:
tcpdump -n -r trace6 -s 0 -X -tttt | grep -n -B4 TPGLO | grep -B4 3100

..to find the offending user, in the case above it was TPGLO011 and get them to remove the check box.
[...]
How can I automate a script to send an email with that bit of data to the helpdesk....?
If all the info you need is output from the second tcpdump command then the quickest way would be to pipe the output to mail. Something like thisa -

Code:
tcpdump <stuff> | mail -s "Dumb User" helpdesk@<yoursite>
If you want a more detailed message you can have a text file with instructions for the helpdesk prepared and then append the tcpdump output to it and mail that file. A quick example -

message.template.txt
--------------------
"Dear Helpdesk,

This user is an idiot!

"

script
------
Code:
cp message.template.txt message.txt

tcpdump <stuff> >> message.txt

cat message.txt | mail -s "Dumb User" helpdesk@<yoursite>
That should hopefully get you started.

Joe
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios has stopped sending email notification s deibertine Linux - Software 7 05-06-2010 08:22 PM
Parsing String. msgforsunil Linux - Newbie 8 06-11-2009 01:47 PM
how to filter packets based on some string in tcpdump kamlesh_kmr Linux - Networking 2 02-10-2009 04:43 AM
string parsing using perl bharatbsharma Programming 1 12-05-2007 06:04 AM
Sending Backup Notification???? ajeetraina Linux - Server 2 11-14-2007 06:18 AM


All times are GMT -5. The time now is 05:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration