LeetViet

Platinum Member
Mar 6, 2003
2,411
0
76
The unparsed info looks like this (repeating format with different pkt, len and data values for each pkt):
[!] SERVER->CLIENT pkt 0x0001 [len 0x0005]
OFFSET 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF
--------------------------------------------------------------------------
000010 01 01 01 01 01 .....

And I want to parse it into a .csv like:
01,01,01,01

This is just an example as some fields vary in size. I'd like to set it to only parse certain data based on the "pkt 0x____" info with each "pkt 0x____" I set it to parse in its own .csv file. I'd also like to set the size of the fields as some .csv could be 01,010101,01

Could anyone help? :)
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
This is a perfect time to write a simple regex script.

here some links (just a quick google and glanced over, not checked in depth)

http://weblogtoolscollection.com/regex/regex.php - use php for regex

http://www.anaesthetist.com/mnm/perl/regex.htm - use perl for regex

http://www.regular-expressions.info/dotnet.html - Use C# or VB.net for regex

http://users.sdsc.edu/~steube/Bshell/ - Bash shell scripting

http://members.tripod.com/b62/doc/docksh.htm - korn shell scripting

http://www.regular-expressions.info/ruby.html - ruby

http://www.amk.ca/python/howto/regex/ -Python

http://webster.cs.ucr.edu/AoA/AoAExtra/Patterns.html -HLA

That should get you going, regex is useful for tons of things and most programming languages have regex functions. If you need any help, feel free to ask. 90% of what I do anymore deals with regex's.