Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #21986 > unrolled thread

decompile

Started by"Fred" <you@your.domain>
First post2012-06-08 20:34 +0200
Last post2012-06-18 19:42 -0500
Articles 20 on this page of 23 — 18 participants

Back to article view | Back to comp.lang.c


Contents

  decompile "Fred" <you@your.domain> - 2012-06-08 20:34 +0200
    Re: decompile gazelle@shell.xmission.com (Kenny McCormack) - 2012-06-08 18:48 +0000
      Re: decompile "Rowan K. Fullack III" <nospam@nospam.com> - 2012-06-09 19:03 +0000
    Re: decompile James Kuyper <jameskuyper@verizon.net> - 2012-06-08 14:53 -0400
    Re: decompile Jean-Christophe <5.d@free.fr> - 2012-06-08 12:00 -0700
    Re: decompile Keith Thompson <kst-u@mib.org> - 2012-06-08 14:15 -0700
      Re: decompile Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-08 17:38 -0400
        Re: decompile Jean-Christophe <5.d@free.fr> - 2012-06-08 14:46 -0700
    Re: decompile Datesfat Chicks <datesfat.chicks@gmail.com> - 2012-06-08 21:27 -0400
    Re: decompile Kenneth Brody <kenbrody@spamcop.net> - 2012-06-09 10:47 -0400
      Re: decompile Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-09 19:10 +0100
      Re: decompile "BartC" <bc@freeuk.com> - 2012-06-09 19:22 +0100
        Re: decompile Kenneth Brody <kenbrody@spamcop.net> - 2012-06-11 09:17 -0400
          Re: decompile pete <pfiland@mindspring.com> - 2012-06-11 22:45 -0400
    Re: decompile Geoff <geoff@invalid.invalid> - 2012-06-09 08:26 -0700
      Re: decompile gwowen <gwowen@gmail.com> - 2012-06-11 02:01 -0700
    Re: decompile "Fred" <you@your.domain> - 2012-06-09 20:43 +0200
      Re: decompile Jean-Christophe <5.d@free.fr> - 2012-06-09 13:09 -0700
        Re: decompile Sorry you're right "Fred" <you@your.domain> - 2012-06-09 23:12 +0200
    Re: decompile John Bode <jfbode1029@gmail.com> - 2012-06-11 07:53 -0700
    Re: decompile Michael Angelo Ravera <maravera@prodigy.net> - 2012-06-13 13:20 -0700
    Re: decompile Dann Corbit <dcorbit@connx.com> - 2012-06-13 16:46 -0700
      Re: decompile gordonb.v9y2l@burditt.org (Gordon Burditt) - 2012-06-18 19:42 -0500

Page 1 of 2  [1] 2  Next page →


#21986 — decompile

From"Fred" <you@your.domain>
Date2012-06-08 20:34 +0200
Subjectdecompile
Message-ID<4fd245b6$1@news.usenet4you.net>

Hello

it is possible to decompile a program to c?







Posted Via http://www.usenet4you.net the free uncensored newsserver.

Oh, so they have internet on computers now?” — Homer Simpson

[toc] | [next] | [standalone]


#21991

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2012-06-08 18:48 +0000
Message-ID<jqthdp$mjl$1@news.xmission.com>
In reply to#21986
In article <4fd245b6$1@news.usenet4you.net>, Fred <you@your.domain> wrote:
>
>
>Hello
>
>it is possible to decompile a program to c?

Yes.

-- 
Here's a simple test for Fox viewers:

1) Sit back, close your eyes, and think (Yes, I know that's hard for you).
2) Think about and imagine all of your ridiculous fantasies about Barack Obama.
3) Now, imagine that he is white.  Cogitate on how absurd your fantasies
seem now.

See?  That wasn't hard, was it?

[toc] | [prev] | [next] | [standalone]


#22075

From"Rowan K. Fullack III" <nospam@nospam.com>
Date2012-06-09 19:03 +0000
Message-ID<jr06ln$4lq$1@speranza.aioe.org>
In reply to#21991
On 6/8/12 12:48:25 MDT, Kenny McCormack wrote:
> Here's a simple test for Fox viewers:
> 
> 1) Sit back, close your eyes, and think (Yes, I know that's hard for
> you).
> 2) Think about and imagine all of your ridiculous fantasies about
> Barack Obama.
> 3) Now, imagine that he is white.  Cogitate on how absurd your fantasies
> seem now.
> 
> See?  That wasn't hard, was it?

This is kind of offtopic for this group but this idiocy cannot go 
unchallenged. This message is completely offensive.

Let's look at the facts here. Barack Hussein Obama:
1) was born in Kenya
2) has been a Moslem in the past, and maybe he still follows that 
doctrine privately
3) when he tried to pass as a Christian, he fell in with a pastor who 
curses America
4) has a wife who has said she is embarrassed to be American
5) has pursued policies that have cost American jobs and has started on 
the road to full-scale European-style socialism with his healthcare 
reforms.

None of these points has a damn thing to do with the guy's skin color. 
It's the fact he's an anti-American socialist that people don't like, 
nothing else. He has squandered Bush's golden legacy.

Hope that sets the record straight, let's get back to C.

Rowan

[toc] | [prev] | [next] | [standalone]


#21995

FromJames Kuyper <jameskuyper@verizon.net>
Date2012-06-08 14:53 -0400
Message-ID<jqthnj$vji$1@dont-email.me>
In reply to#21986
On 06/08/2012 02:34 PM, Fred wrote:
> Hello
> 
> it is possible to decompile a program to c?

It's possible to generate a C program which would behave the same as the
program you're decompiling; I believe that some people may have even
created such things. However, the output will, in general, be nearly
unintelligible. That's because the process of compiling a C program
tends to discard a large portion of the information needed for a human
to understand the program. First of all, it drops all of the comments.
Secondly, identifiers with internal linkage or no linkage (which is the
vast majority the identifiers in your program) are, in effect, converted
into other forms that are meaningful only to the hardware. Any
information stored in the identifier's spelling is just plain lost.
Finally, most modern compilers optimize your code by rearranging your
code extensively. It's possible to write C code that does the same thing
as the optimized code, but it's generally not possible to reconstruct
what the original code looked like before optimization.

[toc] | [prev] | [next] | [standalone]


#21996

FromJean-Christophe <5.d@free.fr>
Date2012-06-08 12:00 -0700
Message-ID<e29db05c-4c17-41a4-b61c-c049e6aa59a1@q2g2000vbv.googlegroups.com>
In reply to#21986
On 8 juin, 20:34, "Fred" :

> it is possible to decompile a program to c?

Yes it is - even if I don't know any actual
software to 'decompile' an executable program to C.

One can un-assemble an executabe program to asm.
( does anyone here remember 'sourcer' ? )
Now what you need is to write a
program to translate asm to C.

But you won't get the very original C source code,
because there are many ways to translate asm
to high(er)-level language.

[toc] | [prev] | [next] | [standalone]


#22016

FromKeith Thompson <kst-u@mib.org>
Date2012-06-08 14:15 -0700
Message-ID<lnobotbj53.fsf@nuthaus.mib.org>
In reply to#21986
"Fred" <you@your.domain> writes:
> it is possible to decompile a program to c?

It's possible (though it may or may not be practical).  In other
words, for any executable, it should be possible to generate C code
that behaves the same way.

But don't expect the resulting C code to be legible or maintainable,
or to have any particular resemblance to the original code that
was compiled to produce the executable.  A lot of information,
such as variable names, is discarded during compilation, and you
can't reliably distinguish between a for loop, a while loop, and
a goto statement.  You can't unscramble an egg.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#22019

FromEric Sosman <esosman@ieee-dot-org.invalid>
Date2012-06-08 17:38 -0400
Message-ID<jqtrc4$vp9$1@dont-email.me>
In reply to#22016
On 6/8/2012 5:15 PM, Keith Thompson wrote:
> "Fred"<you@your.domain>  writes:
>> it is possible to decompile a program to c?
>
> It's possible (though it may or may not be practical).  In other
> words, for any executable, it should be possible to generate C code
> that behaves the same way.
>
> But don't expect the resulting C code to be legible or maintainable,
> or to have any particular resemblance to the original code that
> was compiled to produce the executable.  A lot of information,
> such as variable names, is discarded during compilation, and you
> can't reliably distinguish between a for loop, a while loop, and
> a goto statement.  You can't unscramble an egg.

     One thing that's extremely likely to be lost in un-translation
is any hope of portability.  When the C program was compiled in the
first place, it probably imported a lot of implementation-specific
stuff from headers like <stdio.h> and <limits.h> and so on.  If the
decompiler sees that a variable is being compared to 127, should
the decompiled source have a comparison to `127', or to `CHAR_MAX',
or to `SCHAR_MAX', or to `_FILE_INTERNAL_BUFSIZ - 1'?  Any of these
could well become wrong if the decompiled code then moves to another
system ...

     So: What do you (Fred, O.P.) hope to do with the decompiled code,
assuming you're ever able to get some?

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

[toc] | [prev] | [next] | [standalone]


#22020

FromJean-Christophe <5.d@free.fr>
Date2012-06-08 14:46 -0700
Message-ID<c38f5174-287a-4576-a64a-7d5b1db053cc@cu1g2000vbb.googlegroups.com>
In reply to#22019
On 8 juin, 23:38, Eric Sosman :

> (...) So: What do you (Fred, O.P.) hope to do with the
> decompiled code, assuming you're ever able to get some?

Win the international obfuscated C code contest ? :o)

[toc] | [prev] | [next] | [standalone]


#22032

FromDatesfat Chicks <datesfat.chicks@gmail.com>
Date2012-06-08 21:27 -0400
Message-ID<l495t75nti6ms3vcjn7offktd2vbpfstr6@4ax.com>
In reply to#21986
On 8 Jun 2012 20:34:30 +0200, "Fred" <you@your.domain> wrote:
>
>it is possible to decompile a program to c?

Ultimately, it is a set mapping problem.

Any given C program maps to only one executable (on the same platform,
compiler version, etc.).

But an executable will map to an infinite number of C programs.

The other posters described some of the issues.

a)Comments.

b)Variable names.

c)Looping constructs.

d)Platform-specific constants--where did the "127" come from?

However, figuring out what reverse-engineered assembly-language does
often isn't as hard as you'd think.  You can get all of this
information on inspection:

a)Function boundaries.

b)The calling tree.

c)Passed parameters and returned values.

d)Stack frames/local variables.

e)Loops.

So if somebody gave me an executable that contained a square root
function, I'd be able to figure out what the function did.

I've done this all the time for microcontroller library code for which
I didn't have the source code.  But this is a restricted domain ... if
somebody asked me to figure out what, for example, a LaTeX compiler is
... I'd not be able to do it.

It partially depends on how much you already know about what you're
trying to reverse engineer.

DTA

[toc] | [prev] | [next] | [standalone]


#22063

FromKenneth Brody <kenbrody@spamcop.net>
Date2012-06-09 10:47 -0400
Message-ID<mJadnVGzIeR7_E7SnZ2dnUVZ_qOdnZ2d@bestweb.net>
In reply to#21986
On 6/8/2012 2:34 PM, Fred wrote:
> Hello
>
> it is possible to decompile a program to c?

To summarize what the others have said:

     You can't make a cow from hamburgers.

-- 
Kenneth Brody

[toc] | [prev] | [next] | [standalone]


#22070

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2012-06-09 19:10 +0100
Message-ID<0.58712ae7f74421c74001.20120609191006BST.87vcj073wh.fsf@bsb.me.uk>
In reply to#22063
Kenneth Brody <kenbrody@spamcop.net> writes:

> On 6/8/2012 2:34 PM, Fred wrote:
>> Hello
>>
>> it is possible to decompile a program to c?
>
> To summarize what the others have said:
>
>     You can't make a cow from hamburgers.

I don't think that's what's been said.  To stick to the bovine analogy,
the summary would be that you can make something that *behaves* exactly
like a cow from hamburgers, but you may not be able to tell what the cow
does, modify it simply to behave like a bull, or make one able to live
anywhere other than where it was brought up in the first place.

Oh, yes, lest I forget: :-)

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#22074

From"BartC" <bc@freeuk.com>
Date2012-06-09 19:22 +0100
Message-ID<jr049k$r7p$1@dont-email.me>
In reply to#22063

"Kenneth Brody" <kenbrody@spamcop.net> wrote in message
news:mJadnVGzIeR7_E7SnZ2dnUVZ_qOdnZ2d@bestweb.net...
> On 6/8/2012 2:34 PM, Fred wrote:

>> it is possible to decompile a program to c?
>
> To summarize what the others have said:
>
>     You can't make a cow from hamburgers.

It may not be ethical, but you can probably feed hamburgers to a calf. End 
result is a cow (depending on what sort of calf it was).

-- 
Bartc 

[toc] | [prev] | [next] | [standalone]


#22111

FromKenneth Brody <kenbrody@spamcop.net>
Date2012-06-11 09:17 -0400
Message-ID<W8idnaF45vVOckjSnZ2dnUVZ_rSdnZ2d@bestweb.net>
In reply to#22074
On 6/9/2012 2:22 PM, BartC wrote:
>
>
> "Kenneth Brody" <kenbrody@spamcop.net> wrote in message
> news:mJadnVGzIeR7_E7SnZ2dnUVZ_qOdnZ2d@bestweb.net...
>> On 6/8/2012 2:34 PM, Fred wrote:
>
>>> it is possible to decompile a program to c?
>>
>> To summarize what the others have said:
>>
>> You can't make a cow from hamburgers.
>
> It may not be ethical, but you can probably feed hamburgers to a calf. End
> result is a cow (depending on what sort of calf it was).

Ah, but the cow you end up with would be indistinguishable from the cow you 
would have gotten even if you didn't feed it the hamburger.  And the 
resulting cow is not related to the cow from which the hamburger was made. 
(And who says that there was a single cow as the source of the burger?)

