[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Wrapping code



Adam Stiles <adam@priceengines.co.uk> writes:

> On Friday 25 November 2005 09:36, Leopold Palomo-Avellaneda wrote:
>> Hi,
>>
>> I have a question that maybe could be an off topic but I think that it
>> could be interesting for the amd64 users.
>>
>> I have a library code with some executables of a device. This device uses
>> the parallel port and provides a library to use it with some more
>> functionalities (provides some .so and some .h to link with).
>>
>> Of course I don't have the source code and worst the library is compiled
>> for RedHat 7.2 :-( (gcc-2.96 ...)
>
> I've often thought that it ought to be possible to reverse the compilation 
> process, after a fashion.  You would end up with a whole load of ifs and 
> gotos, of course.  All means to the same end are equally valid and you cannot 
> tell after the event which one was uesd.  Who is to say what is a while loop 
> and what is a for loop, or even what language it was written in the first 
> place?  And you probably would not ahve any of the variable or function 
> names, if the binary was stripped.  Still, that only matters to human 
> beings :)  The near-unreadable code it produced -ought still to be able to be 
> compiled- with a newer version of the compiler  {since the missing stuff like 
> variable names is just for the benefit of humans}.
>
> In fact, I found a project aiming to do just that:
> http://boomerang.sourceforge.net/
>
> From the pages, it's very much a work in progress; but if Boomerang can manage 
> to recover your missing source code, you just might be able to recompile it 
> for the new environment.
>
> It's got to be worth a shot  :)

If the code does not actively protect against that then an asm2c
compiler is not a big deal.

But what if the code uses places in the code as instructions and
literal constants at the same time? Or even worse, what if it is self
modifying. Any change in the bit patterns, and a recompile certainly
will have change, can destroy the functionality.

Games used to do that sort of thing for copy protection. Disabling the
code alters some literal constants and the game crashes or misbehaves.

MfG
        Goswin



Reply to: