/*
* WordlistGenerator.java
*
* Created on 20. Mai 2006, 17:41
*
*    [This programm shows some cryptograhps things]
*    Copyright (C) [2006]  [Daniel Baier alias duddits]
*
*    This program is free software; you can redistribute it and/or modify it under the terms of the
*    GNU General Public License as published by the Free Software Foundation; either version 2 of the
*    License, or (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
*    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*    See the GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License along with this program;
*    if not, write to the
*    Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*
*
*
*
*    [http://www.kuno-kohn.de/crypto/crypto/caesar.htm
*     Dieses Programm zeigt die MÃ¶glichkeiten beim ver-/entschlÃ¼sseln mit
*     einem monoalphabetischen Chiffre der einen Substitutionsalgorithmus verwendet]
*    Copyright (C) [2006]  [Daniel Baier alias duddits]
*
*    Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU General
*    Public License, wie von der Free Software Foundation veröffentlicht, weitergeben und/oder
*    modifizieren, entweder gemäß Version 2 der Lizenz oder (nach Ihrer Option) jeder spÃ¤teren Version.
*
*    Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, daß es Ihnen von Nutzen sein wird,
*    aber OHNE IRGENDEINE GARANTIE, sogar ohne die implizite Garantie der MARKTREIFE oder der
*    VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
*
*    Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm erhalten
*    haben. Falls nicht, schreiben Sie an die
*    Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
*
*
*/

/**
 * @author Daniel Baier
 * WordlistGenerator 0.5 alpha version
 * Copyright by Duddits alias Dainel Baier
 * patches come soon
 */
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;

import javax.swing.SwingUtilities;

public class WordlistGenerator extends Frame implements ActionListener, ItemListener{

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	TextField tf,tf1,tf2,tf3;
	String savepath = "";
	Label l,l1;
	static Panel panel;
	static WordlistGenerator wlg;
	final static int max = 20;
	static JProgressBar bar = new JProgressBar( 0, max );
	String i = "0";
	static int var1 = 2;
	static int var2 = 2;
	static int var3 = 2;
	static int var4 = 2;
	 private Image icon;

	public WordlistGenerator(){
		super("WGL --> WordListGenerattor 0.5 (c) by duddits");
		setSize(450,280);
		setLayout(null);
		setBackground(Color.LIGHT_GRAY);
		this.setMenuBar(new WGLMenu(this));
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setLocation(screenSize.width / 2 - 400 / 2,
                screenSize.height / 2 - 400 / 2);

        icon = Toolkit.getDefaultToolkit().getImage("logo10.jpg");
		setIconImage(icon);// setzt das Bild als Icon des Frames
		tf = new TextField();
		tf.setBounds(130,55,25,20);
		tf.setText("0");
		add(tf);
		//add(tf);

		l = new Label("Word Length       min.");
		l.setBounds(10,55,120,20);
		add(l);

		tf1 = new TextField();
		tf1.setBounds(200,55,25,20);
		tf1.setText("10");
		add(tf1);

		l1 = new Label("max.");
		l1.setBounds(170,55,30,20);
		add(l1);

		Button b = new Button("Create");
		b.setBounds(280,55,70,20);
		b.addActionListener(this);
		add(b);

		Button b1 = new Button("Cancel");
		b1.setBounds(355,55,70,20);
		b1.addActionListener(this);
		add(b1);

		Button b2 = new Button("Browse");
		b2.setBounds(355,100,70,20);
		b2.setActionCommand("B1");
		b2.addActionListener(this);
		add(b2);

		Button b3 = new Button("Browse");
		b3.setBounds(355,140,70,20);
		b3.addActionListener(this);
		b3.setActionCommand("B2");
		add(b3);

		l1 = new Label("Input File");
		l1.setBounds(10,100,80,20);
		add(l1);

		l1 = new Label("Output File");
		l1.setBounds(10,140,80,20);
		add(l1);

		tf2 = new TextField();
		tf2.setBounds(100,100,250,20);
		add(tf2);

		tf3 = new TextField();
		tf3.setBounds(100,140,250,20);
		add(tf3);


	}

