Author Topic: [Problem] How to extract the source code of any program  (Read 23113 times)

0 Members and 1 Guest are viewing this topic.

Offline m0l0ko

  • Peasant
  • *
  • Posts: 129
  • Cookies: -4
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #15 on: January 04, 2013, 07:11:46 am »
I know how to decompile java .class files but how would I go about decompiling a .exe file? Can I find out what language was used to code the app then go from there?

Offline namespace7

  • Sir
  • ***
  • Posts: 561
  • Cookies: 115
  • My Brother's Keeper
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #16 on: January 04, 2013, 03:24:13 pm »
Well its a bit complex.
For some languages you can use decompilers like VB decompiler or DeDe for delphi.
C also has a decompiler but its expensive as hell and hard to get. Google HexRays.
Also do some reading about Boomerang. It is an interesting project but I personally couldn't get it to work properly.

However, if you fail to find a decompiler for your exe program, you can still dissasemble it. Modern disasemblers make it rather easy to debug and analyze assembly code. I recommend OllyDbg.

"A programmer’s greatest enemy isn’t the tools or the boss or the artists or the design or the legacy code or the third party code or the API or the OS. A programmer’s greatest enemy is getting stuck.
Therefore a crucial step to becoming a better programmer is learning how to avoid getting stuck, to recognize when you’re stuck, and to get unstuck." -Jeff Wofford

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Problem] How to extract the source code of any program
« Reply #17 on: January 04, 2013, 04:57:44 pm »
Can I find out what language was used to code the app?
Yes, you can determine the language and sometimes even a compiler from the PE header.
PE header is embedded in every EXE by the compiler, unless the EXE was scrambled with a crypter or obfuscator of some sort or a packer (if UPX then you can depack the EXE with UPX as well).
There is also a tool for that here: http://www.woodmann.com/collaborative/tools/index.php/ExeInfo_PE

Offline m0l0ko

  • Peasant
  • *
  • Posts: 129
  • Cookies: -4
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #18 on: January 04, 2013, 05:29:53 pm »
I can't get the linux version of boomerang to work myself either.

Offline p_2001

  • Royal Highness
  • ****
  • Posts: 684
  • Cookies: -64
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #19 on: January 12, 2013, 07:21:01 am »
Yes, you can determine the language and sometimes even a compiler from the PE header.
PE header is embedded in every EXE by the compiler, unless the EXE was scrambled with a crypter or obfuscator of some sort or a packer (if UPX then you can depack the EXE with UPX as well).
There is also a tool for that here: http://www.woodmann.com/collaborative/tools/index.php/ExeInfo_PE

this, or you can look at the registers and see how the packer works and manually unpack the file...
the theory is simple enough and that's why programs still get cracked ; D
"Always have a plan"

Offline namespace7

  • Sir
  • ***
  • Posts: 561
  • Cookies: 115
  • My Brother's Keeper
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #20 on: January 12, 2013, 03:58:32 pm »
this, or you can look at the registers and see how the packer works and manually unpack the file...
the theory is simple enough and that's why programs still get cracked ; D

Yeah, crackers dont even bother what language the program was written in, because its easy to crack binary software by disassembling it and simply debugging the binary in run time and changing some logic operations that do the "bouncer" work. The problem is, these days software developers are making it harder to correctly debug the code by introducing new protection methods, like VM/disasembler/debugger detection and so on.
"A programmer’s greatest enemy isn’t the tools or the boss or the artists or the design or the legacy code or the third party code or the API or the OS. A programmer’s greatest enemy is getting stuck.
Therefore a crucial step to becoming a better programmer is learning how to avoid getting stuck, to recognize when you’re stuck, and to get unstuck." -Jeff Wofford

Offline strong115

  • /dev/null
  • *
  • Posts: 16
  • Cookies: -13
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #21 on: March 03, 2013, 05:50:09 am »
namespace7

your tutorial is very powerful and instructive i like it and thank you very much

after reading your tutorial i can sum it up in 3 ideas

1) decompiling does not give the exact program code
2) as a consequence of one the resulting source code will be very complicated and hard to deal with and it will take a lot of time and cost a lot of energy especially for thousands of lines to understand and grasp
3)some programs are immunized against decompiling

so disassembling is the best way to work with a program
this is good


Offline evensteven

  • /dev/null
  • *
  • Posts: 18
  • Cookies: 0
  • creationary tale
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #22 on: May 14, 2013, 11:51:16 am »
OP


Ida pro is pretty good.....pretty expensive if you buy it tho ;)
If you want to accomplish something in the world, idealism is not enough - you need to choose a method that works to achieve the goal.
-Richard Stallman

Offline Alin

  • Peasant
  • *
  • Posts: 56
  • Cookies: -4
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #23 on: May 29, 2013, 09:49:16 pm »
OP


Ida pro is pretty good.....pretty expensive if you buy it tho ;)


Though I've heard the "Swedish AppStore" has it on sale.. If your lucky it includes free malware, so better run it in a virtual machine.


Hex-Rays's compiler, which is included in some Ida pro versions, actually does a great job decompiling. I've been told by friends that Hopper [1] is getting decent, but I have no experience with it. It's also well priced, compared to Hex-Rays!


[1] http://www.hopperapp.com/