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

0 Members and 1 Guest are viewing this topic.

Offline Dark Nebulae

  • Peasant
  • *
  • Posts: 117
  • Cookies: -79
  • Unleash the Hacker within you
    • View Profile
[Problem] How to extract the source code of any program
« on: September 09, 2012, 02:46:02 pm »
plz tell me how to find the source  code of any program
Trust is like a piece of paper.Once it is crumbled,it can never be perfect.

Offline ca0s

  • VIP
  • Sir
  • *
  • Posts: 432
  • Cookies: 53
    • View Profile
    • ka0labs #
Re: [Problem] How to extract the source code of any program
« Reply #1 on: September 09, 2012, 03:17:21 pm »
Just go to the coder's office and steal it.

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #2 on: September 09, 2012, 04:12:29 pm »
disassemble it...
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline p_2001

  • Royal Highness
  • ****
  • Posts: 684
  • Cookies: -64
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #3 on: September 09, 2012, 04:23:06 pm »
Not possible.. Best you get is asm code.

it is possible to get java code though, but not always.
Better write it all from scratch.
"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 #4 on: September 09, 2012, 05:30:34 pm »
You need to understand that there are software programs that were compiled into executable files (written by languages like C/C++), there are programs that are translated into bytecode which is then executed by the virtual machine (written in languages like Java), and there are programs that  are interpreted and do not need to be compiled by the developer to be used (written in languages such as Python).

It is impossible to get the exact source code of a compiled program because compilation is an irreversible one-way process in such languages. There are decompilers that can analyze the executable and try to recreate the source code, but they are often very inaccurate and the resulting code is very hard to work with. The only sure thing you can do is disassemble the executable program using a disassembler such as IDA Pro or OllyDbg for Windows, or gdb for linux (there are many more). It will read the executable machine code and convert it into assembly code which can be analyzed and modified (other tools then the disassembler are required to do this, but they usually come together with the disassembler, or other way round). This process is often called reverse engineering, as you attempt to understand how the entity was created and how it works without having the original blueprints (or source code in our case).
It is more easy to decompile java or similar bytecode though. Check out Java Decompiler.

Finally, it you do not need to do anything to get the source code of interpreted programs because they are not compiled by the developer in most cases. All you need to do is just open the python or other interpreted program file with a plain text editor.

I hope this helped a bit.

Have fun reversing executables!
"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 p_2001

  • Royal Highness
  • ****
  • Posts: 684
  • Cookies: -64
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #5 on: September 09, 2012, 06:38:03 pm »
You need to understand that there are software programs that were compiled into executable files (written by languages like C/C++), there are programs that are translated into bytecode which is then executed by the virtual machine (written in languages like Java), and there are programs that  are interpreted and do not need to be compiled by the developer to be used (written in languages such as Python).

It is impossible to get the exact source code of a compiled program because compilation is an irreversible one-way process in such languages. There are decompilers that can analyze the executable and try to recreate the source code, but they are often very inaccurate and the resulting code is very hard to work with. The only sure thing you can do is disassemble the executable program using a disassembler such as IDA Pro or OllyDbg for Windows, or gdb for linux (there are many more). It will read the executable machine code and convert it into assembly code which can be analyzed and modified (other tools then the disassembler are required to do this, but they usually come together with the disassembler, or other way round). This process is often called reverse engineering, as you attempt to understand how the entity was created and how it works without having the original blueprints (or source code in our case).
It is more easy to decompile java or similar bytecode though. Check out Java Decompiler.

Finally, it you do not need to do anything to get the source code of interpreted programs because they are not compiled by the developer in most cases. All you need to do is just open the python or other interpreted program file with a plain text editor.

I hope this helped a bit.

Have fun reversing executables!


Please Do not Misinform..

COMPILATION is not irreversible..

Java code is compiled.. It is reversible

Code compiled to machine code is not reversible.. Byte code is a result of java code being compiled.
"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 #6 on: September 09, 2012, 07:02:24 pm »
I was talking about languages that are compiled straight to machine code. I didn't say compilation is irreversible. I said "compilation is an irreversible one-way process in such languages". Note the words "in such languages" and read the first part of the first paragraph. Now read the first two sentences of the second paragraph. I am clearly talking about executable files that are executed by the machine and that such programs need to be disassembled. Bytecode is not even assembled, meaning that obviously it can not be disassembled using a disassembler. I do address that Java bytecode can be decompiled in the ending lines of the second paragraph.
No missinformation is taking place as far as I can see. Sorry if it is not as clear as you might like it to be p_2001. Just re-read the post a few times next time you post a reply please.
"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 iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: [Problem] How to extract the source code of any program
« Reply #7 on: September 09, 2012, 07:50:40 pm »
There are ways to disassemble applications however there is not one method to do it for every exe out there. It all depends, some are easier then others.
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

Offline bubzuru

  • Knight
  • **
  • Posts: 395
  • Cookies: 21
  • everything is contained in the data
    • View Profile
    • New School Tools
Re: [Problem] How to extract the source code of any program
« Reply #8 on: September 29, 2012, 12:28:41 pm »
You need to understand that there are software programs that were compiled into executable files (written by languages like C/C++), there are programs that are translated into bytecode which is then executed by the virtual machine (written in languages like Java), and there are programs that  are interpreted and do not need to be compiled by the developer to be used (written in languages such as Python).

It is impossible to get the exact source code of a compiled program because compilation is an irreversible one-way process in such languages. There are decompilers that can analyze the executable and try to recreate the source code, but they are often very inaccurate and the resulting code is very hard to work with. The only sure thing you can do is disassemble the executable program using a disassembler such as IDA Pro or OllyDbg for Windows, or gdb for linux (there are many more). It will read the executable machine code and convert it into assembly code which can be analyzed and modified (other tools then the disassembler are required to do this, but they usually come together with the disassembler, or other way round). This process is often called reverse engineering, as you attempt to understand how the entity was created and how it works without having the original blueprints (or source code in our case).
It is more easy to decompile java or similar bytecode though. Check out Java Decompiler.

Finally, it you do not need to do anything to get the source code of interpreted programs because they are not compiled by the developer in most cases. All you need to do is just open the python or other interpreted program file with a plain text editor.

I hope this helped a bit.

Have fun reversing executables!


+1 i think we have this covered
Damm it feels good to be gangsta
http://bubzuru.comule.com

Offline Dark Nebulae

  • Peasant
  • *
  • Posts: 117
  • Cookies: -79
  • Unleash the Hacker within you
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #9 on: November 09, 2012, 03:10:53 pm »
You need to understand that there are software programs that were compiled into executable files (written by languages like C/C++), there are programs that are translated into bytecode which is then executed by the virtual machine (written in languages like Java), and there are programs that  are interpreted and do not need to be compiled by the developer to be used (written in languages such as Python).

It is impossible to get the exact source code of a compiled program because compilation is an irreversible one-way process in such languages. There are decompilers that can analyze the executable and try to recreate the source code, but they are often very inaccurate and the resulting code is very hard to work with. The only sure thing you can do is disassemble the executable program using a disassembler such as IDA Pro or OllyDbg for Windows, or gdb for linux (there are many more). It will read the executable machine code and convert it into assembly code which can be analyzed and modified (other tools then the disassembler are required to do this, but they usually come together with the disassembler, or other way round). This process is often called reverse engineering, as you attempt to understand how the entity was created and how it works without having the original blueprints (or source code in our case).
It is more easy to decompile java or similar bytecode though. Check out Java Decompiler.

Finally, it you do not need to do anything to get the source code of interpreted programs because they are not compiled by the developer in most cases. All you need to do is just open the python or other interpreted program file with a plain text editor.

I hope this helped a bit.

Have fun reversing executables!
Is it also one way ir-reversible in programs that are made in RUBY?
Trust is like a piece of paper.Once it is crumbled,it can never be perfect.

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #10 on: November 09, 2012, 03:21:47 pm »
Is it also one way ir-reversible in programs that are made in RUBY?

Depends on the implementation. I.e.: MRI is interpreted. JRuby and Rubinius are compiled to bytecode.

Offline Dark Nebulae

  • Peasant
  • *
  • Posts: 117
  • Cookies: -79
  • Unleash the Hacker within you
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #11 on: November 21, 2012, 12:53:55 pm »
I am developing a facebook hacker(ya, I know its totally for making noobs fool) in NetBeans. I want to ask how can I make it a exe file?
And one thing also, how can we get source code of JAVA programs?
Trust is like a piece of paper.Once it is crumbled,it can never be perfect.

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 #12 on: November 21, 2012, 01:41:12 pm »
I am developing a facebook hacker(ya, I know its totally for making noobs fool) in NetBeans. I want to ask how can I make it a exe file?
And one thing also, how can we get source code of JAVA programs?

1. EXE's are for compiled languages. Netbeans support a lot of languages because it's an IDE. I assume you code it in Java, in which case you cannot make it an EXE, because it's not how Java works.
2. Look up JDGUI.
« Last Edit: November 21, 2012, 01:42:03 pm by Kulverstukas »

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #13 on: November 21, 2012, 04:30:02 pm »
1. EXE's are for compiled languages. Netbeans support a lot of languages because it's an IDE. I assume you code it in Java, in which case you cannot make it an EXE, because it's not how Java works.

There are compilers that comile java code into maschine code,like the aot-comiler gcj
More about gcj: http://gcc.gnu.org/java/
« Last Edit: November 21, 2012, 04:30:31 pm by Area_13 »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: [Problem] How to extract the source code of any program
« Reply #14 on: November 24, 2012, 11:52:05 am »
I am developing a facebook hacker(ya, I know its totally for making noobs fool) in NetBeans. I want to ask how can I make it a exe file?
And one thing also, how can we get source code of JAVA programs?

It is possible to create .exe files of Java programs, but not recommended. Java's strenght is its portability. Why would you want to destroy it by turning it to an .exe file?
If you don't care about portability use another language.

Here is a tool for creating .exe out of .jar files: http://www.jar2exe.com/

Here is a decompiler for Java bytecode (so you get .java files out of .class files): http://www.varaneckas.com/jad/