	public void actionPerformed(ActionEvent e) {
		String cmd = e.getActionCommand();
		if (cmd.equals("Quit")) {
			 String optionen[] = { "Ja", "Nein" };

			    int n = JOptionPane.showOptionDialog( null,
			              "Are you sure you want to exit ?",      // Fragetext
			              "WLG",  // Titel
			              JOptionPane.YES_NO_OPTION,
			              JOptionPane.QUESTION_MESSAGE,  // Icon
			              null, optionen,optionen[0] );

			    if ( n == JOptionPane.YES_OPTION ){
			    	System.exit( 0 );
			    }


		}else if(cmd.equals("Create") && var3 == 1){
			try {
				final JFrame frame = new JFrame();
				frame.getContentPane().add( bar, BorderLayout.NORTH );
				frame.pack();
				frame.setLocation(200,200);
				frame.setVisible( true );
				bar.setBackground(Color.white);
				int anfang = Integer.parseInt(tf.getText());
				final int ende = Integer.parseInt(tf1.getText());
				new Thread( new Runnable()
						{
						public void run()
						{
						for ( int i = 1; i <= max; i++ )
						{
						try { Thread.sleep( 100*ende*5); } catch ( InterruptedException e ) { }
						final int j = i;

						SwingUtilities.invokeLater( new Runnable()
						{
						public void run()
						{
						bar.setValue( j );
						}
						} );
						}
						//Optionen nach dem Laden
						frame.setVisible(false);
												JOptionPane.showMessageDialog(  null, "Action was succesfull: "+i +" words were generated");
						}
						} ).start();

				int z = 1;
				//StringBuffer sb = new StringBuffer();

				if (anfang >= 0 && z <= ende) {
					z++;
					//1
					i = "10";
					FileWriter fw = new FileWriter(tf3.getText());
					for (int i = 0; i <= 9; i++) {
						fw.append( "\r\n" + i );
					}
					if (anfang >= 0 && z <= ende) {
						z++;
						//2
						i = "110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								String s = Integer.toString(i1);
								fw.append( "\r\n" + i + s );
							}

						}
					}
					if (anfang >= 0 && z <= ende) {
						z++;
						//3
						i = "1110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								for (int i2 = 0; i2 <= 9; i2++) {
									String s = Integer.toString(i1);
									String s1 = Integer.toString(i2);
									fw.append( "\r\n" + i + s + s1 );
								}
							}

						}
					}
					if (anfang >= 0 && z <= ende) {
						z++;
						//4
						i = "11110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								for (int i2 = 0; i2 <= 9; i2++) {
									for (int i3 = 0; i3 <= 9; i3++) {

										String s = Integer.toString(i1);
										String s1 = Integer.toString(i2);
										String s2 = Integer.toString(i3);
										fw.append( "\r\n" + i + s + s1 + s2 );

									}
								}
							}

						}

					}
					if (anfang >= 0 && z <= ende) {
						z++;
						//5
						i = "111110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								for (int i2 = 0; i2 <= 9; i2++) {
									for (int i3 = 0; i3 <= 9; i3++) {
										for (int i4 = 0; i4 <= 9; i4++) {

											String s = Integer.toString(i1);
											String s1 = Integer.toString(i2);
											String s2 = Integer.toString(i3);
											String s3 = Integer.toString(i4);
											fw.append( "\r\n" + i + s + s1 + s2 + s3);

										}

									}
								}
							}
						}
					}if (anfang >= 0 && z <= ende) {
						z++;
						//6
						i = "1111110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								for (int i2 = 0; i2 <= 9; i2++) {
									for (int i3 = 0; i3 <= 9; i3++) {
										for (int i4 = 0; i4 <= 9; i4++) {
											for (int i5 = 0; i5 <= 9; i5++) {

											String s = Integer.toString(i1);
											String s1 = Integer.toString(i2);
											String s2 = Integer.toString(i3);
											String s3 = Integer.toString(i4);
											String s4 = Integer.toString(i5);
											fw.append( "\r\n" + i + s + s1 + s2 + s3 +s4);
											}
										}

									}
								}
							}
						}
					}
					if (anfang >= 0 && z <= ende) {
						z++;
						//7
						i = "11111110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								for (int i2 = 0; i2 <= 9; i2++) {
									for (int i3 = 0; i3 <= 9; i3++) {
										for (int i4 = 0; i4 <= 9; i4++) {
											for (int i5 = 0; i5 <= 9; i5++) {
												for (int i6 = 0; i6 <= 9; i6++) {

											String s = Integer.toString(i1);
											String s1 = Integer.toString(i2);
											String s2 = Integer.toString(i3);
											String s3 = Integer.toString(i4);
											String s4 = Integer.toString(i5);
											String s5 = Integer.toString(i6);
											fw.append( "\r\n" + i + s + s1 + s2 + s3 +s4 +s5);
												}
											}
										}

									}
								}
							}
						}
					}
					if (anfang >= 0 && z <= ende) {
						z++;
						//8
						i = "111111110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								for (int i2 = 0; i2 <= 9; i2++) {
									for (int i3 = 0; i3 <= 9; i3++) {
										for (int i4 = 0; i4 <= 9; i4++) {
											for (int i5 = 0; i5 <= 9; i5++) {
												for (int i6 = 0; i6 <= 9; i6++) {
													for (int i7 = 0; i7 <= 9; i7++) {

											String s = Integer.toString(i1);
											String s1 = Integer.toString(i2);
											String s2 = Integer.toString(i3);
											String s3 = Integer.toString(i4);
											String s4 = Integer.toString(i5);
											String s5 = Integer.toString(i6);
											String s6 = Integer.toString(i7);
											fw.append( "\r\n" + i + s + s1 + s2 + s3 +s4 +s5 +s6);
													}
												}
											}
										}

									}
								}
							}
						}
					}
					if (anfang >= 0 && z <= ende) {
						z++;
						//9
						i = "1111111110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								for (int i2 = 0; i2 <= 9; i2++) {
									for (int i3 = 0; i3 <= 9; i3++) {
										for (int i4 = 0; i4 <= 9; i4++) {
											for (int i5 = 0; i5 <= 9; i5++) {
												for (int i6 = 0; i6 <= 9; i6++) {
													for (int i7 = 0; i7 <= 9; i7++) {
														for (int i8 = 0; i8 <= 9; i8++) {

											String s = Integer.toString(i1);
											String s1 = Integer.toString(i2);
											String s2 = Integer.toString(i3);
											String s3 = Integer.toString(i4);
											String s4 = Integer.toString(i5);
											String s5 = Integer.toString(i6);
											String s6 = Integer.toString(i7);
											String s7 = Integer.toString(i8);
											fw.append( "\r\n" + i + s + s1 + s2 + s3 +s4 +s5 +s6 +s7);
														}
													}
												}
											}
										}

									}
								}
							}
						}
					}
					if (anfang >= 0 && z <= ende) {
						z++;
						//10
						i = "11111111110";
						for (int i = 0; i <= 9; i++) {
							for (int i1 = 0; i1 <= 9; i1++) {
								for (int i2 = 0; i2 <= 9; i2++) {
									for (int i3 = 0; i3 <= 9; i3++) {
										for (int i4 = 0; i4 <= 9; i4++) {
											for (int i5 = 0; i5 <= 9; i5++) {
												for (int i6 = 0; i6 <= 9; i6++) {
													for (int i7 = 0; i7 <= 9; i7++) {
														for (int i8 = 0; i8 <= 9; i8++) {
															for (int i9 = 0; i9 <= 9; i9++) {

											String s = Integer.toString(i1);
											String s1 = Integer.toString(i2);
											String s2 = Integer.toString(i3);
											String s3 = Integer.toString(i4);
											String s4 = Integer.toString(i5);
											String s5 = Integer.toString(i6);
											String s6 = Integer.toString(i7);
											String s7 = Integer.toString(i8);
											String s8 = Integer.toString(i9);
											fw.append( "\r\n" + i + s + s1 + s2 + s3 +s4 +s5 +s6 +s7 +s8);
															}
														}
													}
												}
											}
										}

									}
								}
							}
						}
					}
					fw.close();
				}



			} catch (Exception ioex) {
				String optionen[] = { "OK" };

				    JOptionPane.showOptionDialog( null,
				    		ioex.toString(),      // Fragetext
				              "Error",  // Titel
				              JOptionPane.OK_OPTION,
				              JOptionPane.ERROR_MESSAGE,  // Icon
				              null, optionen,optionen[0] );

				}
		}else if(cmd.equals("Create") && var1 == 1){
			try {
				final JFrame frame = new JFrame();
				frame.getContentPane().add( bar, BorderLayout.NORTH );
				frame.pack();
				frame.setLocation(200,200);
				frame.setVisible( true );
				bar.setBackground(Color.white);
				int anfang = Integer.parseInt(tf.getText());
				final int ende = Integer.parseInt(tf1.getText());
				new Thread( new Runnable()
						{
						public void run()
						{
						for ( int i = 1; i <= max; i++ )
						{
						try { Thread.sleep( 100*ende*8); } catch ( InterruptedException e ) { }
						final int j = i;

						SwingUtilities.invokeLater( new Runnable()
						{
						public void run()
						{
						bar.setValue( j );
						}
						} );
						}
						//Optionen nach dem Laden
						frame.setVisible(false);
												JOptionPane.showMessageDialog(  null, "Action was succesfull: "+i +" words were generated");
						}
						} ).start();

				int z = 1;
				String[] alpha = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
				//StringBuffer sb = new StringBuffer();
				if (anfang >= 0 && z <= ende) {
						z++;
						//1
						FileWriter fw = new FileWriter(tf3.getText());
						for (int i = 0; i <= 25; i++) {
							fw.append( "\r\n" + alpha[i] );
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//2
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									fw.append( "\r\n" +alpha[i] + alpha[i1]);
								}

							}
						}if (anfang >= 0 && z <= ende) {
							z++;
							//3
							i = "1110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2] );
									}
								}

							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//4
							i = "11110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2] + alpha[i3] );

										}
									}
								}

							}

						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//5
							i = "111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]);

											}

										}
									}
								}
							}
						}if (anfang >= 0 && z <= ende) {
							z++;
							//6
							i = "1111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]);
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//7
							i = "11111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
													for (int i6 = 0; i6 <= 25; i6++) {
												fw.append( "\r\n"+alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6]);
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//8
							i = "111111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
													for (int i6 = 0; i6 <= 25; i6++) {
														for (int i7 = 0; i7 <= 25; i7++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]);
														}
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//9
							i = "1111111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
													for (int i6 = 0; i6 <= 25; i6++) {
														for (int i7 = 0; i7 <= 25; i7++) {
															for (int i8 = 0; i8 <= 25; i8++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]+ alpha[i8]);
															}
														}
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//10
							i = "11111111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
													for (int i6 = 0; i6 <= 25; i6++) {
														for (int i7 = 0; i7 <= 25; i7++) {
															for (int i8 = 0; i8 <= 25; i8++) {
																for (int i9 = 0; i9 <= 25; i9++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]+ alpha[i8]+alpha[i9]);
																}
															}
														}
													}
												}
											}

										}
									}
								}
							}
						}
					fw.close();
				}



			} catch (Exception ioex) {
				String optionen[] = { "OK" };

				    JOptionPane.showOptionDialog( null,
				    		ioex.toString(),      // Fragetext
				              "Error",  // Titel
				              JOptionPane.OK_OPTION,
				              JOptionPane.ERROR_MESSAGE,  // Icon
				              null, optionen,optionen[0] );

				}
		}else if(cmd.equals("Create") && var2 == 1){
			try {
				//Uppercase
				final JFrame frame = new JFrame();
				frame.getContentPane().add( bar, BorderLayout.NORTH );
				frame.pack();
				frame.setLocation(200,200);
				frame.setVisible( true );
				bar.setBackground(Color.white);
				int anfang = Integer.parseInt(tf.getText());
				final int ende = Integer.parseInt(tf1.getText());
				new Thread( new Runnable()
						{
						public void run()
						{
						for ( int i = 1; i <= max; i++ )
						{
						try { Thread.sleep( 100*ende*8); } catch ( InterruptedException e ) { }
						final int j = i;

						SwingUtilities.invokeLater( new Runnable()
						{
						public void run()
						{
						bar.setValue( j );
						}
						} );
						}
						//Optionen nach dem Laden
						frame.setVisible(false);
												JOptionPane.showMessageDialog(  null, "Action was succesfull: "+i +" words were generated");
						}
						} ).start();

				int z = 1;
				String[] alpha = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
				//StringBuffer sb = new StringBuffer();
				if (anfang >= 0 && z <= ende) {
						z++;
						//1
						FileWriter fw = new FileWriter(tf3.getText());
						for (int i = 0; i <= 25; i++) {
							fw.append( "\r\n" + alpha[i] );
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//2
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									fw.append( "\r\n" +alpha[i] + alpha[i1]);
								}

							}
						}if (anfang >= 0 && z <= ende) {
							z++;
							//3
							i = "1110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]  );
									}
								}

							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//4
							i = "11110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2] + alpha[i3] );

										}
									}
								}

							}

						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//5
							i = "111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]);

											}

										}
									}
								}
							}
						}if (anfang >= 0 && z <= ende) {
							z++;
							//6
							i = "1111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]);
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//7
							i = "11111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
													for (int i6 = 0; i6 <= 25; i6++) {
												fw.append( "\r\n"+alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6]);
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//8
							i = "111111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
													for (int i6 = 0; i6 <= 25; i6++) {
														for (int i7 = 0; i7 <= 25; i7++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]);
														}
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//9
							i = "1111111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
													for (int i6 = 0; i6 <= 25; i6++) {
														for (int i7 = 0; i7 <= 25; i7++) {
															for (int i8 = 0; i8 <= 25; i8++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]+ alpha[i8]);
															}
														}
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//10
							i = "11111111110";
							for (int i = 0; i <= 25; i++) {
								for (int i1 = 0; i1 <= 25; i1++) {
									for (int i2 = 0; i2 <= 25; i2++) {
										for (int i3 = 0; i3 <= 25; i3++) {
											for (int i4 = 0; i4 <= 25; i4++) {
												for (int i5 = 0; i5 <= 25; i5++) {
													for (int i6 = 0; i6 <= 25; i6++) {
														for (int i7 = 0; i7 <= 25; i7++) {
															for (int i8 = 0; i8 <= 25; i8++) {
																for (int i9 = 0; i9 <= 25; i9++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]+ alpha[i8]+alpha[i9]);
																}
															}
														}
													}
												}
											}

										}
									}
								}
							}
						}
					fw.close();
				}



			} catch (Exception ioex) {
				String optionen[] = { "OK" };

				    JOptionPane.showOptionDialog( null,
				    		ioex.toString(),      // Fragetext
				              "Error",  // Titel
				              JOptionPane.OK_OPTION,
				              JOptionPane.ERROR_MESSAGE,  // Icon
				              null, optionen,optionen[0] );

				}
		}
		else if(cmd.equals("Create") && var4 == 1){
			try {
				// Mixed Alpha
				final JFrame frame = new JFrame();
				frame.getContentPane().add( bar, BorderLayout.NORTH );
				frame.pack();
				frame.setLocation(200,200);
				frame.setVisible( true );
				bar.setBackground(Color.white);
				int anfang = Integer.parseInt(tf.getText());
				final int ende = Integer.parseInt(tf1.getText());
				new Thread( new Runnable()
						{
						public void run()
						{
						for ( int i = 1; i <= max; i++ )
						{
						try { Thread.sleep( 100*ende*8); } catch ( InterruptedException e ) { }
						final int j = i;

						SwingUtilities.invokeLater( new Runnable()
						{
						public void run()
						{
						bar.setValue( j );
						}
						} );
						}
						//Optionen nach dem Laden
						frame.setVisible(false);
												JOptionPane.showMessageDialog(  null, "Action was succesfull: "+i +" words were generated");
						}
						} ).start();

				int z = 1;
				String[] alpha = {"A","B","N","D","E","F","G","a","b","f","e","d","n","h","H","r","t","R","ä","ü","ö","l","L","o","O","9","0",".","-"};
				//StringBuffer sb = new StringBuffer();
				if (anfang >= 0 && z <= ende) {
						z++;
						//1
						FileWriter fw = new FileWriter(tf3.getText());
						for (int i = 0; i <= 28; i++) {
							fw.append( "\r\n" + alpha[i] );
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//2
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									fw.append( "\r\n" +alpha[i] + alpha[i1]);
								}

							}
						}if (anfang >= 0 && z <= ende) {
							z++;
							//3
							i = "1110";
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									for (int i2 = 0; i2 <= 28; i2++) {
										fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]  );
									}
								}

							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//4
							i = "11110";
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									for (int i2 = 0; i2 <= 28; i2++) {
										for (int i3 = 0; i3 <= 28; i3++) {
											fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2] + alpha[i3] );

										}
									}
								}

							}

						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//5
							i = "111110";
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									for (int i2 = 0; i2 <= 28; i2++) {
										for (int i3 = 0; i3 <= 28; i3++) {
											for (int i4 = 0; i4 <= 28; i4++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]);

											}

										}
									}
								}
							}
						}if (anfang >= 0 && z <= ende) {
							z++;
							//6
							i = "1111110";
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									for (int i2 = 0; i2 <= 28; i2++) {
										for (int i3 = 0; i3 <= 28; i3++) {
											for (int i4 = 0; i4 <= 28; i4++) {
												for (int i5 = 0; i5 <= 28; i5++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]);
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//7
							i = "11111110";
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									for (int i2 = 0; i2 <= 28; i2++) {
										for (int i3 = 0; i3 <= 28; i3++) {
											for (int i4 = 0; i4 <= 28; i4++) {
												for (int i5 = 0; i5 <= 28; i5++) {
													for (int i6 = 0; i6 <= 28; i6++) {
												fw.append( "\r\n"+alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6]);
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//8
							i = "111111110";
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									for (int i2 = 0; i2 <= 28; i2++) {
										for (int i3 = 0; i3 <= 28; i3++) {
											for (int i4 = 0; i4 <= 28; i4++) {
												for (int i5 = 0; i5 <= 28; i5++) {
													for (int i6 = 0; i6 <= 28; i6++) {
														for (int i7 = 0; i7 <= 28; i7++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]);
														}
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//9
							i = "1111111110";
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									for (int i2 = 0; i2 <= 28; i2++) {
										for (int i3 = 0; i3 <= 28; i3++) {
											for (int i4 = 0; i4 <= 28; i4++) {
												for (int i5 = 0; i5 <= 28; i5++) {
													for (int i6 = 0; i6 <= 28; i6++) {
														for (int i7 = 0; i7 <= 28; i7++) {
															for (int i8 = 0; i8 <= 28; i8++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]+ alpha[i8]);
															}
														}
													}
												}
											}

										}
									}
								}
							}
						}
						if (anfang >= 0 && z <= ende) {
							z++;
							//10
							i = "11111111110";
							for (int i = 0; i <= 28; i++) {
								for (int i1 = 0; i1 <= 28; i1++) {
									for (int i2 = 0; i2 <= 28; i2++) {
										for (int i3 = 0; i3 <= 28; i3++) {
											for (int i4 = 0; i4 <= 28; i4++) {
												for (int i5 = 0; i5 <= 28; i5++) {
													for (int i6 = 0; i6 <= 28; i6++) {
														for (int i7 = 0; i7 <= 28; i7++) {
															for (int i8 = 0; i8 <= 28; i8++) {
																for (int i9 = 0; i9 <= 28; i9++) {
												fw.append( "\r\n" +alpha[i] + alpha[i1]+ alpha[i2]+alpha[i3] + alpha[i4]+ alpha[i5]+alpha[i6] + alpha[i7]+ alpha[i8]+alpha[i9]);
																}
															}
														}
													}
												}
											}

										}
									}
								}
							}
						}
					fw.close();
				}



			} catch (Exception ioex) {
				String optionen[] = { "OK" };

				    int n = JOptionPane.showOptionDialog( null,
				    		ioex.toString(),      // Fragetext
				              "Error",  // Titel
				              JOptionPane.OK_OPTION,
				              JOptionPane.ERROR_MESSAGE,  // Icon
				              null, optionen,optionen[0] );

				}
		}
		else if(cmd.equals("B1")){
			FileDialog fd = new FileDialog(wlg, "Browse", FileDialog.SAVE);
			fd.show();
			tf2.setText( fd.getDirectory() + fd.getFile());
			try {
				FileWriter fw = new FileWriter("/" + fd.getDirectory()
						+ "/" + fd.getFile() + ".ch");
				fw.close();
				savepath = "/" + fd.getDirectory() + "/" + fd.getFile()
						+ ".ch";
			} catch (IOException ioex) {
			}
		}else if(cmd.equals("B2")){
			FileDialog fd = new FileDialog(wlg, "Browse", FileDialog.LOAD);
			fd.show();
			tf3.setText( fd.getDirectory() + fd.getFile());
		}else if (cmd.equals("Help Contents")) {
			ActionListener al;
			final Frame f;

			f = new Frame("Help - WLG");
			f.setBounds(300, 100, 310, 550);
			f.setBackground(Color.GRAY);
			f.setLayout(null);
			f.setVisible(true);

			al = new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					f.setVisible(false);
				}
			};

			JLabel ta = new JLabel(
					"<html>Diese Hilfe bietet einen kurzen Überblick <br>über die Funktionen von WordlistGenerator.<br>" +
					"Eine Ausführliche Dokumentation mit Beispielen <br>liegt im Ordner >>Dokuments<< bei.<br><br><br> 1. " +
					"Basic Applications / Standart Funktionen <br><br>Dies ist noch eine aplha Version <br>des Programms (v. 0.1)" +
					"<br>Derzeit gibt es noch Speicherfehler <br>diese werden in nachfolgenden Versionen.<br>hoffentlich nicht mehr entstehen!" +
					"<br><br>Ich werde versuchen einen Algorithmus zu \nentwickeln der weniger Leistung<br>und Speicher braucht. Trotz allem sollte dies nur <br>bei mindestens <br>2 GHz Rechnern mit mindestens 512 MB RAM" +
					"<br>ausgeführt werden da sonst Laufzeitfehler und " +
					"<br>Abstüze nicht ausgeschlossen werden können. <br><br>Weiterhin befindet <br>sich das Programm noch in der <br>Entwicklungsphase und weist eine Menge von <br>Fehler auf. <br>Anmerkungen und Tipps bitte an meine <br>E-Mail Adresse. <br>Copyright 2005-2006 Duddits</html>");
			ta.setBounds(5, 5, 300, 500);
			f.add(ta);

			Button ok = new Button("OK");
			ok.addActionListener(al);
			ok.setBounds(130, 515, 40, 20);
			f.add(ok);
		}else if(cmd.equals("Cancel")){
			tf2.setText("");
			tf3.setText("");
		}else if(cmd.equals("About WLG")){

		           JLabel link = new JLabel("<html>Enwickelt für RemoteShell-Security von Daniel Baier<br>(c) Copyright WLG contributors and others 2005, 2006.  All rights reserved.<br>This product includes software developed by the<br>RemoteShell-Security Team <font color=0000FF><u>http://www.remoteshell-security.com</u></font></html>");
		link.setCursor( new Cursor(Cursor.HAND_CURSOR) ); //Ich hoffe ich hab das jetzt mal auf anhieb richtig eingetippt
		link.addMouseListener( new MouseAdapter() {
		    public void mouseReleased( MouseEvent me ) {
		        if(me.getButton()==MouseEvent.BUTTON1) {
		            try {
		                Runtime.getRuntime().exec("C:\\Programme\\Internet Explorer\\IEXPLORE.EXE http://www.remoteshell-security.com");
		            }
		            catch(Exception e)
		            {
		                try{
		                Runtime.getRuntime().exec("firefox http://www.remoteshell-security.com");
		             }catch(Exception ee){

		             }
		            }
		        }
		    }
		});

		JOptionPane.showMessageDialog(null,link,"WLG - Über den Autor", 1);

		}else if(cmd.equals("laden")){

		}else if(cmd.equals("laden")){

		}else if(cmd.equals("laden")){

		}else if(cmd.equals("laden")){

		}
	}


	public void itemStateChanged(ItemEvent ie) {

	}

	//Main Methode
	public static void main(String[] args) {
		wlg = new WordlistGenerator();
		panel = new Panel();
		panel.setLayout(new GridLayout(3,2));
		panel.setBounds(10,180,300,100);

		 JCheckBox cb1 = new JCheckBox( "Lowercase Aplha", false );
		 	cb1.setBackground(Color.LIGHT_GRAY);
		    cb1.addActionListener(new WordlistGenerator());
		    panel.add(cb1);
		    ItemListener box1 = new ItemListener() {
		        public void itemStateChanged( ItemEvent e ) {
		          // 2 = false, und 1 = true
		          var1 = e.getStateChange();
		        }
		      };
		      cb1.addItemListener( box1 );




		    JCheckBox cb2 = new JCheckBox( "Uppercase Alpha", false );
		    cb2.setBackground(Color.LIGHT_GRAY);
		    cb2.addActionListener(new WordlistGenerator());
		    panel.add(cb2);
		    ItemListener heldenListener = new ItemListener() {
		      public void itemStateChanged( ItemEvent e ) {
		        // 2 = false, und 1 = true
		        var2 = e.getStateChange();
		      }
		    };
		    cb2.addItemListener( heldenListener );

		    JCheckBox cb3 = new JCheckBox( "Digits only                      ", false );
		    cb3.setBackground(Color.LIGHT_GRAY);
		    cb3.addActionListener(new WordlistGenerator());
		    panel.add(cb3);
		    ItemListener box3 = new ItemListener() {
		      public void itemStateChanged( ItemEvent e ) {
		        // 2 = false, und 1 = true
		        var3 = e.getStateChange();
		      }
		    };
		    cb3.addItemListener( box3 );

		    JCheckBox cb4 = new JCheckBox( "Mixed Alpha", false );
		    cb4.setBackground(Color.LIGHT_GRAY);
		    cb4.addActionListener(new WordlistGenerator());
		    panel.add(cb4);
		    ItemListener box4 = new ItemListener() {
		      public void itemStateChanged( ItemEvent e ) {
		        // 2 = false, und 1 = true
		        var4 = e.getStateChange();
		      }
		    };
		    cb4.addItemListener( box4 );

		    wlg.add(panel);


			wlg.setVisible(true);
			JOptionPane.showMessageDialog(  null, "Bedenken Sie das, wenn Sie mehr als 7 Zeichen verwenden\ndass, die Datei >30 MB wird !");

		}

}
