Load Assembly Sources into IDA - reverse-engineering

I have a large codebase written in assembly that I need to maintain.
Exploring the existing code is tough with text editor's syntax highlighting being the only helping tool.
I was considering to use IDA tool to assist with this task. It has many nice features for exploring assembly code. So I downloaded the free 5.0 version for evaluation.
Unfortunately, I am unable to locate an option that provide the ability to open an assembly source file. All the "open" options do is to dissasmble binaries, but this is useless to me as I already have the source code inclding all the comments and human readable symbols.
It is hard to believe that a tool with so many features lacks this basic capability. So what am I missing here?

IDA, as stated at its website, is a Disassembler. It was developed to find out what a program does WITHOUT the assistance of the source code, not the other way around. Why should anyone try to employ the complex and time-consuming techniques available in IDA to discover what a binary does if all they have to do is take a peek at the original code?
IDA is NOT a development tool, it is a reverse-engineering tool. You should look for an Assembly IDE for the task you seek to complete. Maybe RadASM provides what you are looking for.

Related

Converting .exe to VS solution file / project

I've recently had an issue at work where I have lost my solution files to my projects, but I still have the executables that have been produced by the projects / solution. It has been collection of 50+ webforms.
I have tried some de-compiler tools like ILSpy, JustComplie and .Net Reflector but everything gives source code in different format (not originally written by me) and also not designs of forms.
Is there any possibility to decompiling the executable back into a solution/project file?
I don't think that you can actually decompile the executables to a solution structure as seen on VS.
Although you can decompile the executable files (there are decompilers on the net that can perofrm the operation for you - only the decompilation),
you need to re-create the solution manually and add the source files you have retrieved from the previous operation.
Furthermore, if your files were obfuscated this makes it harder for them to be decompiled.
Even if this works, be prepared to do some debugging and check references/dependencies.
There is a Decompiler that works very well for .Net applications called DNSpy.
Here is link to the Project :
https://github.com/0xd4d/dnSpy
After you have decompiled you can start debugging and such from this application.
Hope this help.

How to identify the Programming Language used to Develop a Software? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Find Programming Language Used
So, I have an application consisting of an executable (exe) file and a DLL. Is there a way I can find out the specific language used to develop this software. I tried opening it in a disassembler but the contents seems garbled. Any ideas?
In principle, the answer is no. In practice, however, there are only a few choices:
If the .dll name looks like something.dll, it's probably a native dll image, which means it was probably written in C or C++.
If the dll name looks like Namespace.Something.dll, it's probably a managed dll, which means it was written in some .NET language (C#, VB.NET, etc.)
You can check the dll imports for more information. If the dll uses mscoree.dll then it's a .NET dll (even if it doesn't follow standard .NET naming conventions). It may also use other language-specific dlls that provide additional clues.
Open the .dll or .exe in a hex editor and search for the word "copyright". Most compilers put the copyright message of the runtime library into the executable in clear text.
Get IDA pro. http://www.hex-rays.com/idapro/ That is the tool to work with binaries or do reverse engineering. It will be able to find out the runtime library and maybe also the language.
Evaulation and freeware versions of the tool can be found here: https://www.hex-rays.com/products/ida/support/download.shtml
Unlikely, unless it has a significant runtime library that gives it away. e.g. VB apps used to require a huge DLL with VB in the name, Visual C++ apps usually require the C++ runtime to be installed. But modern languages target language-independent runtimes. Even Java .class files may have come from a wide variety of source languages.

If project is open source do you bother looking at the sources? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I was pretty surprised to find out that raw sources of my little open source project are getting downloaded more often than the compiled and ready to use library (jar file in this case, platform independent). I wonder what are the reasons behind that? Lack of trust? Curiosity? Compiling with custom settings? Attaching sources for debugging?
Personally I usually don't bother downloading and looking at sources unless something is not working or I don't understand how it works.
I often download sources just to see how other people have implemented certain things. Reading (and understanding) other peoples source code is a good way of becoming a better programmer yourself.
As for the relatively high number of downloads, perhaps your library is included in other projects like a Linux distributions? Such projects usually download and build from source themselves so that they can properly package it.
The first reason would be for customizing applications.
Also its not a good practice to download some code and use it straight away without looking at how the code works. There will be something for you to learn from the code.
Also you might not need the whole functionality of the project. If the project is too big and you need to use only some functionality in it it would be a great idea to trim the project to your needs and then use it.
For every piece of software of long term interest for my company, I look at the sources to assess the quality. The rationale behind it is that badly written software is usually also bad to use and maintain and thus a business risk in the long term.
Even with most commercial software like ERP systems it is no problem to get a look at the source. Only for COTS (say MS Office) it is hard to get the source.
I also check source for every hiring decision.
An other reason why you see so many source downloads might be automated build systems like FreeBSD Ports which download and compile automatically.
I look at the source just to learn how the program works.
As silly as it might seems, the open source software ( such as open source CRMs) is notorious for the lack of documentation. The only way to find out how it works is to experiment with it. When even experiment fails, it's the time to fire up your IDE and read the source!!
Maybe the answer will be disappointing, but the relatively high number of source downloads could mean that the application is packaged in a port-based distribution like Gentoo, FreeBSD or MacPorts where every package is downloaded and compiled on a local machine during installation.
If it's a framework, I always download sources. I use them for debugging and to see how they've implemented certain things. If it's a standalone application, I generally don't look at the source unless there is a problem or the application does something unique.
As you say your binary is a jar, it sounds like it is a Java-library (rather than an application). Developers often use source: to include it in the IDE to debug in the library and lookup certain functions. Also many developers include the sources in their build-process to compile also the dependencies. That may be an explanation.
The number one reason is compiler settings. You can't imagine the amount of pain caused by linking a static library compiled with some incompatible settings. Compiling on your own with checked settings simplifies life greatly. Plus when you decide to change the compiler for the better one you don't need to have the old static library - it will be compiled by the new compiler two.
The number two reason could be that people want to see how some things work inside. For example, they want the same or similar functionality in their commercial closed-source project and can't just borrow code because of the viral license. However they can see how it works and get inspired - that't why they download the source and read.
I have downloaded libraries and compiled them my self but I have not actually looked at the code. When I use a library it is good to know that I can make changes and have the source on hand. I have on occasion taken just a file or two if it is a massive library and I only need a single functionality from a large library.
Some reasons could be:
Distrust of binary downloads due to trojans, etc
Taking a look at how you've implemented something
Checking out the quality of your code :)
Since this is a library, the need for comprehensive documentation is much higher than for a standalone app. I often find myself looking up the code of a library to figure out certain things sometimes left out of the docs, e.g. time/space complexity of certain functions.
We use some open source packages for our commercial application. I always download and build from source.
If our hosting platform changes in
the future, it might change to
something that does not have a
precompiled binary. I want to be
able to use the same package/version
on the new platform.
If the package goes dormant or
becomes unsupported, I want to be
able to apply a change or fix if
absolutely necessary.
If something is going wrong on the
server (memory leak, CPU spike,
etc.), I want to be able to add
logging or instrumentation code to
identify or eliminate the package as
the source of the problem.
I can of course only answer for myself, but it is not seldom that i download the binaries (assuming I trust the project which is usually the case), and the when I debug I download the sources. But I have a tendency to delete the sources when I think I'm done with them and since you are never really done I might have to redownload the sources later and thus causing the source downloads to be higher.

Is there a free Help Authoring tool available for Eclipse?

I need to write on-line help (Eclipse help format) for an Eclipse plugin. I tried out the evaluation of Help Composer that comes as part of RCP Developer from Instantiations and it pretty much does what I am looking for. However at $500 per license it's way overkill and over budget for my needs.
Surely there must be some other tool for managing the help project, assembling the various files, table of contents, and editing the html documents using WYSIWYG.
Does anybody have any suggestions for what plugin(s) I should add to a basic Eclipse 3.5 install to give me full authoring capability?
Thanks in advance!
I know that my solution is not entirely what you need, but you should have a look at Mylyn Wikitext .
It uses a simple markup with good editor support and is also capable of exporting to Eclipse Help format.
I gave up looking for free since all the available tools have a lot of shortcomings.
I decided to use Adobe RoboHelp 8 since it has one of the nicest editors that I found. However, the main benefit for me has been that it automatically updates links in all pages if I rename or move a topic (which I do a lot).
When I want to generate the Eclipse Help file, I use the script that they provide.
For a large documentation project, we used Latex in combination with plastex. This allowed us to generate PDF, Eclipse Help and HTML from the same sources. Cross Referencing, which seems like an issue for some readers, is handled, as well as indexing and other cool stuff. Getting it to work was a bit tedious, but it was a good solution, as the documentation contained a lot of formulas.
This was an open source project, so everything is available - feel free to use and adapt as you see fit:
Result (HTML, PDF, Eclipse Help: http://handbook.event-b.org/
Code: https://sourceforge.net/p/rodin-b-sharp/svn/HEAD/tree/trunk/Handbook/
I don't think it exists in eclipse, but try the MS one (free):
Here is the info: http://msdn.microsoft.com/en-us/library/ms670169(VS.85).aspx
Here is the download: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc
Then you can convert to eclipse format: http://home.amnet.net.au/~ghannington/hh2e/hh2e-readme.html

When do you use an IDE? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I know that some people swear against using a language-specific IDE ever (vim/emacs or die! type stuff) and that some people are really uncomfortable with coding/compiling in the terminal at all, so my question has the following parts.
When do you switch from one to the other
Is it even necessary to know both? If not, which should you know?
Lightweight or Heavyweight IDEs? (just code highlighting or every feature you could imagine)
What IDE do you recommend in general, and why?
Feel free to answer all, some, or none.
Short summary so far:
IDEs
Big Projects
GUIs
Easy Version Control Integration?
Text Editors
Quick/Small projects
Adapts to other languages more easily
Less overhead
IDE usage is very subjective to personal opinion. With that disclaimer, here's mine.
Know your tools and know your platforms. Developing software is your domain, so be good at it.
When do you switch? When your knowledge tells your intuition that it would be easier with the other tool.
Should you know both? I would argue that you should know everything about working with your platform. Low level knowledge makes higher level applications easier to understand.
Lightweight or heavyweight depends on the task at hand. Both are appropriate at times.
I can't recommend any one IDE, it depends on your application's platform(s) and what you, the developer, are comfortable with. If you're doing .NET, Visual Studio on Windows is probably the best, but that doesn't mean you can throw out Notepad. For Java on Linux, Eclipse is great, but don't discard vim.
Hey, Front Page is probably the right tool for the job to some people (ouch, yes, I said it. /me ducks).
As several other people have said, which IDE you use or if you use one at all is heavily dependent on the language your developing in, the scale of the project, and the platform your working on. Although I've never encamped with either the Vi or Emacs guys I do use a number of other editing tools in roughly this language breakdown:
C#, or anything else .Net: Visual Studio. There is no serious competition, the CLR languages beg for syntax highlighting, refactoring, and advanced file management. Thankfully Microsoft got this one right and the Express editions are an incredible value.
C++: I haven't touched it in a while, but I would typically view the code in Visual Studio, but compile through batch files, which had a lot to do with the eccentricities of the particular embedded platform I was working on.
Python: I recommend Stani's Python Editor if you need something with bells and whistles, but Python is so direct in its structure that I usually end up just using Scite. It does everything you really need in a Python editor.
SQL: Notepad++ or, if your doing heavy lifting, any supported editor + SQL Prompt.
Java: I hear good things about Eclipse, but Java is evil so I don't touch it.
PHP, Perl, Javascript, BASH, or most other languages: Notepad++ on Windows, Scite on Linux.
Although switching between all these IDEs can be troublesome, especially when a feature you love in one is missing from another, the benefits are to be found in using the best balanced tool for the job your doing. I switch IDEs all the time as my needs vary and I would encourage others to as well. Having worked on a limited number of projects, of limited scale, on particular platforms I hardly know all the use cases and I'm sure there are plenty of other situations and code editors out there that pair up in unique and wonderfully functional ways.
Personally, I almost never use an IDE. I use vim/make almost exclusively. There's lots of benefits to this:
Totally language agnostic. Once some commands and shortcuts are memorized, they work with all of my projects
Parts are easy to swap in and out. If I want to switch compilers, I change the variable in my makefile.
"configuration agnostic". No matter how the settings are, I can develop. No GUI? No problem. Different desktop environments? No problem. There are even ports of vim to Windows. I develop on my local machine and when I'm ssh-ed into a server in the same manner.
There are also some downsides:
Vim is hard to learn. I'm not even going to lie about this. It takes time to acquire some power.
Mostly limited to *NIX. Yeah, there are things like cygwin. Yeah, there are ports of Vim to Windows. It's somehow not exactly the same.
It's possible that if I learned an IDE that focused on a specific language, it'd have some features that would be pretty powerful for that language.
I usually use the IDE only for debugging (which IDE depends on the language/platform), and use my personal editor for the actual editing of code.
I feel that using one editor for everything is a much better approach than relearning key-bindings for every language/platform change I make.
In my experience, if the project involves building a GUI, an IDE is an invaluable tool.
If it's small, "gut-level", or a web service, I'd go exclusively text editor.
My rule of thumb is that if the language and IDE are tied together, then use the IDE (see anything using MS project files). Otherwise any editor will do. Personally I like visual Slickedit, or notepad++ if the company isn't going to shell out for slickedit. On the linux side I use Emacs, which you can consider a heavyweight editor, or a lightweight OS.
While I use VIM and non-IDE type tools, I have to admit that Visual Studio (especially 2005/2008) is possibly one of the best programs ever written. The intelli-sense and debugging tools are well worth there weight in gold. I find myself being able to write code very fast. It is especially helpful in cases where you are utilizing frameworks (e.g. .NET) and need that little extra guide to tell you what functions are available off an object without having to refer to the help documentation. It is hard to beat auto-code formatting, bookmarking, immersive debugging, refactoring, source control integration, and plug-in support.
For everything else, I use VIM. I have to admit I'm still learning how to use VIM well, but I already know it is powerful. It truly is a matter of choosing the right tool for the job.
EDIT: One thing I will mention is that you pick a tool or two and learn it very well. Become an expert at it. Learn the ins/outs and explore the nitty gritty secret stuff your editor/IDE can do. The more you do this, it will matter less what the tool is.
For me the break-down is by technology.
I use Notepad++ or vim for anything in the LAMP stack - I've never found anything particularly useful in the IDEs for those technologies (unless you could the MySQL Client Tools as an IDE, which I use when I am able to).
When working in the WISC (Windows, IIS, SQL Server, C#) stack, on the other hand, I use an IDE - one of the Visual Studio products depending on which project I'm working on.
A lot of this probably has to do with the sorts of projects I work on. I work in PHP in the LAMP stack, so I don't have to handle bunches of external libraries the way I probably would if I was using perl, and the projects I develop on LAMP are usually simpler than my Windows development. In .Net, on the other hand, navigating the libraries can be quite difficult without the IDE, and the debugging can (I find) be more complicated. Plus when developing web services using SOAP, I wouldn't even want to think about doing it without the tools Microsoft supplies.
I find that IDEs for C and Python don't buy you much, at least the ones that are available for Linux. So, when I write C and Python code, I will usually use GVIM + Ctags + standalone debugger + make.
However, in the case of Java, Eclipse offers a Java programmer so much that it's hard not use it and after a while become spoiled to the extent that it's just too painful to go back to writing Java code in VIM.
Strangely enough, I haven't had the same experience when using Visual Studio for C projects (even though I do find its debugger indispensable). One reason for this is that I prefer to manage the build scripts myself. Even with Eclipse, I would still use ant so that I know exactly what is happening during each build. Admittedly, you can of course look at the build configurations in both Visual Studio and Eclipse, but this just isn't as direct as seeing the exact command used. That being said, I'm still forced to use Visual Studio for builds mainly because of convention, as there other people working on these projects, but I will still edit the code in GVIM (with the help of ctags).
The ONLY time when you have to do compile/link using the commandline is when you work on a pure Linux server with no GUI installed - in this case your ONLY REAL OPTION is emacs. (Using anything else is pure masochism).
At all other times it would be sheer stupidity not to use a mature IDE.
Your Questions:
When do you switch from one to the other
(answered above)
Is it even necessary to know both? If not, which should you know?
That will depend on how keen you are on being a programmer AS WELL AS a systems administrator. The latter is called upon to support the former and to implement whatever is necessary to keep all systems running smoothly. To know both can NEVER be harmful, but if you insist on being a programmer only, then the necessity of knowing a specific IDE for the platform you choose is obvious.
Lightweight or Heavyweight IDEs? (just code highlighting or every feature you could imagine)
I assume the choice here refer to programmer only: there is no doubt that the more assistence your programming tool/environment can give you, and the more support you can get that allows you to focus on implementing your program spec. the better. So YES: HEAVYWEIGHT is the only sensible choice.
What IDE do you recommend in general, and why?
On a Windows platform this question is moot: whatever Mictrosoft recommends (and if you have the $$$). On Linux you have several choices: GTK-based (Gnome & company), QT-based (KDE & company), (if you're a sucker for punishment you can go for pure X and then you are more-or-less in for an interesting time) both Gnome and KDE have IDE's you can use. Third party IDE's, like eclipse, are available; they all enable you to develop GUI-applications that will run in whatever the user chooses as his GUI-environment. Some of these IDE's even allows a multiplicity of programming languages (that is the glory of Linux and FOSS: you have choices; you are not pinned to the "geography", not led to the slaughter, ...).
My personal choice of IDE (C++ only) is Ultimate++. It is source compatible with both Windows and Linux. The IDE is approaching a rich maturity AND it offers 'everything-plus' that other C++-IDE's are aspiring to. (I know this is a plug, but I've got good reason: give it a try.)
HTH
I've done both, but the debugger is really a great tool to have.
You can get pretty far just adding debug output and rebuilding, and that even forces you to use your noodle and the scientific method a bit more, but in the end (imo) the debugger just cannot be denied... it lets you really get in there and explore the system during runtime.
There are opportunities for both specialization and generality. In my own work, I've found that flexibility and being able to ride a steep learning curve has paid off well.
I use an IDE whenever I'm using a language that's more suited to being written by a computer than by a human being, for example Java. It's far too verbose to write by hand without loads of auto-completion. Vim's auto-complete is never quite as good as a language-specific IDE.
For less wordy languages though, you can't beat a good Vim- or Emacs-like editor for churning out plaintext quickly.
If the project exceeds two or three source files, I tend to use an IDE.
Once you've used an IDE with good (vs6 was not good, and most generic text editor's support for this is crude at best) intellisense-style prompting and auto-complete for a few weeks, you won't go back.
I use vim for everything except Objective-C stuff, which I use xCode for. The Interface builder, error checking, debugging are quite valuable.
However, I use a InputManager to let me use vim commands/key bindings in xCode, so I never really leave vim for anything ;)
I do all my coding in SciTE, my favorite editor, lightweight, with good syntax highlighting, and with shortcuts I am familiar with (or which I coded!).
Now, doing lot of Java at work, I also use Eclipse, which greatly improve with each version. I appreciate it is quite customizable, and very flexible about coding help, but I still do most of my editing in SciTE... Fortunately, the auto-detection/update of files edited elsewhere works quite well in Eclipse (although sometime with a sensible delay to analyze the reloaded class: we have big projects and not that much memory (1GB)).
I appreciate Eclipse mainly for two things (we compile with a special ant process and we don't really do refactoring): quick navigation in the project, particularly find a class and call hierarchy, and of course debugging.
I don't think these are so much distinct worlds, these are just tools, quite complementary: I won't fire Eclipse to do a quick edit of a small HTML file, I can't debug in SciTE. So I use both.
I haven't used an IDE since the last time I created a native GUI app, lo those many years ago. And, even then, I pretty much just used the IDE to create the GUI forms and my own editor for the actual code once I figured out how to plug an alternate editor into the IDE.
I'm not a "give me vim, or give me death!" fanatic, but my experience with having used IDEs and having used a bunch of xterms running vim has left me with the impression that the only thing IDEs really contribute, for me, is drag-n-drop form editing, which is something I don't need, given how long it's been since I last did anything with a non-web-based GUI.
re: when? I use Eclipse for Java and debugging. I keep jEdit open with a variety of Groovy scripts available. I also use Cygwin's bash in 3 shell windows for executing Ant tasks, searching etc. I can use Bash aliases for some truly powerful stuff with respect to running our server and client.
re: both? Yes, it is vital to know both IDE and non-IDE development. It doesn't matter which IDE but a debugger is essential.
re: which? For Java, Eclipse if you are paying (free) and Idea if someone else is ;-) Actually, I prefer Eclipse but I think that Idea has better support for Groovy so that it is attractive to me.
A decent code highlighting editor is all I use.
I use IDE for debugging, or for every big project that require to go on many different file. Lot of IDE have quick click to move from one class to an other. IDE for that is more productive. I use IDE too when I use big FrameWork that has a lot of folder and file, more easy to manage.
Update because question has been updated
When do you switch from one to the other?
I switch for small change in CSS or other small task,
Is it even necessary to know both? If not, which should you know?
Some time when building form (example in C#) it's very much profitable to use the IDE. Samething for debugging with breakpoint. I think both are required.
Lightweight or Heavyweight IDEs? (just code highlighting or every feature you could imagine)
Code hightlight is fine for small job, but when you have big stuff to do, bigger IDE with autocomplete, real-time error check and other refactoring tool is necessary to be more productive.
What IDE do you recommend in general, and why?
Visual Studio is great for .net, Eclipse for Java.