Can all applications be decompiled? [duplicate] - decompiling

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
What types of executables can be decompiled?
It's pretty popular to decompile the Minecraft classes to edit and add your own mods. Is every Java application decompilable? Does it stop at Java applications?
I'm a little concerned about this, but no one else seems to be so maybe I just don't understand. What's stopping people decompiling Microsoft Word and making their own custom changes? Or decompiling World of Warcraft and stealing interesting bits of their code?

Byte code (as java and c# get compiled into) can easily be decompiled. There are ways around it as in obfuscation and other alternatives. C and C++ get compiled into native machine code, and is difficult to "decompile". But someone with the correct skillset could be able to reverse engineer it anyway.
Edit: Note that obfuscation will not make it harder to decompile the byte code - it will be just as easy, but the code will be harder to make any sense of.

Related

How can I protect my C++ application from being decompiled? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
C#: How to Make it Harder for Hacker/Cracker to Get Around or Bypass the Licensing Check?
Protect C++ program against decompiling
How can I protect my visual C++ windows form application from being decompiled?
Is there a way?
Thanks guys !
If you want to protect it to a certain point from decompilation you can always use some protection software like an obfuscator or encrypter.
There is a vast number of products that can do this varying in price (from free to very expensive), complexity and implementation.
You might want to check http://www.safenet-inc.com/.

Guidance on broadening horizons

Let me setup my question with some info. I'm not in college yet and strictly a hobby programmer. Probably a little more than 2 years ago I got started programming on mac. I started with very simplistic GUI examples with Cocoa and XCode. Long story short, I learned from the top down, first learning objective-c, then venturing into more "low-level" projects where I became better at basic C and even used a few C++ libraries in my existing projects.
What I'm saying is that I've never really done anything outside of an XCode project and occasional iPhone project. I've implemented lots of stuff, algorithms, math, etc. but all within that environment. I look at the world of programming and there is so much out there that's not necessarily a standalone application. It seems to me that the hardest thing is finding out where to start; how to setup the environment. I guess I'm wondering if anyone has any suggestions, projects, tutorials, maybe on setting up environments for different languages on different systems. Web programming, java applets? etc.
On the note of environments, I would be interested in knowing on a more basic level what makes a "development environment." To my basic knowledge, an "environment" combines the language, with the compiler that interprets that language, and contains libraries that provide an API for the language, where the compiled product runs on a certain system. This is my basic concept, but again, I'm here.
Sorry if this question... well... combines too many questions, but any input or guidance is welcome. Thanks in advance for any replies!
Not sure if I understood your question correctly or if this will help you, but here are my (relative newbie) thoughts and rambling:
I've done Java at uni in two different courses, one where we wrote the code in Notepad and then compiled it in command line, in some dubious DOS application, and then two years later when we worked in NetBeans and while NetBeans was a lot better and easier, I learned a lot and was a lot more careful when writing code after the Notepad experience (especially after waiting for several minutes for a compile only to see a message caused by a silly bug).
If you can choose between IDEs, I would read on different blogs, see what people prefer and why and make a choice. The problem is that most of the time, both at uni and at work, you can't choose and have to go with the teachers/managers choose, and make the best of it.
It seems to me that the hardest thing is finding out where to start; how to setup the environment.
I think it would be easiest if you found something that you want to do, and then take small steps and get bits done. I work as a desktop app developer and 3 years ago I set up a wordpress blog for a friend and imported posts and comments from a different blogging platform, with minimal knowledge about everything involved. I started with things that were already done by others and learned how to use them and then slowly tried to fill in the gaps - the comments part wasn't done then, so I had to learn about databases, how I could see them and then write the code that inserted in them, etc.
What I'm trying to say is that if you find something to do (and if you don't have ideas for projects, you can find several posts with ideas here, on SO) and then set goals towards doing that, even if you don't finish it, or your studying takes you in areas you hadn't expected, it will all be useful at some point.
I guess I'm wondering if anyone has any suggestions, projects, tutorials, maybe on setting up environments for different languages on different systems. Web programming, java applets? etc.
This is way too broad a question. If you're doing web programming, you need to set up a web programming environment. At a minimum, you would need an HTTP server. You'd probably also need a relational database. The rest of the web environment would be language dependent.
If you're doing GUI programmng, you would need access to the device or devices (iPhone, Android, etc.) that you want to write programs for.
To my basic knowledge, an "environment" combines the language, with the compiler that interprets that language, and contains libraries that provide an API for the language, where the compiled product runs on a certain system.
That gets you started, yes. You'd want an integrated development environment to write the code. Again, you'd probably need a relational or object oriented database. The rest of the development environment is language dependent.

What languages should a microISV use to write commercial software? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I've been writing software in Java for many years now, but it was always for internal applications that would be deployed to a server. I'd like to get into writing desktop applications now but I don't know where to start. I've written a few Java/Swing applications but again they were for internal use.
My understanding is that Java and other semi-compiled and interpreted languages are too easy to reverse engineer, making them unsuitable for commercial software. I am aware that there are compilers for Java and some other interpreted language, but I've also heard that they are pricey and/or unreliable.
Assuming I start a microISV and wish to develop and sell applications to a broad audience, what's my best bet? I would prefer something that can be written close to once, and compiled for different operating systems but I am not opposed to .NET and a Windows-only audience if other languages would compromise the experience (installation ease & user experience) in Windows. My only issue there is that I don't have a large starting budget and paying out the wazoo for the required development tools is not really in the cards.
Why would people want to reverse engineer your software? They might pirate it, but you can't prevent pirating no matter what language you use. I doubt you have a top-secret algorithm that you're trying to hide either, in which case reverse-engineering might be an issue.
You should go with whatever you know best, and Java can work just fine.
If you are intent on switching to another language, I recommend taking a look at Qt. Qt is a free and open-source cross-platform toolkit for C++ that allows you to write applications in that will compile and run on Windows, Mac, and Linux with minimal effort. You CAN write commercial software for free with Qt with its LGPL license.
Edit: GCJ compiles Java to native code, but only supports Java 1.4.
Well, if you're trying to be an Independent Service Vendor -- and not a Software Vendor -- then in a sense it doesn't matter if you use a language like Java which can be decompiled. Because you'd be selling yourself as the best person to integrate and customize the software for your clients. The software is the delivery mechanism for the thing that will actually make you the money: you and your skills. Plenty of companies make a profit by giving away their software for free and contracting their services to set it up for their clients. You can mitigate the Java decompiling issue somewhat by using an obfuscator, but it's kind of fighting the wrong battle.
If you intent to make your money selling software and not service, then Java would be a relatively risky route to take.
It all depends on your business plan.
If you are starting a one-man company, then you are selling your personal expertise. So the language you use must be the one (or maybe two) that you are most familiar with and expert in. I'm surprised you felt it necessary to ask this.
Any code can be decompiled to some degree. I think you can obfuscate Java to a degree that will deter the casual user... but I think the other people hit the nail on the head. Of all the reasons not to use Java, the ease of decompiling should be very very low on your list. If that is all that is stopping you, go for it! Google Java obfuscater and you will find something.
I'm skeptical about the risk of reverse engineering a complex piece of software written in Java, but for purposes of your question I'm willing to stipulate it. I assume the same issues rule out any other language that is implemented only on the JVM.
The most salient aspects of Java are
Static type system
Class-based object system
Automatic memory management
No freestanding functions or modules outside the class/interface system
Generics
This combination could be replicated in a language like C#, but I assume the same objections you have about distributing JVM bytecode also apply to MSIL bytecodes.
I'm having a hard time coming up with a language that has all these features. Here are some nearby languages:
C++ has everything except automatic memory management, plus it allows freestanding functions. However the C++ generic mechanism (templates) is not for the faint of heart, and it doesn't (yet) support modular typechecking. Lots more flexibility than Java but also lots more ways to shoot your foot off. Use with caution.
Modula-3 has all of the above but it's essentially a dead language, plus like C++ there's no modular type checking for the generics.
I'm not familiar enough with Eiffel to be able to make good comparisons, but I think it's worth looking into.
Delphi may also be worth looking into. It seems to have everything above except generics. It's primarily a proprietary Windows environment (formerly known as Object Pascal), but there seems to exist an open-source 'Free Pascal' compiler that supports Delphi.
There are many object-oriented languages with automatic memory management and dynamic typing, among which one might highlight ruby, Python, and Smalltalk. None of these really compiles well and reliably to standalone native machine code, although all push toward some form of experimental compilation. And they are all dynamically typed, which is quite different from what you're used to.
If I were in your position I would probably go ahead an use Java and accept some risk of reverse engineering. Decompilers aren't as wonderful as you might think, and they don't produce wildly maintainable code, either. But if you really want to be able to produce native machine code, I would investigate Delphi and Eiffel. (I myself would use Modula-3, but that's because I once invested substantial effort in learning it. It's a very well designed language for its niche, but the user community is about gone and I think it's a dead letter. Pity.)

First programming language after web development? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've been thinking of making a desktop program but I have no experience in that. I've been programming in PHP, ASP and JavaScript before. Java seems to be nice since you can run it on all OS. But what I really want is result, I do not really care what language makes me a good programmer (I'll take that later in college :P). I've tried both C# and Python before but it was only console applications.
So, what programming language do you recommend to me?
If you want Windows results, C#. If you want cross-platform results, Python.
You could also just pick randomly. Or you could try them all. Or look at the 16 trillion previous questions on this exact same topic.
UPDATE:
To find those questions, I mentioned, try some Google fun:
"what language" OR "which language" learn site:stackoverflow.com
My personal bias would be towards learning functional programming (Scala or even lisp would be nice). But, honestly, any language could improve your skills pretty dramatically at this point. Just take a look at a few of the mainstream ones, and pick the one that suits your interest the best.
For some ideas (not in any particular order):
C - Learning the low-level details of memory allocation can be useful background. If you use Linux, there's tons of sample code in Gnome apps to show you how to write reasonably elegant code in the language.
C++ - C on steroids... there's lots of complexity here if you want to learn it, but it can also be a great language to have in your arsenal.
C#/Java - Nice, high-level, reasonably portable languages. I prefer the C# language over Java, but there are advantages and disadvantages to each (Java portability is better). In the end its just a matter of preference, and external factors (legacy codebases may swing you one way or the other).
Scala - Java on Steroids - Really nice language, but the learning curve can be a bit steep, IMO.
Python/Ruby/Lisp/etc - Nice scripting languages, most of which are easy to learn, and all of which will lead to new ways of thinking about problems.
Honestly, in the end, the most important rule is just to have fun. Look through the basic "hello world" tutorials and just pick the one that looks the most pleasant. Learning never hurts.
I've found that making desktop applications in C# / VB.NET (I'd strongly recommend the former) can be much easier than other languages, particularly with a good IDE such as Visual Studio (or the free Express editions) or Sharp Develop. It will be much easier to get it going on Windows, of course (I don't know much about Mono + WinForms), but I think the easier transition is worth the tradeoff.
Many people have been suggesting low level languages such as C, C++, but frankly I'm not certain that it would be a worthwhile investment of your time. The first programming language I learned was C, from the K&R book, but if I were to teach my son how to program today I would introduce him to python or ruby.
Both python and ruby are very expressive, sophisticated languages that are easy to learn and have an intuitive, english like syntax. By all means do learn about structured programming, and older compiled languages, but initially you'll reap more benefit from learning OO concepts in a high level language.
Java and C# are excellent languages, however they are very tightly coupled with their frameworks, and you may run the risk of getting bogged down learning a framework instead of programming fundamentals.
If you were comfortable in PHP you will feel right at home with Perl, better yet, pampered. You could even turn around and use Perl on the web with your former languages via CGI.
If GUIs is what you're after, C# is your best bet for Windows and Java for other platforms.
If you want result and GUI and you don't care if it's windows only, you probably want C#.
If you want to run on different platforms, you might check out any language on the JVM since they all have access to a pretty powerful GUI toolkit. (Jython, Groovy, Java, ...)
Don't bother with the desktop just yet. Hit the command line.
Get the K&R book and really learn C. You don't know how much you've missed out on if your background is 100% high-level (PHP, Python, Ruby, JS) web dev.
Learn the fundamentals, then raise the bar by going into C# or Objective C.
You can go easy or go hard, go fast or go slow.
Many people say C#, it's nice and can also be used on Linux through mono. On the other hand you can go with C/C++ and maybe Java. You'll have fun with C/C++, learn something and be a better programmer; but it will take time. Java is simpler but "needy". If you want the easiest way to develop a desktop application, you can go with VB or Delphi. Delphi has some advantages over VB which I'm not going to go into here.
My advice would be, if you have time, are willing, and just want to experience GUI, go from low to high, slow to fast, hard to easy. Try assembler, know C/C++, use Java, crack open C# and browse thought VB and Delphi.
In the end maybe you will not create a powerful application, but you will be prepared for college, be experienced and generally "know stuff".
For someone with HTML and Javascript skills Adobe AIR could be the way to go.
It allows you to create a desktop application using HTML/DHTML or if you are familiar with Flex you can also use Flex.
See http://www.adobe.com/products/air/
Go through K&R C. Learn C and you should have a great foundation for learning other languages.
i would say that Java would give a good introduction to desktop apps. I havent had any experience with some of the other languages mentioned here.
You can do some simple stuff in Java with very little headache, as compared to some other languages that require hundreds of lines of code.
Just depends if you have been exposed to OO programming in your web experience
Consider VB.NET (not "classic" vb!) as an easy-to-start-with high-level language that can help you get your foot in the door; then get up to speed with C# as well. The two are interchangable--VB.NET and C# are really just different dialects of .NET.
There's three things VB.NET has going for it over C# for beginner programmers:
VB.NET tends to be a more descriptive (some would say chatty) language
Where C# uses symbols VB.NET will use (slightly) more descriptive words. After a while VB.NET will probably be chatty to the point it annoys you, but by then you should be quite comfortable with .NET and switching to C# will be fairly trivial
Slightly more relaxed syntax
C# will gripe if you leave off parenthesis on method calls, and gripe if you add them to Property accessors--VB isn't quite as picky. It won't let you go haywire with bad syntax (like HTML) but it won't gripe and complain over every little detail
Better pre-compilation parsing
If you work with Visual Studio in both languages you'll notice it will show most compiler errors and warnings for VB.NET right away. C# will wait until you try to compile to tell you that there's errors in your code. The difference isn't huge (C# will warn you for most errors after a delay) but it can be a concentration buster to think you've just pulled off a method and found out it's 10 errors away from compiling (4 of which are because you left the () off a method call).
Once you learn the main features of .NET it's easy to learn the C# equivalency and transition if you want to; and at some point you might decide that VB.NET is a bit too chatty and opt for C# (pretty much what I did).
The only catch to VB.NET is that you should get in the habit of always adding two lines to the top of your code files; they'll help you out immensely in terms of not letting you do stupid things :)
Option Strict On
Option Explicit On
Here's a real short example of the "words vs. symbols"... you'll see there's not much difference other than some brackets in C# and some extra words describing what's happening in VB.NET
Option Strict On
Option Explicit On
Imports System
Imports System.Windows.Forms
<Serializable> _
Public Class MyClass
Inherits SomeBaseClass
Implements SomeInterface
Public Shared Sub DoSomething()
For each item as Object in SomeCollection
Debug.Writeline(item.ToString)
Next
End Sub
Public Sub SomeInterfaceMethod() Implements SomeInterface.SomeInterfaceMethod
MessageBox.Show("Grrblah!")
End Sub
End Class
using System;
using System.Windows.Forms;
using System.Diagnostics;
[Serializable]
public class MyClass : SomeBaseClass, SomeInterface
{
public static void DoSomething()
{
foreach(Object item in SomeCollection)
{
Debug.WriteLine(item.ToString());
}
}
public void SomeInterfaceMethod()
{
MessageBox.Show(#"Grrblah!");
}
}
Try not to fall in the 'must-be-cross-platform' trap. If you're just beginning, that shouldn't be what's on your mind. I can't speak for everyone, but I myself, and I have seen this happen to others, got caught in this early on and didn't get anywhere because I was always trying to find things that were cross platform, and just because they are cross platform doesn't mean they are the best suited for your situation, especially early on.
When you become proficient at a language, you will know how to port and make things cross platform. Don't choose something solely because it is advertised as being cross platform, despite the fact that most languages today are, don't feel the need to ignore other languages that, while not necessarily platform specific, seem to be better on certain platforms, such as C# for Windows and Objective-C for Mac, which are both great languages in my opinion.
If you want to learn something that benefits you in web development as well as in desktop development, I would go with Ruby. You can look into Ruby on Rails for web development. Ruby is also pretty cross platform and you can develop desktop applications with it. There are also various bindings, so for example you can write Mac apps with it and even have access to .Net with Iron Ruby, if need be.
Python is also a possibility.

How can I use functional programming in the real world? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Functional languages are good because they avoid bugs by eliminating state, but also because they can be easily parallelized automatically for you, without you having to worry about the thread count.
As a Win32 developer though, can I use Haskell for some DLL files of my application? And if I do, is there a real advantage that would be taken automatically for me? If so, what gives me this advantage? The compiler?
Does F# parallelize functions you write across multiple cores and CPUs automatically for you? Would you ever see the thread count in Task Manager increase?
How can I start using Haskell in a practical way, and will I really see some benefits if I do?
It seems like the book Real World Haskell is just what you're looking for. You can read it free online.
F# does not contain any magic pixie dust that will pass functions off to different CPUs or machines. F#/Haskell and other functional programming languages make it easier for you to write functions that can be processed independent of the thread or CPU they were created on.
I don't feel right posting a link here to a podcast I participate in. It seems a little off, but in the Herding Code episode, where we talked with Matt Podwysocki, we asked the same question and he gave some interesting answers. There are also a lot of good links relating to functional programming in that episode. I found one link titled "Why Functional Programming Matters". That may provide some answers for you.
This might also be interesting:
"Real World Functional Programming"
Examples are in F# and C#, but the theory is fairly generic.
From what I've read (pre-release) it is definitely interesting, but so far I think it is making me want to stick more and more with C#, using libraries like Parallel Extensions.
You didn't mention, but I'm assuming, that you're using C++. One potentially easy way to get into functional is via C++/CLI to F#. C++ contains "magic pixie dust" (called IJW: It Just Works) to allow you to call into and out of managed code. With this, calling F# code is almost as simple as it is from C#.
I've used this in one program (FreeSWITCH), which is written entirely in C/C++. With a single managed C++/CLI (use the /clr switch), it magically transitions into managed code, and from there, I can go load my F# plugins and execute them. To make things even easier for deployment, F# can statically link all its dependencies, so you don't need to deploy the F# runtime files. One other thing that makes CLR code attractive is that you can pass managed code (delegates) to C code, and the runtime automatically makes a thunk for you.
If you decide to go the Haskell way, the feature you'll be looking for is FFI: Foreign Function Interface. However, I don't think it'll give you the same level of integration as C++/CLI with F#.
I'm currently learning Haskell myself. When you start out learning it, it doesn't seem very intriguing, because the learning experience is nothing like learning a language like C#.
It's a whole new world, but I noticed I could write very very complex expressions in just a few lines of code. When I looked back at the code, it was much more concise; it was small and tight.
I'm absolutely loving it! You can indeed write real-world programs that will be smaller, easier to maintain, and much more complex than most other languages allow. I vote for you to learn it!!
Since you mention Win32 and DLLs, I presume you're working with unmanaged code. In that case, GHC will work very well for you. Late last year I wrote a DDE server under Windows using FFI to talk to the Microsoft DDE libraries, and, surprisingly, it was an extremely pleasant experience (especially given that I'm a Unix guy).
Haskell's FFI is powerful (even supporting, e.g., callbacks into Haskell functions from C or other libraries), and having Haskell's type checking when writing C-level code is like a dream come true.
That last point is one of the major advantages of Haskell: the type system is amazing. That said, it's like any powerful tool; it needs time and effort to make good use of it.
So yes, it is possible to start out writing small bits of code in Haskell that link into the rest of your code (though you may find it easier to start with small Haskell programs that link to your other code), and it's well worth spending a fair amount of time learning about this and using it wherever you can. You may end up like me, planning a fairly major project tightly integrated with Windows code (in my case, a sophisticated Excel add-in) in Haskell.

Resources