Decompile a Fortran .dll file - fortran

I'm working with TRNSYS which uses Fortran for programming (which I don't really know a lot about).
I had a file (.f90) with my code, now it's empty. It is compiled in a .dll file.
Is there a way to decompile it, so that I can roughly see, what I had coded? It does not need to restore the file, so I can run it. I just kind of need to know, what's in it. It is not that much code, but I can't remember everything. I have a backup from beginning of Dec., which has the main structure but is obviously not the latest version.
I'd be glad for any help, thanks in advance
Jan
I have tried using Reko Decompiler, but I can't really make sense of the output.

Related

writing out binary files using xcode

I'm using xcode 6 to code up a C++ file-based array list (vector) for my Data abstractions course. This, of course, requires writing out binary files. I'm using the C-library functions (fopen, fclose,fread,fwrite,fseek, etc.) since I like those more than the C++ functions. I'm having no issues with my code per se. Everything's working fine, but the issue comes when I execute.
Xcode will "run" everything, but it won't give me out a binary file. I think this has something to do with xcode itself not writing out these files since, all in all, it's a pretty costly thing to do. I can do it through the terminal using g++ but it would be a lot easier if I could do it through the xcode compiler so I'm not having to switch to a terminal window every time to test my code. Let me know if you need any clarification and thanks so much in advance.
The issue might be your working directory not being set correctly inside Xcode.
The file is probably getting written, just not to the right place (or the place you expect it).

How to recover cpp data from linux library files?

I accidentally deleted a .cpp file with some valuable code of mine.
It was part of my own library: libandrissh.so
How can I recover it? I tried scalpel, but it did not find it.
I was wondering if I could somehow extract the info from my .so or .o other files that are in my library. I think this could be possible, because my programs using the library still work.
any suggestions?
thanks guys
If it's deleted and not in a recycle or trash bin you can't recover it easily from the compiled binaries. There are disassemblers to get you that far but I have not yet seen any decompilers that are production ready that can get you back to original sources. Even if they could it likely won't be able to recover the original symbol/variable names anyway.
Your best bet would be to look at something like PhotoRec to search the free sectors on your hard disk. Despite its name, it actually finds many different file formats including video, music, documents, text and even C source files. As long as your files haven't been overwritten, you will likely be able to find it. I used it to recover a lot of data from my wife's hard drive when her filesystem became corrupt. Also, it's free under the GPL.
if you have the library binary, you can of course disassemble it (use e.g. objdump --disassemble libandrissh.so), but going from the "bare" machine code back to a higher-level language like C++ is not easy. I'm not aware of any standard tools to do that.
You can try some disassembler like IDAPro
Depending on the compiler used, the flags and everything else you might get decent results.

Changing parts of compiled binaries

learned english as a second lang, sorry for the mistakes & awkwardness
I have given a peculiar project to work on. The company has lost the source code for the app, and I have to make changes to it. Now, reverse engineering the whole thing is impossible for one man, its just too huge, however patching individual functions would be feasible, since the changes are not that monumental.
So, one possible solution would be compiling C code and somehow -after rewriting addresses- patching it into the actual binary, ideally, replacing the code the CALL instruction jumps to, or inserting a JMP to my code.
Is there any way to accomplish this using MingW32? If it is, can you provide a simple example? I'm also interested in books which could help me accomplishing the task.
Thanks for your help
I use OllyDBG for this kind of things. It allows you to see the disassembly and debug it, you can place breakpoints etc, and you can also edit the binary. So, you could edit the PE header of that program adding a code section with your (compiled) code inside, then call it from the original program.
I can't give you any advice since I've never tried, although I thought about it many times. You know, lazyness.. :)
I would disassemble the program with a high-quality disassembler that produces something that can be assembled back into a runnable app, and then replace the parts you need to modify with C code.
Something like this will let you reverse the machine code into source. It won't be pretty but it does work.
http://www.hex-rays.com/idapro/
There are also tools for runtime patching http://www.dyninst.org/ for instance. They really aren't made for patching but they can do the trick.
And of course the last choice is to just use an assembler and write machine code :)

Is there a decompiler that will work on Visual Studio 6 C++

I have a project that I am trying to fix from a guy that left (let go) from my company. He has violated every fundamental principle of software engineering, not using source control, not backing up the source before you make more changes, etc. etc.
I need to make changes to an application that is in the field and I don't have the original source code, but I have an executable. What I need is a decompiler that will decompile a Visual Studio 6 C++ application and provide me with some type of source code. Anyone got any ideas.....
Well there's the Decompiler from Hex-Rays: https://www.hex-rays.com/products/decompiler/
It is pretty good for the fact that it is creating C code from Assembler but it works pretty good. It's also pretty expensive
Edit: Additional note it is combined with IDA Pro the pretty well-known disassembler from them. That already can show you a lot of information in the combination with the decompiler it is even easier to reverse code.
I've used RecStudio (rec22) and IDAPro to try and decompile a C++ project, together they probably wouldn't have been enough to do the job I had except that I worked out the demo project the program was based on so they gave just enough info that I could make something like the same project again.
In the end one other thing I was doing was compiling code that I thought matched and checking that I got the same result in the decompiler.
Good Luck.
Decompile to what - assembler?
There isn't anything that is going to give you meaningfull C from an exe.

Compile/use unrar C++ source for iphone app?

Writing an app that will include the ability to decompress zip and rar files. I think I'm OK on how to handle the .zips but .rars seem a little more trouble. I noticed that rarlabs has source available but it's C++. Is there a way to compile, wrap or otherwise use this code within an iPhone app?
Reference: http://www.rarlab.com/rar_add.htm
Open to alternate suggestions on how to handle .rar files as well.
I'm still pretty much a newbie so please explain in small words :)
If all you need is to decompress RAR files, this library may be much easier for you to compile since it's a single C source file:
http://www.unrarlib.org/features.html
I had looked at compiling the library you mentioned, but there were a lot of errors and it was not initially apparent just how to resolve some of them (file type was not the issue).
Objective-C++ allows you to drop C++ code unaltered into an Obj-C source file (and give it a .mm extension). It really is that simple - I didn't believe my eyes the first time I did that, but it was super easy.
You can even mix C++/Obj-C types. See this project for a good example (it's a pretty small library, so it's pretty easy to navigate and see how they structured it): simple-iphone-image-processing. See the Image class in particular.