Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 5th, 2007, 7:35 PM   #1
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Java Decompiler..

I found a website with a java applet that I liked a lot, so I searched "download.com" and within seconds found a java decompiler.

While this is a good thing, it also worries me. I have a Java project which I hope to put up soon. I have a lot of code which I don't want people viewing. So is there anyway to make this a little harder for people to view?

The only thing I can think of is encrypting the .class file. But then again, they'll be able to decompile my java decrypter as they can with my project.

It really doesn't seem like there's anything I can do (besides not posting it online).

I understand if there's no bullet-proof solution. However, what technique can I use to make it harder to view my code, Any ideas?
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
Old Mar 5th, 2007, 9:31 PM   #2
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 3 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
Natively compile the Java program.
http://www.ej-technologies.com/produ.../overview.html

That's the only thing that comes to mind man!
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Mar 6th, 2007, 9:15 AM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
How about obfuscation?
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Mar 6th, 2007, 11:10 AM   #4
pegasus001
Hobbyist Programmer
 
pegasus001's Avatar
 
Join Date: Nov 2006
Location: 163H
Posts: 213
Rep Power: 2 pegasus001 is on a distinguished road
It works with C# pretty well though but i havent heard of it used with java. Or anything of the kind.
__________________
You never test the depth of a river with both feet.
The believer is happy. The doubter is wise.
Free speech carries with it some freedom to listen.
The next generation will always surpass the previous one. It`s one of the never ending cycles of life.
pegasus001 is offline   Reply With Quote
Old Mar 6th, 2007, 11:55 AM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Obfuscation:
Quote:
Originally Posted by scmad.gayanb.com/j2me-glossary1.php
Obfuscation, in general, describes a practice that is used to intentionally make something more difficult to understand.

In a programming context, it means to make code harder to understand or read, generally for privacy or security purposes. A tool called an obfuscator is sometimes used to convert a straight-forward program into one that works the same way but is much harder to understand.

C, C++ and Perl are among the languages usually considered to lend themselves to obfuscation. Java byte code is easy to decompile and thus vulnerable to reverse engineering. The code is often obfuscated to protect it from such an attack. Deobfuscation techniques, such as program slicing, are sometimes employed to reverse engineer obfuscation.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 6th, 2007, 12:57 PM   #6
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Obfuscation wouldn't make it "harder to view", only harder to understand. It is also not 100%, but in most cases, it is likely to cause enough confusion for the other person to abandon their efforts.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Mar 6th, 2007, 2:35 PM   #7
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 3 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
I don't think decompilers translate "exactly" what someone wrote or am I wrong?
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Mar 6th, 2007, 3:06 PM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Not really, and certainly not well, if a lot of extraneous information (symbols, etc.) weren't available in the file set one was decompiling. Imagine that you are presented with the assembly language,
ld a, 0x4357fb
add a, 1 
st 0x4357fb,a
That could have been generated by C, say, as "count += 1;", or by some other language as "day = day + 1;". This is the sort of thing a decompiler is faced with if code is compiled straight to an executable without benefit of having symbols and other debugging information passed along.

Furthermore, in simple embedded systems, particularly, data might be sandwiched right in with code. The data might be binary numbers, or a floating point representation, or text, or anything else. It still might occur in patterns that could be interpreted as a sequence of instructions.

Reverse engineering of non-trivial material, to be effective, takes as much information as one might dredge up, and a lot of competent human interpretation.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 6th, 2007, 11:22 PM   #9
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Quote:
Originally Posted by reggaeton_king View Post
I don't think decompilers translate "exactly" what someone wrote or am I wrong?
Well as a test I used a ".java" file and a ".class" file to see the difference between them. First off, it seems like the comments are stripped out of the code when decompiled. Second, functions are not in the same order as they were in the original code. **BUT** You can basically get back everything else you've written (with a different variation to how you accomplished the design of your program).

NOTE: USED "CAVAJ Java Decompiler"

ORIGINAL SOURCE: ".java" file

/**
 * Contains radio boxes, labels, textBoxes, comboBox, checkBoxes, textFields
        and actionListener. Done by Placing all components on a JPanel. Once done, places all
        JPanels on GridLayout().
 */
import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
public class Survey extends JFrame implements ActionListener
{
        JScrollPane scrFeedBack; // scroll bar for txtFeedBack
        JTextArea txtFeedBack; // text area for comments
        
        public Survey()
        {
                super("Health Awareness Survey");
                
                //Place first Question
                JLabel lblSleep = new JLabel("3: On average how many hours of sleep do you get per night?");
                JComboBox cmbSleep = new JComboBox();
                cmbSleep.addItem("3-5 hours");
                cmbSleep.addItem("5-6 hours");
                cmbSleep.addItem("6-7 hours");
                cmbSleep.addItem("7-8 hours");
                cmbSleep.addItem("> 9 hours");
                cmbSleep.setEditable(false); // so user can't mess with the data
                cmbSleep.setMaximumRowCount(3);
                
                //adds the basic label + the comboBox
                FlowLayout flowSleep = new FlowLayout(FlowLayout.LEFT,0,0); 
                JPanel pnlSleep = new JPanel(flowSleep);
                pnlSleep.add(lblSleep);
                pnlSleep.add(cmbSleep);
                
                // Second Question
                JLabel lblFood = new JLabel ("4. How many items of junk food do you consume per week?");
                JRadioButton opt0Items = new JRadioButton("0-5 Items");
                JRadioButton opt5Items = new JRadioButton("5-10 Items");
                JRadioButton opt10Items = new JRadioButton("10-15 Items");
                
                // create a button group for the radio buttons (so that you can only select 1 at a time)
                ButtonGroup grpItems = new ButtonGroup();
                grpItems.add(opt0Items);
                grpItems.add(opt5Items);
                grpItems.add(opt10Items);
                
                FlowLayout flowItems = new FlowLayout(FlowLayout.LEFT, 1,0); // adds to the visuals ;)
                JPanel pnlItems = new JPanel(flowItems);
                pnlItems.add(lblFood); // adding labels and optionBoxes to the Panel
                pnlItems.add(opt0Items);
                pnlItems.add(opt5Items);
                pnlItems.add(opt10Items);
                
                                
                //Third Question
                JCheckBox chkHealthy = new JCheckBox("2. Is the majority of food you eat healthy?", false);
                JLabel lblStatus = new JLabel("5: At what time(s) of the days do you brush your teeth?");
                JCheckBox chkMorning = new JCheckBox ("1. Morning "); // creats a CheckBox 
                JCheckBox chkLunch = new JCheckBox ("2. Lunch "); // that isn't a family with the 
                JCheckBox chkNight = new JCheckBox ("3. Night"); // other ones
                
                // panel that will hold all the CheckBox components + the label
                FlowLayout flowTeeth = new FlowLayout(FlowLayout.LEFT, 1,0);
                JPanel pnlTeeth = new JPanel(flowItems);
                pnlTeeth.add(lblStatus);
                pnlTeeth.add(chkMorning);
                pnlTeeth.add(chkLunch);
                pnlTeeth.add(chkNight);
                
                //Fourth Question
                JLabel lblFav = new JLabel("1. What is your favorite food?");
                JTextField txtFav = new JTextField(25);
                txtFav.setToolTipText("Enter your favorite food");
                
                //adds fourth question to the JPanel for later use
                FlowLayout flowFood = new FlowLayout(FlowLayout.LEFT, 1,0);
                JPanel pnlFav = new JPanel(flowFood);
                pnlFav.add(lblFav);
                pnlFav.add(txtFav);
                
        
                JLabel lblDrinks = new JLabel ("6. What do you usually drink in the morning?");
                String[] strDrink = {"Orange", "Juice", "Milk", "Coffee", "Tea", "Other", "can't remember"};
                JList drink = new JList(strDrink);
                // set how much space the list takes up
                drink.setVisibleRowCount(2);
                JScrollPane scrDrinks = new JScrollPane(drink, ScrollPaneConstants.
                        VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
                
                // Label + box goes in the panel
                FlowLayout flowDrinks = new FlowLayout(FlowLayout.LEFT, 1,0);
                JPanel pnlDrinks = new JPanel(flowDrinks);
                pnlDrinks.add(lblDrinks);
                pnlDrinks.add(scrDrinks);
                
                // ALL THE COMPONENTS ABOVE, get added to the main layout here
                JPanel pnlFields = new JPanel(new GridLayout(5, 1));
                pnlFields.add(pnlFav); 
                pnlFields.add(pnlSleep);
                pnlFields.add(pnlItems);
                pnlFields.add(pnlTeeth);
                pnlFields.add(pnlDrinks);
                pnlFav.add(chkHealthy);
                
                //Comment Box + Button
                JLabel lblFeedBack = new JLabel("Before you submit form, please take a moment to enter any feedback you'd like to give us");
                
                // uses HTML code to produce a line ;)
                lblFeedBack.setText("<html><hr>Before you submit form, please take<br> a moment to to enter any feedback you <br> would like to give us</html>");
                lblFeedBack.setSize(10, 4);
                txtFeedBack = new JTextArea(4, 30); // creating a textbox 
                txtFeedBack.setLineWrap(true); // so that the text goes to next line when full
                txtFeedBack.setWrapStyleWord(true);  
                txtFeedBack.setToolTipText("Enter your (Questions/Problems) here");
                scrFeedBack = new JScrollPane(txtFeedBack, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, 
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
                JPanel pnlAddress = new JPanel(new BorderLayout());
                pnlAddress.add(lblFeedBack, BorderLayout.CENTER);

                JButton cmdSubmit = new JButton("Submit");
                JButton cmdReset = new JButton("Reset");
                JButton cmdExit = new JButton("Exit");
                
                
                
                cmdSubmit.setMnemonic(KeyEvent.VK_G);// G instead of S, incase people think 'S = save'
                cmdSubmit.setToolTipText("Click here to submit form");
                
                cmdReset.setMnemonic(KeyEvent.VK_R); // hotkey for 'r'
                cmdReset.setToolTipText("Click here to reset form");
                
                cmdExit.setMnemonic(KeyEvent.VK_E); // adds hotkeys 'e'
                cmdExit.setToolTipText("Click here to exit the program.");
                
                JPanel pnlButtons = new JPanel(new GridLayout(1,0));
                pnlButtons.add(cmdSubmit);
                pnlButtons.add(cmdReset);
                pnlButtons.add(cmdExit);

                JPanel pnlFeedBack = new JPanel(new BorderLayout());
                pnlFeedBack.add(pnlButtons, BorderLayout.SOUTH);
                pnlFeedBack.add(scrFeedBack, BorderLayout.CENTER);
                pnlFeedBack.add(lblFeedBack, BorderLayout.NORTH);

                Container pane = this.getContentPane();
                pane.setLayout(new BorderLayout());
                pane.add(pnlFeedBack, BorderLayout.SOUTH);
                pane.add(pnlFields, BorderLayout.CENTER);       
                
//              Action listeners
                cmdSubmit.addActionListener(this);
                cmdExit.addActionListener(this);
                cmdReset.addActionListener(this);
                
                //final configurations
                this.pack();
                this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                this.setVisible(true);
                this.setSize (350, 500);
                
        }
        
        /*
         * Performs tasks based on buttons pressed
         */
        /**
         * The Action Listener, takes in an ActionEvent.  
         */
        public void actionPerformed(ActionEvent evt)
        {
                Object source = evt.getSource();
        }

FROM ".class" file decompiled

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.EventObject;
import javax.swing.*;

public class Survey extends JFrame
    implements ActionListener
{

    JScrollPane scrFeedBack;
    JTextArea txtFeedBack;

    public void actionPerformed(ActionEvent actionevent)
    {
        Object obj = actionevent.getSource();
    }

    public Survey()
    {
        super("Health Awareness Survey");
        JLabel jlabel = new JLabel("3: On average how many hours of sleep do you get per night?");
        JComboBox jcombobox = new JComboBox();
        jcombobox.addItem("3-5 hours");
        jcombobox.addItem("5-6 hours");
        jcombobox.addItem("6-7 hours");
        jcombobox.addItem("7-8 hours");
        jcombobox.addItem("> 9 hours");
        jcombobox.setEditable(false);
        jcombobox.setMaximumRowCount(3);
        FlowLayout flowlayout = new FlowLayout(0, 0, 0);
        JPanel jpanel = new JPanel(flowlayout);
        jpanel.add(jlabel);
        jpanel.add(jcombobox);
        JLabel jlabel1 = new JLabel("4. How many items of junk food do you consume per week?");
        JRadioButton jradiobutton = new JRadioButton("0-5 Items");
        JRadioButton jradiobutton1 = new JRadioButton("5-10 Items");
        JRadioButton jradiobutton2 = new JRadioButton("10-15 Items");
        ButtonGroup buttongroup = new ButtonGroup();
        buttongroup.add(jradiobutton);
        buttongroup.add(jradiobutton1);
        buttongroup.add(jradiobutton2);
        FlowLayout flowlayout1 = new FlowLayout(0, 1, 0);
        JPanel jpanel1 = new JPanel(flowlayout1);
        jpanel1.add(jlabel1);
        jpanel1.add(jradiobutton);
        jpanel1.add(jradiobutton1);
        jpanel1.add(jradiobutton2);
        JCheckBox jcheckbox = new JCheckBox("2. Is the majority of food you eat healthy?", false);
        JLabel jlabel2 = new JLabel("5: At what time(s) of the days do you brush your teeth?");
        JCheckBox jcheckbox1 = new JCheckBox("1. Morning ");
        JCheckBox jcheckbox2 = new JCheckBox("2. Lunch ");
        JCheckBox jcheckbox3 = new JCheckBox("3. Night");
        FlowLayout flowlayout2 = new FlowLayout(0, 1, 0);
        JPanel jpanel2 = new JPanel(flowlayout1);
        jpanel2.add(jlabel2);
        jpanel2.add(jcheckbox1);
        jpanel2.add(jcheckbox2);
        jpanel2.add(jcheckbox3);
        JLabel jlabel3 = new JLabel("1. What is your favorite food?");
        JTextField jtextfield = new JTextField(25);
        jtextfield.setToolTipText("Enter your favorite food");
        FlowLayout flowlayout3 = new FlowLayout(0, 1, 0);
        JPanel jpanel3 = new JPanel(flowlayout3);
        jpanel3.add(jlabel3);
        jpanel3.add(jtextfield);
        JLabel jlabel4 = new JLabel("6. What do you usually drink in the morning?");
        String as[] = {
            "Orange", "Juice", "Milk", "Coffee", "Tea", "Other", "can't remember"
        };
        JList jlist = new JList(as);
        jlist.setVisibleRowCount(2);
        JScrollPane jscrollpane = new JScrollPane(jlist, 20, 31);
        FlowLayout flowlayout4 = new FlowLayout(0, 1, 0);
        JPanel jpanel4 = new JPanel(flowlayout4);
        jpanel4.add(jlabel4);
        jpanel4.add(jscrollpane);
        JPanel jpanel5 = new JPanel(new GridLayout(5, 1));
        jpanel5.add(jpanel3);
        jpanel5.add(jpanel);
        jpanel5.add(jpanel1);
        jpanel5.add(jpanel2);
        jpanel5.add(jpanel4);
        jpanel3.add(jcheckbox);
        JLabel jlabel5 = new JLabel("Before you submit form, please take a moment to enter any feedback you'd like to" +
" give us"
);
        jlabel5.setText("<html><hr>Before you submit form, please take<br> a moment to to enter any feedb" +
"ack you <br> would like to give us</html>"
);
        jlabel5.setSize(10, 4);
        txtFeedBack = new JTextArea(4, 30);
        txtFeedBack.setLineWrap(true);
        txtFeedBack.setWrapStyleWord(true);
        txtFeedBack.setToolTipText("Enter your (Questions/Problems) here");
        scrFeedBack = new JScrollPane(txtFeedBack, 22, 31);
        JPanel jpanel6 = new JPanel(new BorderLayout());
        jpanel6.add(jlabel5, "Center");
        JButton jbutton = new JButton("Submit");
        JButton jbutton1 = new JButton("Reset");
        JButton jbutton2 = new JButton("Exit");
        jbutton.setMnemonic(71);
        jbutton.setToolTipText("Click here to submit form");
        jbutton1.setMnemonic(82);
        jbutton1.setToolTipText("Click here to reset form");
        jbutton2.setMnemonic(69);
        jbutton2.setToolTipText("Click here to exit the program.");
        JPanel jpanel7 = new JPanel(new GridLayout(1, 0));
        jpanel7.add(jbutton);
        jpanel7.add(jbutton1);
        jpanel7.add(jbutton2);
        JPanel jpanel8 = new JPanel(new BorderLayout());
        jpanel8.add(jpanel7, "South");
        jpanel8.add(scrFeedBack, "Center");
        jpanel8.add(jlabel5, "North");
        Container container = getContentPane();
        container.setLayout(new BorderLayout());
        container.add(jpanel8, "South");
        container.add(jpanel5, "Center");
        jbutton.addActionListener(this);
        jbutton2.addActionListener(this);
        jbutton1.addActionListener(this);
        pack();
        setDefaultCloseOperation(3);
        setVisible(true);
        setSize(350, 500);
    }
}
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
Old Nov 27th, 2007, 8:31 AM   #10
casesensitive
Programmer
 
Join Date: Oct 2007
Posts: 32
Rep Power: 0 casesensitive is on a distinguished road
Re: Java Decompiler..

Sorry Dawei but this was the dead post I meant to resurrect to begin with. http://www.chainkey.com/en/prod.htm
casesensitive is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming with Java: Tutorial ReggaetonKing Java 7 May 20th, 2008 10:58 AM
Special browser in Java (Project) stalefish Java 3 Feb 9th, 2008 4:22 PM
First Java Program duale2005 Java 3 May 22nd, 2006 5:17 PM
Java programmers, game developers, artists, be ware! RPG game team is recruiting! atcomputers.us Paid Job Offers 7 Sep 25th, 2005 7:25 PM
JAVA and C#??? java_roshan C# 6 Apr 13th, 2005 10:18 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:45 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC