Results 1 to 20 of 27
Thread: how to read flow file ?
- 12-14-2011, 08:08 AM #1
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
- 12-14-2011, 01:11 PM #2
Re: how to read flow file ?
Do you have documentation on the contents (byte by byte) of the file?
Do you want to print out the contents of the bytes in hexidecimal?
How does this relate to networking?
- 12-15-2011, 02:07 AM #3
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Re: how to read flow file ?
hi Norm,
my file is netflow file, because the forum can't let me attach the file here ,
because i want to parse the netflow record ,
so how can i print out the contents of the netflow file ?
thanks,
- 12-15-2011, 02:10 AM #4
Re: how to read flow file ?
Do you have documentation on the contents (byte by byte) of the file?
You could read it byte by byte and print out each byte in hexidecimal.how can i print out the contents of the netflow file ?
- 12-15-2011, 02:15 AM #5
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Re: how to read flow file ?
it 's netflow version 5 structure
Netflow :: Version 5
- 12-15-2011, 12:44 PM #6
Re: how to read flow file ?
If you know the layout of the file, then you should be able to write a java program to read the file and extract and print its contents.
- 12-16-2011, 02:13 AM #7
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Re: how to read flow file ?
hi norm,
that's what i want . can you give me more hint about how to read the file and extract and print its ?
can you give me an example code ?
- 12-16-2011, 02:31 AM #8
Re: how to read flow file ?
What is in the file? numbers, Strings or ???
If you read the bytes of each record into a byte array, you can then pick out the bytes to build numbers or Strings.
For numbers, use the shift operator to build the number. Load a byte into an int, shift it left 8 bits and add in the next byte, shift it left 8 bits and add in the next byte up to four bytes.
For Strings, look at the String class's constructors. I think you can use a byte array with indexes into the array to say where the bytes for the String begin and end.
- 12-20-2011, 02:45 AM #9
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Re: how to read flow file ?
hi norm,
i still can't print out the file ,can i send the file to you by email ?
- 12-20-2011, 02:49 AM #10
Re: how to read flow file ?
Why do I need the file? Do you have a hex editor that you can view the contents of the file with?
Here is what the contents of a text file in Unicode format starts with:
FFFE 5400 6800 6900 7300 ...
This was created on Windows with WordPad using the Unicode text format option in the Save As dialog.
- 12-20-2011, 07:00 AM #11
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Re: how to read flow file ?
hi norm,
actually, my problem is how to read the file by java ,
it's two records of my file ,can you give me sample code for how to print out this to readable ?
000000 11001111 00010000 00000001 00000011 01011000 00000000 00000000 00000000 00000010 00000000 00000010 00000000 00000101 00000000 00000110 00000000
000010 00000100 00000000 11011101 10010110 11100110 01001011 00000111 00000000 00000100 00000000 00001000 10011000 11100110 01001011 00001000 00000000
- 12-20-2011, 11:20 AM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,449
- Rep Power
- 16
Re: how to read flow file ?
Without knowing the format of the file that is going to be essentially meaningless gibberish.
- 12-20-2011, 12:23 PM #13
Re: how to read flow file ?
What do the 0's and 1's in your post represent? The bits in the file?how to print out this to readable
Why does the first group have 6 digits?
If what you posted is supposed to be binary, the file does not contain ASCII text.
- 12-21-2011, 02:04 AM #14
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Re: how to read flow file ?
hi norm,
it's netflow data , i get 0's and 1's is using binary viewer tool .
it's should be represent like this :
185.56.83.89 156.110.16.1 17 53037 53 72 1
and for the seven column is
srcIP dstIP prot srcPort dstPort octets packets
- 12-21-2011, 02:09 AM #15
Re: how to read flow file ?
You need a byte by byte format for the contents of the file that describes what is in the file. When you have that you can decide the best way to convert the bytes in the file to the format that you want the data in.
Are you trying to convert the data to a String?
- 12-21-2011, 02:18 AM #16
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Re: how to read flow file ?
hi norm,
i have format the content for byte ,
000000 207 016 001 003 088 000 000 000
000008 002 000 002 000 005 000 006 000
000010 004 000 221 150 230 075 007 000
i want to convert the data to readable string like :
185.56.83.89 156.110.16.1 17 53037 53 72 1
it's can let me know the seven column value :
srcIP dstIP prot srcPort dstPort octets packets
- 12-21-2011, 02:22 AM #17
Re: how to read flow file ?
By format I mean a description of what is in each byte. For example
In the first column is which bytes, the second column is its contents
0-1 Message Id
2-5 Count of items
6-7 Item one id
...
- 12-21-2011, 02:28 AM #18
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Re: how to read flow file ?
hi norm ,
Flow record format :
Bytes Contents Description
0-3 srcaddr Source IP address
4-7 dstaddr Destination IP address
8-11 nexthop IP address of next hop router
12-13 input SNMP index of input interface
14-15 output SNMP index of output interface
16-19 dPkts Packets in the flow
20-23 dOctets Total number of Layer 3 bytes in the packets of the flow
- 12-21-2011, 02:33 AM #19
Re: how to read flow file ?
Looks like you could use the methods of the DataInputStream to read the first three fields as int, then read the 2 byte fields as shorts. Then convert the int to Strings.
- 12-21-2011, 02:43 AM #20
Member
- Join Date
- Dec 2011
- Posts
- 13
- Rep Power
- 0
Similar Threads
-
Read CSV File, sort records, and output a new csv file
By jrnowlan in forum New To JavaReplies: 1Last Post: 08-05-2011, 09:21 PM -
How to generate Data Flow Diagram(Work Flow Diagram)
By stsivaraj in forum AWT / SwingReplies: 1Last Post: 12-22-2010, 11:21 PM -
Read file from directory, update contents of the each file
By svpriyan in forum New To JavaReplies: 2Last Post: 05-11-2009, 10:07 AM -
how to read openproj(Projity) file i.e. ,POD file(Project Management file)
By mahendra.athneria in forum New To JavaReplies: 0Last Post: 02-11-2009, 09:53 AM -
How to read a text file from a Java Archive File
By Java Tip in forum Java TipReplies: 0Last Post: 02-08-2008, 09:13 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks