Commit 93a82927 authored by Felix Bilstein's avatar Felix Bilstein

first commit

parent 3d0987e6
<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See commented blocks below for --><!-- some examples of how to customize the build. --><!-- (If you delete it and reopen the project it will be recreated.) --><!-- By default, only the Clean and Build commands use this build script. --><!-- Commands such as Run, Debug, and Test only use this build script if --><!-- the Compile on Save feature is turned off for the project. --><!-- You can turn off the Compile on Save (or Deploy on Save) setting --><!-- in the project's Project Properties dialog box.--><project name="WlanKeygen" default="default" basedir=".">
<description>Builds, tests, and runs the project WlanKeygen.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="WlanKeygen-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
#Tue, 10 Sep 2013 18:36:33 +0200
/home/user/Code/Java/NetBeans/WlanKeygen=
========================
BUILD OUTPUT DESCRIPTION
========================
When you build an Java application project that has a main class, the IDE
automatically copies all of the JAR
files on the projects classpath to your projects dist/lib folder. The IDE
also adds each of the JAR files to the Class-Path element in the application
JAR files manifest file (MANIFEST.MF).
To run the project from the command line, go to the dist folder and
type the following:
java -jar "WlanKeygen.jar"
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
Notes:
* If two JAR files on the project classpath have the same name, only the first
JAR file is copied to the lib folder.
* Only JAR files are copied to the lib folder.
If the classpath contains other types of files or folders, these files (folders)
are not copied.
* If a library on the projects classpath also has a Class-Path element
specified in the manifest,the content of the Class-Path element has to be on
the projects runtime path.
* To set a main class in a standard Java project, right-click the project node
in the Projects window and choose Properties. Then click Run and enter the
class name in the Main Class field. Alternatively, you can manually type the
class name in the manifest Main-Class element.
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
This diff is collapsed.
build.xml.data.CRC32=e7f019fd
build.xml.script.CRC32=cd83c083
build.xml.stylesheet.CRC32=28e38971@1.44.1.45
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=e7f019fd
nbproject/build-impl.xml.script.CRC32=993575fd
nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46
compile.on.save=true
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=/home/user/.netbeans/7.3.1/build.properties
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
</project-private>
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=WlanKeygen
application.vendor=user
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/WlanKeygen.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=true
javac.processorpath=\
${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
main.class=wlankeygen.WlanKeygenGUI
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>WlanKeygen</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
package wlankeygen;
import java.io.FileWriter;
public class WlanKeygen extends WlanKeygenGUI {
private static final long serialVersionUID = 1L;
static String NUM;
static String SSID;
static String MAC;
static String DIR;
static String output;
static String output_vea;
static String nr;
static String letter;
static boolean GUI;
static FileWriter fw;
static String wpaKey;
public static void commandline(String NUM, String SSID, String MAC) {
if (NUM.equals("1")) {
keygen.generate_standard(SSID, MAC);
System.out.println(output);
}
else if (NUM.equals("2")) {
keygen.generate_explicit(SSID, MAC);
System.out.println(output);
}
else if (NUM.equals("3")) {
keygen.generate_standard(SSID, MAC);
keygen.generate_explicit(SSID, MAC);
System.out.println("File is saved in " + System.getProperty("user.home") + System.getProperty("file.separator") + "keygenstandart-" + SSID + ".txt");
System.out.println("File is saved in " + System.getProperty("user.home") + System.getProperty("file.separator") + "keygenexplicit-" + SSID + ".txt");
}
else if (NUM.equals("4")) {
keygen.generate_vea(SSID, MAC);
System.out.println(output);
}
else if (NUM.equals("5")) {
keygen.generate_alice(SSID, MAC);
System.out.println(output);
}
else {
System.out.println("Wrong number. Just type 1 for #1, 2 for #2 ...");
}
}
public static void main(String[] args) {
GUI = false;
if (args.length <= 0 || args.length > 3 || args[0].equalsIgnoreCase("help")) {
System.out.println("Usage: java -jar wlankeygen.jar <#> <SSID> <BSSID>");
System.out.println(" java -jar wlankeygen.jar gui");
System.out.println(" java -jar wlankeygen.jar help" + " (to see this screen)");
System.out.println("Example: java -jar wlankeygen.jar 3 WLAN-123456 00:11:22:33:44:55" + "\n");
System.out.println("#1 keygen-standard [WLAN-123456]");
System.out.println("#2 keygen-explicit [WLAN-123456]");
System.out.println("#3 keygen-full [WLAN-123456]");
System.out.println("#4 Vodafone, EasyBox or Arcor [EasyBox-4B4516] [Arcor-79FE60] [Vodafone-ABCDEF]");
System.out.println("#5 Alice-Router [ALICE-WLAN56]");
} else {
NUM = args[0];
if (NUM.equalsIgnoreCase("gui")) {
GUI = true;
} else {
try {
SSID = args[1];
MAC = args[2];
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("NUM: " + NUM + "\n" + "SSID: " + SSID + "\n" + "MAC: " + MAC + "\n");
}
if (GUI == true) {
WlanKeygenGUI.main(args);
} else {
/*
* Use command line
*/
commandline(NUM, SSID, MAC);
}
}
}
}
\ No newline at end of file
package wlankeygen;
/**
*
* @author razor493
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
/*
* The Client with its GUI
*/
public class WlanKeygenGUI extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private JTextField SSID, BSSID;
private JButton alice, macchanger, full, vea;
private JTextArea ta;
// Constructor connection receiving a socket number
WlanKeygenGUI() {
super("WirelessLan Key Generator");
// The NorthPanel with:
JPanel northPanel = new JPanel(new GridLayout(2,0));
// the server name anmd the port number
//JPanel SSIDBSSID = new JPanel(new GridLayout(2,2));
// the two JTextField with default value for server address and port number
SSID = new JTextField();
BSSID = new JTextField();
//SSID.setPreferredSize(new Dimension(200,20));
//BSSID.setPreferredSize(new Dimension(200,20));
northPanel.add(new JLabel("SSID:"));
northPanel.add(SSID);
northPanel.add(new JLabel("BSSID:"));
northPanel.add(BSSID);
// adds the Server an port field to the GUI
// the Label and the TextField
add(northPanel, BorderLayout.NORTH);
// The CenterPanel which is the chat room
ta = new JTextArea("Telekom: [WLAN-123456]\n(handshake required, creates 2 short wordlists)\n\nVodafone: [Vodafone-ABCDEF]\nEasyBox: [EasyBox-4B4516]\nArcor: [Arcor-79FE60]\nAlice-Router: [ALICE-WLAN56]\n\nmacchanger works only if macchanger is installed\n(\"sudo apt-get install macchanger\")\nand the application is running with root privileges\n\n");
JPanel centerPanel = new JPanel(new GridLayout(1,1));
centerPanel.add(new JScrollPane(ta));
ta.setEditable(false);
add(centerPanel, BorderLayout.CENTER);
// the buttons
alice = new JButton("Alice");
alice.addActionListener(this);
vea = new JButton("Vodafone, EasyBox, Arcor");
vea.addActionListener(this);
macchanger = new JButton("macchanger");
macchanger.addActionListener(this);
full = new JButton("Telekom");
full.addActionListener(this);
JPanel southPanel = new JPanel(new GridLayout(2, 2));
southPanel.add(alice);
southPanel.add(vea);
southPanel.add(full);
southPanel.add(macchanger);
add(southPanel, BorderLayout.SOUTH);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(450, 450);
setVisible(true);
}
// called by the Client to append text in the TextArea
void append(String str) {
ta.append(str);
ta.setCaretPosition(ta.getText().length() - 1);
}
/*
* Button or JTextField clicked
*/
public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
if(o == alice) {
append("------------------------------------------------------------------------------------------------------\n");
append("The values you entered: \n");
append("SSID : " + SSID.getText() + "\n");
append("BSSID: " + BSSID.getText() + "\n\n");
String name = SSID.getText();
String mac = BSSID.getText();
keygen.generate_alice(name, mac);
append(WlanKeygen.output + "\n\n");
}
if(o == macchanger) {
append("------------------------------------------------------------------------------------------------------\n");
try {
execute.macchanger();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
append(WlanKeygen.output + "\n\n");
}
if(o == full) {
append("------------------------------------------------------------------------------------------------------\n");
append("The values you entered: \n");
append("SSID : " + SSID.getText() + "\n");
append("BSSID: " + BSSID.getText() + "\n\n");
String name = SSID.getText();
String mac = BSSID.getText();
keygen.generate_explicit(name, mac);
keygen.generate_standard(name, mac);
append(WlanKeygen.output_vea + "\n");
append(WlanKeygen.output + "\n\n");
}
if(o == vea) {
append("------------------------------------------------------------------------------------------------------\n");
append("The values you entered: \n");
append("SSID : " + SSID.getText() + "\n");
append("BSSID: " + BSSID.getText() + "\n\n");
String name = SSID.getText();
String mac = BSSID.getText();
keygen.generate_vea(name, mac);
append("WPA-Key: " + (WlanKeygen.output_vea).toUpperCase() + "\n");
append(WlanKeygen.output + "\n\n");
}
}
// to start the whole thing the server
public static void main(String[] args) {
new WlanKeygenGUI();
}
}
\ No newline at end of file
package wlankeygen;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import java.io.IOException;
import java.security.MessageDigest;
public class execute {
public void ausfuehren(String command) {
try {
Runtime.getRuntime().exec(command);
} catch (IOException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
}
}
public static void macchanger() throws IOException {
Runtime.getRuntime().exec("sudo ifconfig wlan0 down");
Runtime.getRuntime().exec("sudo macchanger -r wlan0");
Runtime.getRuntime().exec("sudo ifconfig wlan0 up");
WlanKeygen.output = "Tried to change mac address - check it manually with ifconfig";
}
public static String MD5(String md5) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] array = md.digest(md5.getBytes());
StringBuffer sb = new StringBuffer();
for (int i = 0; i < array.length; ++i) {
sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3));
}
return sb.toString();
} catch (java.security.NoSuchAlgorithmException e) {
}
return null;
}
public static String BASE64(String base) {
String encoded = Base64.encode(base.getBytes());
// System.out.println("Base64 Encoded String : " + new String(encoded));
return encoded;
}
public static String toascii(String i) {
if (i.equals("0")) {
WlanKeygen.nr = "48";
}
if (i.equals("1")) {
WlanKeygen.nr = "49";
}
if (i.equals("2")) {
WlanKeygen.nr = "50";
}
if (i.equals("3")) {
WlanKeygen.nr = "51";
}
if (i.equals("4")) {
WlanKeygen.nr = "52";
}
if (i.equals("5")) {
WlanKeygen.nr = "53";
}
if (i.equals("6")) {
WlanKeygen.nr = "54";
}
if (i.equals("7")) {
WlanKeygen.nr = "55";
}
if (i.equals("8")) {
WlanKeygen.nr = "56";
}
if (i.equals("9")) {
WlanKeygen.nr = "57";
}
if (i.equals("A")) {
WlanKeygen.nr = "65";
}
if (i.equals("B")) {
WlanKeygen.nr = "66";
}
if (i.equals("C")) {
WlanKeygen.nr = "67";
}
if (i.equals("D")) {
WlanKeygen.nr = "68";
}
if (i.equals("E")) {
WlanKeygen.nr = "69";
}
if (i.equals("F")) {
WlanKeygen.nr = "70";
}
return WlanKeygen.nr;
}
}
\ No newline at end of file
package wlankeygen;
import java.io.FileWriter;
public class keygen {
public static String generate_vea(String SSID, String MAC) {
MAC = MAC.trim();
MAC = MAC.replace(":", "");
MAC = MAC.replace(" ", "");
if (MAC.length() == 12){
String C1 = ""+ Integer.parseInt(MAC.substring(8), 16);
while (C1.length() < 5) C1 = 0+C1;
@SuppressWarnings("unused")
char S6 = C1.charAt(0);
char S7 = C1.charAt(1);
char S8 = C1.charAt(2);
char S9 = C1.charAt(3);
char S10 = C1.charAt(4);
@SuppressWarnings("unused")
char M7 = MAC.charAt(6);
@SuppressWarnings("unused")
char M8 = MAC.charAt(7);
char M9 = MAC.charAt(8);
char M10 = MAC.charAt(9);
char M11 = MAC.charAt(10);
char M12 = MAC.charAt(11);
String tmpK1 = Integer.toHexString(Character.digit(S7, 16) + Character.digit(S8, 16) + Character.digit(M11, 16) + Character.digit(M12, 16));
String tmpK2 = Integer.toHexString(Character.digit(M9, 16) + Character.digit(M10, 16) + Character.digit(S9, 16) + Character.digit(S10, 16));
char K1 = tmpK1.charAt(tmpK1.length() -1);
char K2 = tmpK2.charAt(tmpK2.length() -1);
String X1 = Integer.toHexString(Character.digit(K1, 16) ^ Character.digit(S10, 16));
String X2 = Integer.toHexString(Character.digit(K1, 16) ^ Character.digit(S9, 16));
String X3 = Integer.toHexString(Character.digit(K1, 16) ^ Character.digit(S8, 16));
String Y1 = Integer.toHexString(Character.digit(K2, 16) ^ Character.digit(M10, 16));
String Y2 = Integer.toHexString(Character.digit(K2, 16) ^ Character.digit(M11, 16));
String Y3 = Integer.toHexString(Character.digit(K2, 16) ^ Character.digit(M12, 16));
String Z1 = Integer.toHexString(Character.digit(M11, 16) ^ Character.digit(S10, 16));
String Z2 = Integer.toHexString(Character.digit(M12, 16) ^ Character.digit(S9, 16));
String Z3 = Integer.toHexString(Character.digit(K1, 16) ^ Character.digit(K2, 16));
WlanKeygen.wpaKey = X1+Y1+Z1+X2+Y2+Z2+X3+Y3+Z3;
WlanKeygen.wpaKey = WlanKeygen.wpaKey.toUpperCase();
System.out.println("WPA-KEY: "+ WlanKeygen.wpaKey.toUpperCase());
} else {
WlanKeygen.output = "Error: MAC-Address must have 12 digits!";
}
WlanKeygen.output_vea = WlanKeygen.wpaKey;
WlanKeygen.output = "Standard key for router interface is root : 123456 ;-)";
return WlanKeygen.wpaKey;
}
public static void generate_standard(String SSID, String MAC) {
/*
* generate PW from Telekom, standard algorithm
* [WLAN-XXXXXX]
*/
WlanKeygen.DIR = "telekomstandard-" + SSID + ".txt";
if (SSID.contains("-")) {
SSID = SSID.replace("-", "");
}
SSID = SSID.toUpperCase();
if (MAC.contains(":")) {
MAC = MAC.replace(":", "");
}
MAC = MAC.toUpperCase();
WlanKeygen.DIR = System.getProperty("user.home") + System.getProperty("file.separator") + WlanKeygen.DIR;
//Wlankeygen.output = "File will be stored at " + Wlankeygen.DIR;
WlanKeygen.output_vea = "File will be stored at " + WlanKeygen.DIR;
try {
String a, b, c;
int x, y, z;
WlanKeygen.fw = new FileWriter(WlanKeygen.DIR);
for (x=0; x<10; x++) {
for (y=0; y<10; y++) {
for (z=0; z<10; z++) {
a = String.valueOf(x);
b = String.valueOf(y);
c = String.valueOf(z);
WlanKeygen.fw.write("SP-" + SSID.substring(8,9) + c + SSID.substring(9) + MAC.substring(9,12) + a + b + c);
WlanKeygen.fw.append(System.getProperty("line.separator"));
WlanKeygen.fw.flush();
}
}
}
} catch(Exception e) {
System.err.println(e);
}
}
public static void generate_explicit(String SSID, String MAC) {
/*
* generate PW from Telekom, "strong" algorithm
*/
WlanKeygen.DIR = "telekomexplicit-" + SSID + ".txt";
if (SSID.contains("-")) {
SSID = SSID.replace("-", "");
}
SSID = SSID.toUpperCase();
if (MAC.contains(":")) {
MAC = MAC.replace(":", "");
}
MAC = MAC.toUpperCase();
WlanKeygen.DIR = System.getProperty("user.home") + System.getProperty("file.separator") + WlanKeygen.DIR;
WlanKeygen.output = "File will be stored at " + WlanKeygen.DIR;
WlanKeygen.output_vea = "File will be stored at " + WlanKeygen.DIR;
try {
String a, b, c;
int x, y, z;
WlanKeygen.fw = new FileWriter(WlanKeygen.DIR);
for (x=0; x<10; x++) {
for (y=0; y<10; y++) {