LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-13-2004, 10:17 PM   #1
james_cwy
Member
 
Registered: Nov 2003
Posts: 52

Rep: Reputation: 15
Trimming a file


I have this output from p0f, a passive fingerprinting tool. I want to trim the output.
The output from p0f:
202.185.109.169:3421 - Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222)
-> 202.185.109.163:139 (distance 0, link: ethernet/modem)
202.185.109.165:34422 - Linux 2.4/2.6 (up: 1 hrs)
-> 216.136.172.233:80 (distance 0, link: ethernet/modem)
202.185.109.161:2226 - Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222)
-> 202.185.109.180:139 (distance 0, link: ethernet/modem)
202.185.109.161:2227 - Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222)
-> 202.185.109.180:139 (distance 0, link: ethernet/modem)
198.182.97.3:29145 - UNKNOWN [16384:101:1:48:M1380,N,N,S:A:?:?]
-> 202.185.109.182:80 (link: GPRS, T1, FreeS/WAN)
202.185.109.165:34520 - Linux 2.4/2.6 (up: 1 hrs)
-> 216.136.172.233:80 (distance 0, link: ethernet/modem)
202.185.109.185:1117 - Windows XP Pro SP1, 2000 SP3
-> 202.185.109.165:80 (distance 0, link: ethernet/modem)
................................................etcc..

What I would like:
1.To keep the OS type only, ie Windows 2000 SP2+, XP SP1,Linux 2.4/2.6, Windows XP Pro SP1, 2000 SP3 etcc.
2.To get rid of the rest except OS type as mentioned in 1
3.If can, get rid of UNKNOWN too.

Can I use a command to trim/filter until the output that I want?
Pls advise and provide an example.

Thanks
James
 
Old 01-13-2004, 10:25 PM   #2
james_cwy
Member
 
Registered: Nov 2003
Posts: 52

Original Poster
Rep: Reputation: 15
Actual format of text file

The formatting is abit out.
Actual, eg:
202.185.109.169:3421 - Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) is on one line while the next line starts with a ->
Then it is 202.185.109.169:3421 - Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) on one line, next line starts with ->
THen next line is 202.185.109.169:3421 - Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) on one line and next starts with a ->

Hope you get what I mean.

James
 
Old 01-13-2004, 10:28 PM   #3
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
you grep and pipe its out put to a file. you'd need a regex like

p0f | grep '- .* (|->' > thefile

I think this will also give you the - ( or -> I haven't done this for a while. Time to brush up on my grepping skills
 
Old 01-13-2004, 10:37 PM   #4
james_cwy
Member
 
Registered: Nov 2003
Posts: 52

Original Poster
Rep: Reputation: 15
The actual text file

If anyone would like the actual output file to try, you can get it at
<<http://www.phpbuilder.com/board/show...eadid=10265259>>
If you cannot get it,pls provide your email and I will post it to you.

I am really new at Linux and hope someone can help me out.
THanks so much

James
 
Old 01-13-2004, 11:08 PM   #5
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
Sorry messed up! This Text manipulation info will probably help you get upto speed on the tools you'll need to get this to work. you can always look up extra info on the tools by typing man followed by the command.
 
  


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
Multiple CUPS problems (trimming pages, wrong pagesize) rutgerw Linux - Software 3 09-05-2005 04:12 PM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 04:15 AM
Trimming down a Suse 9.0 install Bradless Linux - Distributions 0 08-02-2004 05:36 PM
How to play a media file/ video file/mp3 file recorded in harddisk/cd-rom arindam Linux - Newbie 2 09-05-2003 11:31 AM
Help with a Script for Trimming last 2 letters of file names eagletech Linux - Newbie 3 11-13-2002 07:04 AM


All times are GMT -5. The time now is 06:22 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration