Xvolks

    Publicités

Users Who Are Viewing This Thread (Total: 0, Members: 0, Guests: 0)

D

deadvirus

Membre Banni
Dec 30, 2010
89
0
426
Je suis entrin de chercher un crak si quelqun voit une faille dans se code dit le moi :
Code:
package org.xvolks.configuration;

import com.xvolks.vg;
import com.xvolks.vj;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.configuration.*;
import org.apache.commons.configuration.tree.ConfigurationNode;
import org.apache.log4j.Logger;

public class a
{

    static final Logger a = Logger.getLogger(org/xvolks/configuration/a);
    private HierarchicalINIConfiguration b;
    private static final String c = "password";
    private String d;
    private File e;
    private final int f;
    private static final Map g = new HashMap();

    protected a(int persoId)
    {
        b = null;
        e = new File("config.ini");
        f = persoId;
    }

    public static synchronized a a(int persoId)
    {
        a conf = (a)g.get(Integer.valueOf(persoId));
        if(conf == null)
        {
            conf = new a(persoId);
            g.put(Integer.valueOf(persoId), conf);
        }
        return conf;
    }

    public static synchronized HierarchicalINIConfiguration b(int persoId)
    {
        a conf = a(persoId);
        if(conf.b == null)
        {
            try
            {
                conf.b = new HierarchicalINIConfiguration(conf.e) {

                    private static final long serialVersionUID = 0xf6acf4f517536356L;
                    private Logger a;

                    public SubnodeConfiguration getSection(String name)
                    {
                        if(name != null)
                        {
                            break MISSING_BLOCK_LABEL_48;
                        }
                        Method m;
                        m = getClass().getDeclaredMethod("getGlobalSection", new Class[0]);
                        m.setAccessible(true);
                        return (SubnodeConfiguration)m.invoke(this, new Object[0]);
                        Exception e;
                        e;
                        a.error(e, e);
                        return null;
                        return configurationAt(name);
                        IllegalArgumentException iex;
                        iex;
                        ConfigurationNode node = createNode(name);
                        node.setReference(Boolean.TRUE);
                        getRootNode().addChild(node);
                        return createSubnodeConfiguration(node, name);
                    }

            
                throws ConfigurationException
            {
                a = Logger.getLogger(getClass());
            }
                };
            }
            catch(ConfigurationException e)
            {
                a.error(e, e);
            }
        }
        return conf.b;
    }

    public String a()
    {
        String pass = b(f).getSection("user").getString("password", "");
        return new String(vg.a(pass), "UTF-8");
        UnsupportedEncodingException e;
        e;
        a.error(e, e);
        return "";
    }

    public void a(String password)
    {
        try
        {
            String pass = vg.a(password.getBytes("UTF-8"));
            b(f).getSection("user").setProperty("password", pass);
        }
        catch(UnsupportedEncodingException e)
        {
            a.error(e, e);
        }
    }

    public String b()
    {
        SubnodeConfiguration section = b(f).getSection("config");
        String key = section.getString("lang_current", "fr");
        return key;
    }

    public void c()
    {
        b(f).getSection("version").setProperty("buildType", Integer.valueOf(0));
        SubnodeConfiguration section = b(f).getSection("config");
        section.setProperty("lang_current", "fr");
        String key = section.getString("uid", "");
        if(key.equals(""))
        {
            key = vj.a();
            section.setProperty("uid", key);
            try
            {
                b(f).save();
            }
            catch(ConfigurationException e)
            {
                e.printStackTrace();
            }
        }
    }

    public void a(File selectedIniFile)
    {
        b = null;
        e = selectedIniFile;
    }

}
encor un code
Code:
package com.xvolks;

import com.ankamagames.dofus.datacenter.servers.Server;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JRootPane;
import javax.swing.border.EmptyBorder;

// Referenced classes of package com.xvolks:
//            n, rF

public class A extends JDialog
{

    private final JPanel a;
    private int b;
    private JCheckBox c;