A closer analogy would be to take the DNA from the burger (you did save a 
copy of the DNA prior to cooking, didn't you?), and use it to make a clone 
of the original cow.  However, this analogy only works for quines.

-- 
Kenneth Brody

[toc] | [prev] | [next] | [standalone]


#22132

Frompete <pfiland@mindspring.com>
Date2012-06-11 22:45 -0400
Message-ID<4FD6AD4E.45A0@mindspring.com>
In reply to#22111
Kenneth Brody wrote:
> 
> On 6/9/2012 2:22 PM, BartC wrote:
> >
> >
> > "Kenneth Brody" <kenbrody@spamcop.net> wrote in message
> > news:mJadnVGzIeR7_E7SnZ2dnUVZ_qOdnZ2d@bestweb.net...
> >> On 6/8/2012 2:34 PM, Fred wrote:
> >
> >>> it is possible to decompile a program to c?
> >>
> >> To summarize what the others have said:
> >>
> >> You can't make a cow from hamburgers.
> >
> > It may not be ethical,
> > but you can probably feed hamburgers to a calf. End
> > result is a cow (depending on what sort of calf it was).
> 
> Ah, but the cow you end up with would be indistinguishable
> from the cow you
> would have gotten even if you didn't feed it the hamburger. 

http://en.wikipedia.org/wiki/Mad_cow_disease

"A British inquiry into BSE concluded the epizootic
 was caused by cattle, which are normally herbivores, 
 being fed the remains of other cattle 
 in the form of meat and bone meal (MBM),
 which caused the infectious agent to spread."

-- 
pete

[toc] | [prev] | [next] | [standalone]


#22067

FromGeoff <geoff@invalid.invalid>
Date2012-06-09 08:26 -0700
Message-ID<b6q6t7dgubejvqhnfoks04a7c8q1hajkrb@4ax.com>
In reply to#21986
On 8 Jun 2012 20:34:30 +0200, "Fred" <you@your.domain> wrote:

>
>
>Hello
>
>it is possible to decompile a program to c?
>

Only in some of the most trivial cases or where the insight into the
code is more valuable than the cost of reverse engineering the
program.

What you end up doing is disassembling the object code and then
translating that assembly code into an equivalent C source but that
source may not match the original. Often, the assembly gives more
insight into the code than the C source would. (Worms and viruses.)

The process is highly sensitive to the target environment.

[toc] | [prev] | [next] | [standalone]


#22105

Fromgwowen <gwowen@gmail.com>
Date2012-06-11 02:01 -0700
Message-ID<391b4521-542e-44d2-9177-9e5257bd993c@w24g2000vby.googlegroups.com>
In reply to#22067
On Jun 9, 4:26 pm, Geoff <ge...@invalid.invalid> wrote:

> What you end up doing is disassembling the object code and then
> translating that assembly code into an equivalent C source but that
> source may not match the original.

... unless io_x wrote the original...

[toc] | [prev] | [next] | [standalone]


#22076

From"Fred" <you@your.domain>
Date2012-06-09 20:43 +0200
Message-ID<4fd3993a$1@news.usenet4you.net>
In reply to#21986

which program can I use to decompile i tried boomerang but it crasht.





Posted Via http://www.usenet4you.net the free uncensored newsserver.

Oh, so they have internet on computers now?” — Homer Simpson

[toc] | [prev] | [next] | [standalone]


#22078

FromJean-Christophe <5.d@free.fr>
Date2012-06-09 13:09 -0700
Message-ID<dfe7995c-56e1-4415-a424-d89cacdb46d7@l5g2000vbo.googlegroups.com>
In reply to#22076
On 9 juin, 20:43, "Fred" :

> which program can I use to decompile
> i tried boomerang but it crasht.

You mean that the 'boomerang'
came straight back in yer face ?

Since you've got 12 ansers to your question
but didn't bother to say 'thanks'
now it's time for you to tell us
what program you want to 'decompile',
and why you want to do such thing.

(my guess is that you're posting to the wrong NG,
better take a chance to '3771tHackerZ' kids NG)

----
"Oh, so they have Fred on comp.lang.c now?"

[toc] | [prev] | [next] | [standalone]


#22081 — Re: decompile Sorry you're right

From"Fred" <you@your.domain>
Date2012-06-09 23:12 +0200
SubjectRe: decompile Sorry you're right
Message-ID<4fd3bc2d$1@news.usenet4you.net>
In reply to#22078

Jean-Christophe <5.d@free.fr> wrote:
>On 9 juin, 20:43, "Fred" :
>
>> which program can I use to decompile
>> i tried boomerang but it crasht.
>
>You mean that the 'boomerang'
>came straight back in yer face ?
>
>Since you've got 12 ansers to your question
>but didn't bother to say 'thanks'
>now it's time for you to tell us
>what program you want to 'decompile',
>and why you want to do such thing.
>
>(my guess is that you're posting to the wrong NG,
>better take a chance to '3771tHackerZ' kids NG)
>
>----
>"Oh, so they have Fred on comp.lang.c now?" LOL

Sorry you're right thanks everyone for your response.


Posted Via http://www.usenet4you.net the free uncensored newsserver.

Oh, so they have internet on computers now?” — Homer Simpson

[toc] | [prev] | [next] | [standalone]


#22114

FromJohn Bode <jfbode1029@gmail.com>
Date2012-06-11 07:53 -0700
Message-ID<65fbe5f4-3983-4f12-ab0f-e01050603c0c@googlegroups.com>
In reply to#21986
On Friday, June 8, 2012 1:34:30 PM UTC-5, Fred wrote:
> Hello
> 
> it is possible to decompile a program to c?
> 

The technical term for this is "turning hamburger back into a cow".  Yes, it is possible to generate C source code from an executable; it may bear little to no resemblance to the original source code.  It may not be very readable or understandable.  Comments, symbol names, file names, etc., are (usually) not preserved in the binary itself.  

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.c


csiph-web