Converting an exe to original(source code)

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 20668 Views - Last Post: 14 July 2008 - 06:41 PM Rate Topic: -----

#1 naag  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-July 08

Converting an exe to original(source code)

Post icon  Posted 11 July 2008 - 06:26 AM

Hi,

I have an exe file i want to convert it into orginal to view its source code(VBScript).Can any one help me out how to do this task.

Thanks in Advance
Naag
Is This A Good Question/Topic? 0
  • +

Replies To: Converting an exe to original(source code)

#2 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1382
  • View blog
  • Posts: 10,962
  • Joined: 06-February 08

Re: Converting an exe to original(source code)

Posted 11 July 2008 - 06:29 AM

Simple answer: you can't.

Imagine if you could get the source code of Microsoft Office or anything like that, just by opening the exe in a file reader.

They would lose soooo much money.
Was This Post Helpful? 0
  • +
  • -

#3 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: Converting an exe to original(source code)

Posted 11 July 2008 - 06:32 AM

In some cases you can. I have a .NET decompiler that can reconstruct the original source code of any .NET program. It works extremely well too. However, in most cases, it is possible to disassemble a program into assembly language.
Was This Post Helpful? 0
  • +
  • -

#4 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1382
  • View blog
  • Posts: 10,962
  • Joined: 06-February 08

Re: Converting an exe to original(source code)

Posted 11 July 2008 - 07:02 AM

Yeah, but VBScript?
Was This Post Helpful? 0
  • +
  • -

#5 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: Converting an exe to original(source code)

Posted 11 July 2008 - 07:12 AM

View Postgabehabe, on 11 Jul, 2008 - 09:02 AM, said:

Yeah, but VBScript?

Didn't notice that part until now. Pretty sure he meant normal VB code.
Was This Post Helpful? 0
  • +
  • -

#6 C++ Programmer  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 20
  • View blog
  • Posts: 548
  • Joined: 12-June 08

Re: Converting an exe to original(source code)

Posted 11 July 2008 - 07:14 AM

Wow, I was hoping you could too. Oh Well.
Was This Post Helpful? 0
  • +
  • -

#7 Ken Halter  Icon User is offline

  • New D.I.C Head

Reputation: 14
  • View blog
  • Posts: 35
  • Joined: 18-November 07

Re: Converting an exe to original(source code)

Posted 11 July 2008 - 08:27 PM

Yep.. agreeing with others. The simple answer is, you can't get the source.

VB6 compiles to native code, so the best you'd get is assembler language. Even if the program is compiled to PCode, it'll be hard to find a decompiler that'll come close to giving you anything but a mess. iirc, the last decent VB decompilers were around in VB3 days. Since the "native code" option was introduced, there hasn't been much development on a VB decompiler.

Native code's nothing like dotNet. dotNet "compiles" to an intermediate language that's compiled "Just in Time" on the target computer... that adds the benefit of targetting specific CPUs and other hardware, but it makes it incredibly easy to decompile. There are tons of dotNet decompilers available.... in fact, there are so many, quite a few software vendors simply "up the price" of their suites and include the price of the source... which is cool, if you can afford it... there's a lot to be learned from looking at the source.

By the way... if it's an exe, it's not VBScript. It's probably VB4, 5 or 6... thinking a bit here (imagine that!) are you sure it's even VB? If so, how? Did you lose the source after compiling?
Was This Post Helpful? 0
  • +
  • -

#8 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Converting an exe to original(source code)

Posted 12 July 2008 - 05:13 AM

Quite often VBScript is stored in its source code form.
If the extension of the file is VBS (such as file1.vbs), then open the file in any text editor to read the source.
Was This Post Helpful? 0
  • +
  • -

#9 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Converting an exe to original(source code)

Posted 12 July 2008 - 05:28 AM

Quote

In some cases you can. I have a .NET decompiler that can reconstruct the original source code of any .NET program. It works extremely well too.

It is possible to have upto 100% accurate decompilation for non-native code. That is why you will find decompilers for .NET, Java, ActionScript, VB6 (P-code) etc. This is because for byte-code format specific techniques are imposed by the compiler to implement each feature( this gives you the best performance ).

For Example,
A while() loop will always have the same pattern in Java Byte-code, VB6 p-code and .NET managed code (it doesn't have to be so, but Sun and Microsoft insisited that it be so)

Thus, A simple series of steps for decompilation specific to a byte-code language will work for all programs compiled in the same format.

But decompilation techniques for native code are not yet developed as of now as each compiler has its own tricks and techniques to implement a code construct.

For Example, a particular machine-code pattern might be equivalent to a while() loop compiled in VC++ but Borland C++ might have a different method of implementing while(). It is difficult to consider this situation while attempting decompilation.

Hence you can't use the same set of decompilation steps to decompile every program.

Quote

However, in most cases, it is possible to disassemble a program into assembly language.

EVERY machine code instruction has a unique and equivalent assembly language instruction.

Thus, it is always possible to convert machine language instructions to assembly (holds true even for programs protected with Packers)
Was This Post Helpful? 0
  • +
  • -

#10 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: Converting an exe to original(source code)

Posted 12 July 2008 - 11:38 AM

View Postborn2c0de, on 12 Jul, 2008 - 07:28 AM, said:

Quote

However, in most cases, it is possible to disassemble a program into assembly language.

EVERY machine code instruction has a unique and equivalent assembly language instruction.

Thus, it is always possible to convert machine language instructions to assembly (holds true even for programs protected with Packers)

Actually, just as there are .NET obfuscators, that can scramble a .NET program so it cannot be decompiled, there are also anti-disassembler obfuscators, to make programs fool disassemblers.
Was This Post Helpful? 0
  • +
  • -

#11 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Converting an exe to original(source code)

Posted 13 July 2008 - 06:16 AM

Quote

Actually, just as there are .NET obfuscators, that can scramble a .NET program so it cannot be decompiled

Wrong. Very Wrong.
The only thing obfuscators do is change the name of classes and variables to A,B,C,D or random hex strings such as 2342f42b123a123c13e().

Here's how they work.

If I use MessageBox.Show() anywhere in my program instead of appearing in the Decompiled code as System.Windows.Forms.MessageBox.Show(parameters) it will appear as A.B.C.D.E(parameters) (or worse yet, 2342f42b123a123c13e.565213162fcad.6237462376273.bad.b32fca(parameters) )and it can be very frustrating to understand this in larger programs.

Java Obfuscators use the same principle.

Obfuscators do not prevent decompilation as the result of the decompiler is still correct. It just makes it harder to read for reversers.

Quote

there are also anti-disassembler obfuscators, to make programs fool disassemblers.

Yes, but by cheating.
They insert incorrect machine code instructions in the code and surround it with jump like this:
; program code
 jmp here
;incorrect machine code instruction
here:
; rest of the program code

An example of an incorrect machine code instruction is the byte 0x08.
0x08 is the instruction for the OR instruction which consists of 2 bytes.
But since only 1 byte is provided (0x08), the following byte (from the program code) will be considered as the parameter for the OR instruction.

If such an instruction gets executed, the program will crash. Hence a jump prevents the incorrect byte from being executed.

Disassemblers will still try to disassemble the OR instruction and will either screw up the disassembled code or crash.

However, this technique (and other similar ones) does not affect smarter disassemblers such as IDA Pro.
Was This Post Helpful? 0
  • +
  • -

#12 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: Converting an exe to original(source code)

Posted 13 July 2008 - 08:55 AM

View Postborn2c0de, on 13 Jul, 2008 - 08:16 AM, said:

Quote

Actually, just as there are .NET obfuscators, that can scramble a .NET program so it cannot be decompiled

Wrong. Very Wrong.
The only thing obfuscators do is change the name of classes and variables to A,B,C,D or random hex strings such as 2342f42b123a123c13e().

I have a .NET obfuscator. I tested it on a program, and when i tried to decompile it, my decompiler screwed up so bad i had to close it in task manager. Maybe it just wasn't a good decompiler.
Was This Post Helpful? 0
  • +
  • -

#13 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Converting an exe to original(source code)

Posted 14 July 2008 - 03:49 AM

Quote

Maybe it just wasn't a good decompiler.

Try Reflector .NET or ILDASM (shipped with Visual Studio)
Was This Post Helpful? 0
  • +
  • -

#14 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: Converting an exe to original(source code)

Posted 14 July 2008 - 09:00 AM

View Postborn2c0de, on 14 Jul, 2008 - 05:49 AM, said:

Quote

Maybe it just wasn't a good decompiler.

Try Reflector .NET or ILDASM (shipped with Visual Studio)

I have the express editions, so i didn't get any of the luxuries. I am using a free decompiler called Xenocode Fox Community edition. It's like an express of the pro version, and so it's missing some features, but overall it does a fair job.
Was This Post Helpful? 0
  • +
  • -

#15 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Converting an exe to original(source code)

Posted 14 July 2008 - 10:21 AM

Oh, okay.
But Reflector .NET is free.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2