Extract records from compiled search program, C - c

Does anybody have an idea on how to extract all information from a compiled, record search program?
I think the program works by using a binary search. It was compiled and the database was in the program. The only way to see the records is to make a correct search.
Is there some way that I can bruteforce the program and extract all information?
The record is searched by the ID which starts with 1 and 10 digit long [ 1xxxxxxxxx ].
If you want to try, 1112700303 will work but I don't have the other numbers.
I've tried some Decompiler but I have no idea what I'm doing.
The program can be downloaded from here:
https://docs.google.com/file/d/0B9fwDRGBsrxBT3FiSFdaTnJZcUk/edit
Your help is appreciated as it will increase my knowledge and learn something new here :D

Though question. Is there no way to get hold of the source code (ask the author, search for the program name, ...)?
On Unix/Linux, the program strings extracts printable strings from a binary file. Doing that on x86 executables gives a long list of strings that are just instructions which happen to be ASCII strings, names of functions used by the program, ans other junk. Somewhere it lists initialized text data for the program (printf(3) formats, constant strings used), which in this case shows a bunch of names that look arabic, and some directory names. Perhaps searching for those could help.

This can probably be achieved by using Snowman. It might not get the exact source code you are looking for but enough to extract all the data you need such has the constant strings.

Related

Find duplicate files using C

I am attempting to write a C program that searches for duplicate files, groups the files, and then returns any files that are duplicates. The user can enter either a file path or specify files to check for using from the command line (argc). I am going to use stat() to traverse the system, and I know I need to use a hash table to bin the files. However, I am a bit lost on what to do to actually check if the files are repeats.
I know there are already programs that will do this for you, but this is an academic exercise that I need to complete. I am not looking for the coding answer, just a higher level answer on how I should go about solving the problem. Any feedback is appreciated, including any suggestions other than the ones I have listed above (again, I have to write this program from scratch).
Thanks.

ARM Assembly - Reading ".dat" extension / importing information

I am supposed to create a program with the ".dat" extension, but ARMSim# doesn't read the file. First off, how am I supposed to have it read my file?
Also, the program I am writing needs to let the user input a list of numbers and the output should be the first integer, second integer, total number of integers, total numbers that are not the first integer, and total numbers that are not the second integer.
On top of it, it needs to check for errors and have a readable output.
I am completely stuck and obviously don't know any ARM. I would like to learn it since I will be having future projects that I hopefully will be able to do on my own, so if you can describe any code that would be great. The whole week I have been trying to read websites on ARM and I still stare blankly at the screen when I try to code anything. Any help would be GREAT.

Read own source file and text file line number?

We have a assignment and the teacher doesn't go into depth with explaining things so I'm a bit confused since I haven't really done much programming before. We have to write a program that when it's done being executed it's able to read its source file and can make another text file which is the same as its source file but the text file has a line number. My problem is I don't understand how to begin it. Could someone give me an example how to get started and what steps to take? I'm not asking for someone to do the programming for me just give an example. Thanks in advance.
Roughly the steps you'll want to take are:
Read each line of the input text file
Prepend the line number to the beginning of each line.
Write your modified lines into a new text file.
There's a lot of good information on how to read/write to files here, and string concatenation (for how to prepend the line number) here. You may also want to look into for loops so that you can hit every line in the input file.
There are really two parts to your question: "Who am I?" (what file are you) and "Write a copy of myself with line numbers"
The part that you describe above is the first -- "Who am I?" and for that, something external to your source code has to provide the info because the language itself can reside in any file.
Often, there is information available about what's being compiled made available by the preprocessor (just like it sounds, it's something that is run before compiling your source code). In this case, "preprocessor macros" commonly give you this sort of environmental data.
Take a look at this link for GNU C: https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html to start researching what is available under what conditions. Your compiler, if not gcc, should have similar docs.

File handling and Graph ADT in C

I created a Thesaurus program in C.
In my program user can insert a word and the synonym for that.
Another function is searching for a word and then displays the synonyms for that word.
My question is how can I keep the words I have inserted and still retrieve them when I run the program again?
Is file handling a solution?
How will I do it?
You need to design a simple file format which could describe your data, then write code to write to that format, and code to read from that format and handle errors properly.
As a simple example, you could have a file which stored lines like:
happy:joyful
happy:exuberant
In this case you would also need to make sure that users can't enter blank lines or colons as word input, so that the syntax is unambiguous.
A program cannot reliably keep information in memory between runs*, so it has to store such information in a file. Files are designed to store information between runs of a program.
As to how you'll do it, that's your decision. Most likely, you'll choose a simple and readable format with, for example, the head word at the start of a line, followed by a colon, then a list of semi-colon separated synonyms:
head: skull; cranium; noggin; noodle
head: aptitude; faculty; talent; gift; capacity; ability; mind; brain
This is flexible and allows you to use phrases (even phrases containing commas) in the synonym lists. You can sort the data before you write it out for convenience when reading in, but it is generally best to validate that the data is still sorted when you read it back in (at the start of the next run) because someone may have hand-edited the file and not preserved sorted order.
* If the process uses System V shared memory IPC, then you could store the data in a shared memory segment that would exist between runs of the program. However, it is not a particularly sensible idea to try doing that. A file has better durability; it will (usually) survive reboots, and could be placed on a distributed file system whereas shared memory is restricted to a single machine.

read thunderbird address mab files content

I have several address list's on my TBIRD address book.
every time I need to edit an address that is contained in several lists, is a pain on the neck to find which list contains the address to be modified.
As a help tool I want to read the several files and just gave the user a list of which
xxx.MAB files includes the searched address on just one search.
having the produced list, the user can simply go to edit just the right address list's.
Will like to know a minimum about the format of mentioned MAB files, so I can OPEN + SEARCH for strings into the files.
thanks in advance
juan
PD have asked mozilla forum, but there are no plans from mozilla to consolidate the address on one master file and have the different list's just containing links to the master. There is one individual thinking to do that, but he has no idea when due to lack of resources,
on this forum there is a similar question mentioning MORK files, but my actual TBIRD looks like to have all addresses contained on MAB files
I am afraid there is no answer that will give you a proper solution for this question.
MORK is a textual database containing the files Address Book Data (.mab files) and Mail Folder Summaries (.msf files).
The format, written by David McCusker, is a mix of various numerical namespaces and is undocumented and seem to no longer be developed/maintained/supported. The only way you would be able to get the grips of it is to reverse engineer it parallel with looking at source code using this format.
However, there have been experienced people trying to write parsers for this file format without any success. According to Wikipedia former Netscape engineer Jamie Zawinski had this to say about the format:
...the single most brain-damaged file format that I have ever seen in
my nineteen year career
This page states the following:
In brief, let's count its (Mork's) sins:
Two different numerical namespaces that overlap.
It can't decide what kind of character-quoting syntax to use: Backslash? Hex encoding with dollar-sign?
C++ line comments are allowed sometimes, but sometimes // is just a pair of characters in a URL.
It goes to all this serious compression effort (two different string-interning hash tables) and then writes out Unicode strings
without using UTF-8: writes out the unpacked wchar_t characters!
Worse, it hex-encodes each wchar_t with a 3-byte encoding, meaning the file size will be 3x or 6x (depending on whether whchar_t is 2
bytes or 4 bytes.)
It masquerades as a "textual" file format when in fact it's just another binary-blob file, except that it represents all its magic
numbers in ASCII. It's not human-readable, it's not hand-editable, so
the only benefit there is to the fact that it uses short lines and
doesn't use binary characters is that it makes the file bigger. Oh
wait, my mistake, that isn't actually a benefit at all."
The frustration shines through here and it is obviously not a simple task.
Consequently there apparently exist no parsers outside Mozilla products that is actually able to parse this format.
I have reversed engineered complex file formats in the past and know it can be done with the patience and right amount of energy.
Sadly, this seem to be your only option as well. A good place to start would be to take a look at Thunderbird's source code.
I know this doesn't give you a straight-up solution but I think it is the only answer to the question considering the circumstances for this format.
And of course, you can always look into the extension API to see if that allows you to access the data you need in a more structured way than handling the file format directly.
Sample code which reads mork
Node.js: https://www.npmjs.com/package/mork-parser
Perl: http://metacpan.org/pod/Mozilla::Mork
Python: https://github.com/KevinGoodsell/mork-converter
More links: https://wiki.mozilla.org/Mork

Resources