Solved

binary files

Posted on 2003-11-15
18
613 Views
Last Modified: 2010-04-17
Hi..
I would like to 'decode' some binary files.
In details: I am currently running some simulations and the results for these simulations are saved as binary files. I could of course read these results if I load them into the simulation program itself but it is not enough. There are much more information that I need to extract from these binary files and I know these information are stored somewhere in the binary files.
Any idea of how can I do this??
It is pretty important.
Thanks.
0
Comment
Question by:justforfunman
  • 6
  • 5
  • 3
  • +2
18 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 30 total points
Comment Utility
Hi justforfunman,

that depends on the format of the files !!!

e.g. in C, all you need to do is

fopen ();
fread();
/* this is where format comes in ... if you know the format, you can get information here ... extract information*/
fclose();

Cheers!
Sunny:o)
0
 

Author Comment

by:justforfunman
Comment Utility
The programm is written in MS viual basic 5 and the file should be in vb format as well.
Please give me straight instructions if possible as I have not much programming experience in this.

Thanks

0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 30 total points
Comment Utility
You need to know the format of the file.  You can open it and read it but without knowing the file format the data will be meaningless.

mlmcc
0
 
LVL 45

Expert Comment

by:sunnycoder
Comment Utility
>The programm is written in MS viual basic 5 and the file should be in vb format as well
What is the VB format???

look at it this way ... Everything that is written in your system is just 0 and 1
Then how do we have so many different file format ? Simply because, the way these 0s and 1s are ordered is different in each format... The way information is stored in an excel sheet is different from text in notepad... Until and unless you know this underlying format, you cannot interpret the information held in it.... all you can do is read 0s and 1s and print them meaninglessly

So, give us the file format first.
0
 

Author Comment

by:justforfunman
Comment Utility
ok guys, sorry for the misunderstanding.
at the moment, i still couldn't figure out the file format. I just know that it is a binary file as the programm said so and no format is stated there. if you guys can be so kind to give me some idea on how to figure this out, i will appreciate it very much. anyway, i will try my best to find it out and post any results here if i am successful.
thanks.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
If they don't publish the format then the only way to find the format is through trial and error.

Run the simuation to create the file and put some known information into the simulation.

Look at the file and see if you can see the information.

Repeat several times to see what changes when you change a single value in the simulation.

mlmcc
0
 

Author Comment

by:justforfunman
Comment Utility
Unfortunately, there is nothing that I can read from the file.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Any ideas what the data is supposed to be?

If you run the simulation and print what you can what do you get?  What does the file show?

mlmcc
0
 

Author Comment

by:justforfunman
Comment Utility
Ok. So it is actually monte carlo simulation which simulates radiation transport.
So, the results file is supposed to store the energy deposited in some voxels (volume elements) and I think each voxel is allocated 8 bytes. This is just a small part from it, besides there are still more information about the energy and direction of each particle. In fact, these all should be numbers. The programm itself can read these and presents these information as some graphs but I need the numerical values. I know these values are somewhere in the file as these values are used to plot the graphs and so on.
So, hope that it is clear.
Any clues??

Thanks
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 54

Assisted Solution

by:nico5038
nico5038 earned 20 total points
Comment Utility
Every file can be viewed with a hex editor.
Just try one like:
http://linux.tucows.com/preview/8309.html

Finding the values can be tempting as they can be stored as numbers, hexfigures or sometimes even coded...

Nic;o)
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
In your file numbers are stored in binary form not decimal.  If you try to view with say notepad you will see the ASCII representation.
A HEX editor will show you the hex equivalent 2 digits per byte.
Unless you can provide some information on the values you think are stored it will be very difficult to figure out the file format.

mlmcc
0
 
LVL 9

Assisted Solution

by:bhagyesht
bhagyesht earned 20 total points
Comment Utility
open your files using a binary editor see if you can make any sense of it. if yes its possible to decode them
VC 6.0 is good binary editor

or

open them in a hex editor and try to see if you can make sense.
0
 

Author Comment

by:justforfunman
Comment Utility
Hi all,
I tried Hex Editor but couldn't figure out much from it. I tried to search for some known values in the Hexfigures but it is not so rewarding.
mlmcc, what kind of values you want me to provide you which you think will help?
Thanks everyone.


0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
I don't know since I am not familiar with the application.  A sample of the file and a sample from the simulation.

Information on several voxels.

mlmcc
0
 
LVL 45

Expert Comment

by:sunnycoder
Comment Utility
IMHO, given  a sequence of 0s and 1s, trying to decipher the format of a binary file is not a trivial task... If the format can be learnt from the vendor or such resource, it will be lot more easier for you. Reading the file in a hex editor or or such things is highly unlikely to get you anywhere. It will be a waste of time and resources.
0
 
LVL 54

Expert Comment

by:nico5038
Comment Utility
You can look to the right hand side of the hex editor to see the characters the hex figures represent.
Not all characters however are printable.
Typed numbers in hex will look like:
30 31 32 etc
But when stored in binary coded format the digits can represent the numbers like:
00 12 34 56
or when real binary from 0 to 16:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 10

Nic;o)
0
 
LVL 9

Expert Comment

by:bhagyesht
Comment Utility
if you want to edit someone's data files make sure leagally you are allowed.
0
 

Author Comment

by:justforfunman
Comment Utility
hi everybody, seem like it is a non-trivial task.
I will try to find out the file format and post again for your help when i got it.
thanks everybody!!


0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Reading variable length EBCDIC in SAS 9 74
mapBully challenge 6 88
topping3 challenge 14 48
recursion example 16 66
A short article about problems I had with the new location API and permissions in Marshmallow
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now