• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Is there a way to view the source code of programs?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Methal

Member
Joined
Aug 5, 2008
Location
DC
I've got about a year (lol a whole year) programing experience. What I would like to know is if there is a program, such as n++ but more indepth, that will allow me to see the actual coding behind the "pictures" or "gui" of other programs.

I know there are some that are illegal to mess with, and frankly those would be to large and complex to be of any real interest to me, But there are others like free downloadable things, such as malware, and other programs that are said to be "safe" by the creators, but in fact are malicious in nature.

What I would like to be able to do, and this is purely educational is see what they do before installing them, or running them.

I used to have a junker computer that wasn't connected to a network or internet that I would run such things on to find out what they did before trying them on my main rig.

I hate surprises especially when computers are involved.

any ideas?
 
of course there are... just depends on what program you want to mess with.

your key is the file extension... like .exe, .dat, .bin or whatever.the extension determines what program you need to examine it.
 
its a .exe program.

I've found programs that open it like N++ but its all a garbled mess. And then a program called HxD that shoes me the machine language, not very helpful.

Looking for something that shows the actual code the writer used.
 
Last edited:
http://legroom.net/software/uniextract

that's where you start... it will unbundle the .exe for you, so you can see the files that are bundled into it.


I don't think this is what the OP is looking for... If it's a binary executable, this program will do nothing.

Methal: If the program is a compiled binary executable (most *.exe program files), then the closest you'll possibly get to the source code is by running it through a disassembler and looking at the optimized assembly code. This is most likely completely unintelligible, since there won't be any comments and much of the high-level structure will have been optimized away by the assembler during compilation.

If the program is open-source, then you can just download the source code, obviously. If it's not, then you're out of luck.
 
hmmm...Feel like I'm missing like 9 steps in here somewhere. I always though that the .exe IS the program, and the source code was encrypted or something.

Guess I need to start at learning what an exe is.

The program I am looking at requires some info I am hesitant to give. I would like to see where, if anywhere it is sending my personal info.
 
hmmm...Feel like I'm missing like 9 steps in here somewhere. I always though that the .exe IS the program, and the source code was encrypted or something.

Guess I need to start at learning what an exe is.

The program I am looking at requires some info I am hesitant to give. I would like to see where, if anywhere it is sending my personal info.

An executable file is machine code, not source code. Look into what a Compiler does, and perhaps it will make more sense. In essence, you program in some language (let's say C), then you run it through a compiler, which translates your source code into binary machine code that can be loaded into memory and fed into a CPU as instructions.
 
I don't think this is what the OP is looking for... If it's a binary executable, this program will do nothing.

Methal: If the program is a compiled binary executable (most *.exe program files), then the closest you'll possibly get to the source code is by running it through a disassembler and looking at the optimized assembly code. This is most likely completely unintelligible, since there won't be any comments and much of the high-level structure will have been optimized away by the assembler during compilation.

If the program is open-source, then you can just download the source code, obviously. If it's not, then you're out of luck.

QFT, after reading the first post this is the answer I was hoping to find. And I did. :)

Compiled languages can be disassembled, but it isn't like the code used to actually write the program. Your best bet, from a novice programming standpoint, is learning more by working with open source... To check out a particular compiled exe however, you are unlikely to find what you want, and you'd be developing a completely new skill in trying to read it.

Solid snake explained it well - if you understand what a compiler is and does very well, you will understand the situation better and not feel like you are missing 9 steps. Basically when you code you have a very nice human readable "if this, then do x, y, z". Once compiled, the human readability is trashed, and the compiler interprets those instructions and constructs them in the most efficient way it can for the computer to do what you told it to.
 
Once compiled, the human readability is trashed, and the compiler interprets those instructions and constructs them in the most efficient way it can for the computer to do what you told it to.

Not necessarily. Anything written in Java or .Net is bytecode, which is easily decompiled back to its source (not a disassembly). Granted comments will be gone, but even if function names are obfuscated, strings can't be, so you should be able to decipher things.

For Java: http://java.decompiler.free.fr/
For .Net: http://www.jetbrains.com/decompiler/
 
A lot of the older Visual Basic stuff could be decompiled too. Don't know about more recent stuff.

I think it's mostly a question of how compiled it was in the first place, java "compiling" doesn't go very deep, while GCC and such compiles the hell out of things.

That's my understanding anyway, the only thing I'm really familiar with are microcontrollers. In the MCU world once it's compiled you're out of luck, even if you can get it back out (you can usually burn a fuse, after which the MCU will either flat refuse to communicate anymore or refuse to send anything) assembly is the best you're going to end up with.
 
Not necessarily. Anything written in Java or .Net is bytecode, which is easily decompiled back to its source (not a disassembly). Granted comments will be gone, but even if function names are obfuscated, strings can't be, so you should be able to decipher things.

For Java: http://java.decompiler.free.fr/
For .Net: http://www.jetbrains.com/decompiler/

I can't believe I forgot how damn near everything is JIT nowadays! Especially since I spent my summer/winter developing a C# application. :bang head:bang head

For fun, I ran my C# application through the JetBrains decompiler. I was quite surprised with the results! The code is more-or-less readable, but the organization is understandably off. I find it very interesting how it renamed variables the way it did. In the following code snippets (an autofocus algorithm for a camera mounted on a motor), the left is the "disassembly," and the right is the actual source code. Quite interesting, to say the least! Before anyone hassles me for bad code/practices/etc... I'm an EE, not a software engineer. I learned everything about this on the fly... this was the first application I had ever done. It's a GUI that deals with control of a motor controller, a microcontroller to control an LED, and a live video feed from a camera, which requires all sorts of things that I had no idea how to deal with until I came across problems (multithreading issues like accessing objects from multiple threads, or locking the GUI up because I'm a noob and didn't know to run the UI in a separate thread from any processing, etc). The program works, that's all that matters in engineering internships! xD

disassembly1.png
disassembly2.png
 
Last edited:
A lot of the older Visual Basic stuff could be decompiled too. Don't know about more recent stuff.

I think it's mostly a question of how compiled it was in the first place, java "compiling" doesn't go very deep, while GCC and such compiles the hell out of things.

That's my understanding anyway, the only thing I'm really familiar with are microcontrollers. In the MCU world once it's compiled you're out of luck, even if you can get it back out (you can usually burn a fuse, after which the MCU will either flat refuse to communicate anymore or refuse to send anything) assembly is the best you're going to end up with.

Or rather, what it's compiled to. Some applications are compiled to machine code which results in a binary that is restricted to running on a cpu that supports the specific commands. Others such as Java are compiled to byte-code which can not in itself be run on any CPU. The java runtime translates the bytecode to machine code for the platform it's on, so the end result is similar, only with java the machine code is created by the runtime "on the fly".

Both have their advantages. Applications that are immediately compiled to machine code can only be executed on a platform supporting those commands, with any system libraries it was linked to. Applications such as java can be run on any platform with the runtime as it will just generate machine code for the platform it's on.

Naturally java will have more overhead, but getting support for a new CPU instruction set can theoretically be gained by just updating the runtime and changing nothing in the application (in reality you might have to update the runtime so much that the application will also have to have some fixes) while a lower level application will need to be recompiled.
 
The program was written in .net and with the help of dotpeek I have learned that its a complete scam.

All this program does is throw up a bunch of "blank" fields except two. Account name and password. If you fill out these it sends the prgrammer an email to his Gmail account with the header of "derpaherpa" and includes in it whatever you entered into those two fields.

The program does Nothing else =D

Going to keep looking into this kind of thing. needless to say I'm intrigued with what I have learned.
 
looks like it also uses your webcam to plant something into your system. could be reading it wrong... but since a lot of bugs use the webcam as their point of entry... I'm sure there is something else in the program.
 
The program was written in .net and with the help of dotpeek I have learned that its a complete scam.

All this program does is throw up a bunch of "blank" fields except two. Account name and password. If you fill out these it sends the prgrammer an email to his Gmail account with the header of "derpaherpa" and includes in it whatever you entered into those two fields.

The program does Nothing else =D

Going to keep looking into this kind of thing. needless to say I'm intrigued with what I have learned.

That's worth reporting to the authorities IMO, that's beyond a simple scam into straight up malware and identity theft.
 
That's worth reporting to the authorities IMO, that's beyond a simple scam into straight up malware and identity theft.

Yep I did. His videos are no longer on youtube, and his DL site has dropped him. =D
 
I was thinking a bit higher authorities of the sort that'll knock on his door and talk to him about Miranda. :p
 
Back