|
-
November 14th, 2006, 08:11 PM
#1
convert asm to c
hi. i know u cant get the c or c++ source back from the program trough asm unless the source is compiled along.
however i do look for a program that converts asm to C or C++.
with olly dbg doesnt make much sense when you look at adress jumps instead of functions. especially when you havent made the program.
-
November 14th, 2006, 08:44 PM
#2
Re: convert asm to c
It is not possible. You should be able to find more details from a previous thread discussing on reverse engineering in CG.
quoted from C++ Coding Standards:
KISS (Keep It Simple Software):
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
Avoid magic number:
Programming isn't magic, so don't incant it.
-
November 14th, 2006, 08:53 PM
#3
Re: convert asm to c
maybe you dont read the forum im not talking about reverse engeneering.
the applicationmight as well be made with vb classis or c#
im talking about converting asm to c or C++
and that is possible, i will just look for my selvei or maybe make it myselve.
-
November 14th, 2006, 08:57 PM
#4
Re: convert asm to c
here it is...
http://boomerang.sourceforge.net/index.php
but.
This release is strictly for developers and experimenters, to get an idea of what Boomerang is about without having to download and compile a lot of code. Machine code decompilation, unlike Java/.NET decompilation, is still a very immature technology, so if you're hoping to decompile a large binary with this release you will be disappointed. Please read the documentation on the Boomerang web site.
-
November 14th, 2006, 08:59 PM
#5
Re: convert asm to c
i run the tool and it crashed...
-
November 14th, 2006, 09:04 PM
#6
Re: convert asm to c
maybe you dont read the forum im not talking about reverse engeneering.
Why the hostility anytime you post something on the forums if the answer isn't what you expected? You do this in a lot of posts. Not nice.
im talking about converting asm to c or C++
We know. What Kheun was trying to say is that this cannot really be done.
Sure, the tool you linked to might be able to somewhat do what you say, but it even says that it is still a very immature technology. The code generated won't be anywhere even near what the original source code looked like. So why even bother?
and that is possible, i will just look for my selvei or maybe make it myselve.
Fine, go look for it or write it yourself. If you are so sure of yourself, why bother posting on the forums then? All you do is get upset when someone tells you something you don't want to hear.
Last edited by dcjr84; November 14th, 2006 at 09:09 PM.
Please rate my post if you felt it was helpful
-
November 14th, 2006, 09:07 PM
#7
Re: convert asm to c
I have no doubt that it is reverse engineering. Let me put it this way. If you have the binaries or executable. It is very easy to reverse the opcode back into asm. However for converting asm back into C/C++, it is virtually impossible because the compiler can do many things to optimize your code such as reordering your code, etc. Code generated for switch-case switch can vary between situations even on the same compiler. In addition, different compilers generate code differently.
quoted from C++ Coding Standards:
KISS (Keep It Simple Software):
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
Avoid magic number:
Programming isn't magic, so don't incant it.
-
November 14th, 2006, 09:10 PM
#8
Re: convert asm to c
 Originally Posted by Mitsukai
maybe you dont read the forum im not talking about reverse engeneering.
A better term for this would be decompilation
Try some searches on this and see if you can find anything useful.
-
November 14th, 2006, 09:50 PM
#9
Re: convert asm to c
 Originally Posted by Kheun
I have no doubt that it is reverse engineering. Let me put it this way. If you have the binaries or executable. It is very easy to reverse the opcode back into asm. However for converting asm back into C/C++, it is virtually impossible because the compiler can do many things to optimize your code such as reordering your code, etc. Code generated for switch-case switch can vary between situations even on the same compiler. In addition, different compilers generate code differently.
o say again i dont want to go from asm to original. just from asm to c.
-
November 15th, 2006, 04:25 AM
#10
Re: convert asm to c
Asm to C is quite easy... It won't produce the original symbol information (which is the most useful thing to understand a program), nor the original statements.
In fact, it can't help much somebody who knows assembly code.
But it can help somebody who don't know assembly, but knows C.
I won't name that a "decompiler". But a "compiler".
It compiles asm to C.
For example, it's possible to write such dump compiler which does things like converting
Code:
; ...
mov eax, ecx;
add ecx, eax;
mov edx,[esi]
; ...
To
Code:
int main() {
intptr_t eax, ecx, edx, ebx, esp, ebp, esi, edi;
/* ... */
eax=ecx;
ecx+=eax;
edx=*((int*)esi);
/* ... */
}
However I admit that such dumb compiler don't help much... You can't understand the meaning of variables nor the global structure of programs.
It's possible to write much smarter asm->C compiler, producing better looking statements, however I doubt it's possible to write something that makes things more understandable at global level... It's possible at local level...
Unfortunately, this is exactly what humans are good at too. Locally understanding assembly code is very easy... Understanding a global program is tough and requires much time.
"inherit to be reused by code that uses the base class, not to reuse base class code", Sutter and Alexandrescu, C++ Coding Standards.
Club of lovers of the C++ typecasts cute syntax: Only recorded member.
Out of memory happens! Handle it properly!
Say no to g_new()!
-
November 15th, 2006, 07:01 AM
#11
Re: convert asm to c
gotta love you koko, you are always the one who understand me.
i have this program i disambled with ollydbg. i need to figure out how it connects to a certain server. however it is hard to figure out the program flow for me, when a function is called i only see the module name and the function adress. like user32.35645 for ex. but if it was to be compiled into C would say for ex GetModuleHandle.
for ex this would output:
Code:
int main(void); //<ModuleEntryPoint>
void Func1(int&); // adress 145345
int main(void)
{
void* Local1;
Func1(&local1);
}
void Func1(int& Param1)
{
Param1 = 2134;
}
just for a simple example. this would help me understand the program flow alot.
then if u get more into it and make it more advanced you can determine if the register is a string and make a std::string localX instead of void* and compile it into C++
-
November 16th, 2006, 10:38 AM
#12
Re: convert asm to c
 Originally Posted by Mitsukai
i have this program i disambled with ollydbg. i need to figure out how it connects to a certain server. however it is hard to figure out the program flow for me, when a function is called i only see the module name and the function adress. like user32.35645 for ex. but if it was to be compiled into C would say for ex GetModuleHandle.
w32dasm does this work for you.
Yes, there exists "assembly disassembler".
And, yes, it's useful.
Note also that asm->C compilers can seriously increase the understanding speed (perhaps by 3, 4 or more) of the reader, because, even local understanding, when reading assembly code, take some time.
"inherit to be reused by code that uses the base class, not to reuse base class code", Sutter and Alexandrescu, C++ Coding Standards.
Club of lovers of the C++ typecasts cute syntax: Only recorded member.
Out of memory happens! Handle it properly!
Say no to g_new()!
-
November 16th, 2006, 10:49 AM
#13
Re: convert asm to c
yes you are completly right koko. i really understand 1% of what is happening, maybe a simple exe i would understand but wen it gets bigger, it is completly chaos. thats why they invented higher level prorgamming in the first place i think
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|