    public static void a(String args[])
    {
        try
        {
            A dialog = new A();
            dialog.setDefaultCloseOperation(2);
            dialog.setVisible(true);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    private A()
    {
        this(((java.util.List) (new ArrayList())));
    }

    public A(java.util.List usableServers)
    {
        a = new JPanel();
        setTitle("Choisissez un serveur");
        setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
        setBounds(100, 100, 450, 300);
        getContentPane().setLayout(new BorderLayout());
        a.setBorder(new EmptyBorder(5, 5, 5, 5));
        getContentPane().add(a, "Center");
        a.setLayout(new GridLayout(0, 1, 0, 0));
        ButtonGroup group = new ButtonGroup();
        JRadioButton radioButton;
        for(Iterator iterator = usableServers.iterator(); iterator.hasNext(); group.add(radioButton))
        {
            rF gsi = (rF)iterator.next();
            radioButton = new JRadioButton((new StringBuilder(String.valueOf(gsi.a))).append(" : ").append(Server.getServerById(gsi.a).getName()).append(" (").append(gsi.b.toString()).append(")").toString());
            a.add(radioButton);
        }

        JPanel buttonPane = new JPanel();
        getContentPane().add(buttonPane, "South");
        GridBagLayout gbl_buttonPane = new GridBagLayout();
        gbl_buttonPane.columnWidths = (new int[] {
            196, 105, 49, 69, 0
        });
        gbl_buttonPane.rowHeights = (new int[] {
            25, 0
        });
        gbl_buttonPane.columnWeights = (new double[] {
            0.0D, 0.0D, 0.0D, 0.0D, 4.9406564584124654E-324D
        });
        gbl_buttonPane.rowWeights = (new double[] {
            0.0D, 4.9406564584124654E-324D
        });
        buttonPane.setLayout(gbl_buttonPane);
        c = new JCheckBox("Ne plus me poser la question");
        c.setSelected(true);
        GridBagConstraints gbc_cbRemember = new GridBagConstraints();
        gbc_cbRemember.anchor = 18;
        gbc_cbRemember.insets = new Insets(0, 0, 0, 5);
        gbc_cbRemember.gridx = 0;
        gbc_cbRemember.gridy = 0;
        buttonPane.add(c, gbc_cbRemember);
        JButton okButton = new JButton("OK");
        okButton.addActionListener(new ActionListener() {

            final A a;

            public void actionPerformed(ActionEvent e)
            {
                java.awt.Component acomponent[];
                int j = (acomponent = A.a(a).getComponents()).length;
                for(int i = 0; i < j; i++)
                {
                    java.awt.Component c = acomponent[i];
                    if(!(c instanceof JRadioButton) || !((JRadioButton)c).isSelected())
                    {
                        continue;
                    }
                    String selectedName = ((AbstractButton)c).getText();
                    A.a(a, Integer.parseInt(selectedName.substring(0, selectedName.indexOf(":")).trim()));
                    break;
                }

                a.setVisible(false);
            }

            
            {
                a = A.this;
                super();
            }
        });
        okButton.setActionCommand("OK");
        GridBagConstraints gbc_okButton = new GridBagConstraints();
        gbc_okButton.anchor = 18;
        gbc_okButton.insets = new Insets(0, 0, 0, 5);
        gbc_okButton.gridx = 2;
        gbc_okButton.gridy = 0;
        buttonPane.add(okButton, gbc_okButton);
        getRootPane().setDefaultButton(okButton);
        JButton cancelButton = new JButton("Annuler");
        cancelButton.addActionListener(new ActionListener() {

            final A a;

            public void actionPerformed(ActionEvent e)
            {
                A.a(a, -999);
                a.setVisible(false);
            }

            
            {
                a = A.this;
                super();
            }
        });
        cancelButton.setActionCommand("Cancel");
        GridBagConstraints gbc_cancelButton = new GridBagConstraints();
        gbc_cancelButton.anchor = 18;
        gbc_cancelButton.gridx = 3;
        gbc_cancelButton.gridy = 0;
        buttonPane.add(cancelButton, gbc_cancelButton);
    }

    public int a()
    {
        return b;
    }

    public boolean b()
    {
        return c.isSelected();
    }

    static JPanel a(A a1)
    {
        return a1.a;
    }

    static void a(A a1, int i)
    {
        a1.b = i;
    }
}