A .net disassembler/decompiler [closed] - c#

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.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I am looking for a disassembler or better, a decompiler for .net. The situation is that the source code for an assembly written by one of my predecessors is lost and I'd like to take a look to see what it's doing.
I know that ildasm comes with the Visual Studio installation so I can get at the MSIL, but I was hoping there was a program clever enough to work back to the C# code (or best approximation).
Are there any tools for this out there?
(If not, I suppose it'll be a good excuse for me to sit down and start to learn MSIL)

Now that Red Gate have started charging for the .NET Reflector tool you might want to check out these free alternatives instead...
Telerik JustDecompile
JetBrains dotPeek
(Open Source) ILSpy

Have you looked at Reflector?
http://www.red-gate.com/products/reflector/

Reflector is the way to go, but if you can't use that for some reason, Microsoft ships a disassembler called ILDasm with the framework.
A good source for MSIL knowledge is the book Expert .NET 2.0 IL Assembler by Serge Lidin.

.NET Reflector is the usual tool for this.

Reflector.

Ok,
I tried on a project.
ILSpy
Telerik JustDecompile
.NET Reflector Demo
All can create Visual C# project.
The generated code did not compile for JustDecompile and Reflector.
In one case, ILSpy made a code that compiled (just references had to be set)
The mistakes IlSpy did not look as compiicated as one found in others.
All generated code can be fixed if one know C# well enough.
An interesting direction can be used to decompile code using both JustDecompile and Ilspy and merge the codes that are correct because these decompilers (and third as well) seem to make different mistakes.

Related

What is a good way to maintain common code between C# and Objective-C? [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 9 years ago.
I'm currently in the process of prototyping a few small apps, intended for release on Mac and Windows. Naturally this means Cocoa with Objective-C on the Mac and .NET with C# on Windows. Unfortunately, since these two languages are quite different, working on 4 apps is more like working on 8 since I have to do everything twice.
To some degree this is unavoidable, but I'm exploring ways to share some of the common code/functions that deal with platform independent stuff (calculations, formulas, etc.).
I considered C/C++, but since it needs to be compiled into a DLL for use in C# it doesn't seem worth it.
Now I'm looking at using a scripting language like Lua, which is showing some promise, but it's not without it's share of complications as well. Are there other ways that might be better?
One way is to use Mono, a cross platform open-source development framework.
http://www.mono-project.com
You can use C/C++ as a DLL, for C#.
It's very easy to consume a C Dll from C# using .NET interoperability and marshaling.
In fact, this was my preferred solution when developing for iPhone and WinPhone....
More about calling C Dll from C#, read MSDN, and this simple example:
http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.aspx
Technically, you can write "managed C++ assemblies" for use in .NET applications, and you can mix C++ directly into Objective-C apps, but the syntax required to reference .NET Objects (myclass^) is different enough that you'd still end up not sharing very much.

Smart refactoring using Roslyn CTP [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 9 years ago.
I'm running some analysis tools on our build like StyleCop/FXCop.
What i'd like to achieve is auto-correct some of the warnings produced by these.
Do you think this can be done using the Roslyn CTP? is there any other tool that allows:
Scanning my code text for some rule not being followed.
Replacing this with the correct code.
Some of the operations can be done using a simple text replace of the VS editor, but more complicated things require use of some other tool.
So my question is - to this end, is the Roslyn CTP the tool to use? or what other tools exist for .NET for doing this?
This is certainly one of the scenarios that Roslyn addresses. Take a look at this walkthrough that demonstrates how to write a "Quick Fix" using Roslyn. In fact, the CTP also ships with a couple of samples that demonstrate how one could write stylecop / fxcop style rules using Roslyn.
You can also glance through this document for an overview of the overall scope of the CTP.
Disclaimer: I work for Microsoft on the Roslyn team.
OP asks, "what other tools exist for .NET for doing this?"
Our DMS Software Reengineering Toolkit is a source-to-source program transformation tool.
DMS can parse, analyze, and transform source codes for many computer languages such as C++, Java, COBOL, and particularly including C#. It can also handle multiple languages simultaneously.

The simplest code hacking [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 have the following code:
#include <iostream>
#include <string>
void main()
{
std::string str;
std::cin>>str;
if(str == "TheCorrectSerialNumber")
std::cout<<"Hello world!!!"<<std::endl;
}
I need a decompilation or disassemblering tool which can help me by doing below listed steps find the "TheCorrectSerialNumber". So the steps are:
decompile or diassembler the executable of my code
run the exe and type not the Correct Serial but something like “AAA”
find my “AAA” with what string is being compared and finally find out the "TheCorrectSerialNumber".
Please provide me also with directions how your suggested tool is doing above listed steps.
Thanks a lot!!!
NOTE: For those who tend to think that I want to crack someone’s code! First look ant my questions that I've asked just before and just after this question. I am a programmer and I need to concern about my codes security. Thus I have decided to crack my codes and to do some exercises on the other codes (on the sites that teach cracking there are a bunch of softs that are designed to be cracked) to understand how to deliver a secure code. If you know how people do cracking you probably will create more secure code that someone who doesn't know. And if you what to study how to crack you have to try. That is my point!
Depending on what platform you are on, you can use GDB (Gnu debugger) or IDA Pro.
I don't have much experience in reverse engineering on Windows, however Lena's tutorials are probably the best place to start in regards to reversing basic binaries. It'll run you through the basics of analyzing binaries at the assembly level and patching them. I believe it primarily makes use of ollydbg
Either you're doing something unethical or you're not. Either way you need something called a debugger and there will be one for your platform.
A debugger is a tool designed to help debug programs by attaching to a running piece of code and letting you examine it's state while running. Essentially you can view the state of the code (what's running where when etc) and state if the data. After all its all just a program counter and some memory, with a few registers thrown in to make life easy.
It is very easy to do with disassembling.
You need HIEW and W32DASM tools or OllyDbg (for example).
Just look at some examples of using this tools in youtube (cracking).
www.wasm.ru
www.cracklab.ru
Very helpful sites!!!!
Dude .. for something as trivial as this, just open it up in notepad, you'll find your "TheCorrectSerialNumber" .. probably right next to "Hello World!!!".
gray hat python http://nostarch.com/images/ghpython_cov.png
Let's assume you're not doing something illegal.
I can recommend the gray hat book for reverse engineering especially if you're already fluent with python.

What are some of the best-written open-source projects you have seen? [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.
What are some of the open source projects out there that you would hold up as shining examples of projects that correctly and effectively use enterprise sofware patterns and best practices such as Inversion of Control, Model-View-Controller, Unit Testing, etc.?
For purposes of this question the project should:
Include source code that illustrates the pattern in use, and
Be doing something important and useful, i.e. not using the pattern frivolously just because it is flavor of the week. Hence the words, "Correctly and Effectively" in the question
It should be software that you could show to the people who work for you and enthusiastically be able to say, "I want you to do it the way these guys did it."
Most of the GNU project is very very well written, over a very long period of time, with strict guidelines.
Prism is very good for MVVM in WPF and Silverlight
patterns they use Patterns in the Composite Application Library
An objective pick would be the Spring Batch project.
How did I pick it? Judging from the technical debt as seen on the Nemo Sonar instance, Spring Batch has the lowest debt/line ratio for projects larger than 10k lines of code.
When I first looked at the source code for DotNetBlogEngine, I was impressed at how well it was organized. And it didnt couple any of its components to the interface, making it extremely flexible.
It's not a terribly huge project either, not like trying to recompile your own linux kernal or something. So you can dive in quickly and have some fun with it.
Castle project
You can try this book - Beautiful Code
The author has collected some experience-sharing articles of open source projects. e.g. Python's Dictionary Implementation, Subversion's Delta Editor, etc.
You mean Spring? Or projects that use it?
UPDATE: WebWork, Guice, and Spring Security all fit the mold.

How can I use VIM to do .Net Development [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.
Visual Studio is the defacto editor, but what are our other options that avoid a heavy UI while still integrating with a C# build chain?
Looking for options which preferably use vi or vim directly, and those which emulate some or all of the functionality of vi and/or vim.
Here is a guide on Vim C# compiling.
In response to the comments -
It sounds like your goal is to have a fully functional IDE that works cross platform for C# development, not necessarily to use VIM. If that's the case, you can use MonoDevelop on all platforms (including Windows, but that's a bit trickier), and since you're probably already using the mono compilers on your other platforms, this might be a nicer option.
I'm not connected with the company in any way, but I've heard very good things about ViEmu. If the price were a little lower, I'd get it myself, because I love the editing power of Vim.
Right now there's now something called OpenIDENet from ContinuousTests https://github.com/continuoustests/OpenIDE
This along with AutoTestNet and EditorEngine provide a seamless Test Driven Development tooling for VIM.
EditorEngine gives AutoTest capabilities & commandline interactions to VIM ( ie. adding references, new projects to a solution etc. )
AutoTest does the heavy lifting by compiling on save; as it watches a directory. It also feeds back when tests fail.
The main page provides a video demonstration & howto for this tooling.
Also on windows NuGet is now available to be used from the commandline too.
I must point out that I do not work for continuoustests or get any money or favor from them, it's just that they produce awesome software for developing with.
MSBuild is a very powerful analog to Ant.
Use msbuild project files to manage your .NET projects, and write a nmake file that calls msbuild.
Map your vi make command to nmake
You can just use :make to do a build
If you are on the latest versions of VS, then the solution files can be built with MSBuild, which is basically a NAnt equivalent.
Otherwise, call csc to compile the files yourself.
I use nant as a build file (very simple and flexible) then call
:set makerpg=nant\ compile.all
Then whenever you wan't to compile just type :mak
This can be extended with custom error formats etc.

Categories