Java Mechanic

Because sandboxes are for children.


Java Mechanic is a Java application (and signed applet!) that can load other Java applications and applets. Modify public, private and protected fields and activate methods while the target application is running. Also decompiles, recompiles, or saves any loaded objects or source code. Using a built in java code interpreter, Java Mechanic can create and instantiate new Java objects on the fly.

A tad bit scary, actually.


Java Mechanic is self-contained in a single jar file, and there is nothing to install, or extract. It's best run from it's own directory, as it will create and extract any necessary files on the fly.

Features
Tips
Important Commands
Online Demo
Project Information
History


Features

  • HSQLDB
    Contains the HSQLDB, a very fine open source database.



  • Dynamic Java Interpreter
    Examine and change Java objects while they are running. You can even modify those pesky private and protected variables with this.


  • Save and load objects to XML with JSX
    Save and load running objects. Must have the proper classpaths set to reload an object. The classpath can include URL's of jar files and directories on the internet.


  • JODE Decompiler
    Built in class file decompiler. Decompile by variable name, by full class name, or even browse the classpath.
  •   The classpath must include any classes you would like to decompile.

  • J
    Inclusion of a very nice text editor, in my opinion it is the best available.

  • J-FTP
    Inclusion of a powerful FTP, SFTP, SMB, and HTTP downloading client.

  • Jetty
    A fully configureable JSP/Web server. Powerful.

  • XNap
    Peer 2 peer networking

  • Applet loader
    Loads an applet into the interpreter, allowing you to run, decompile and modify the source classes from anywhere on the internet.

  • Application loader
    Include a jar file in the classpath, and you can load, run and modify applications. Or use the loadclass command to dynamically load classpaths.


  • Dynamic classpath loader
    Add entries to the classpath on the fly.


  • Signed with security certificate
    Allows Java Mechanic to run unrestricted as an applet in a web browser.
  •   If you examine the details of the certificate, you will notice the email address "raver1975@excite.com", this is how you can check that this class is from me.

  • Console window
    Edit and run Java source code with this window.

  • Reflector window
    Examine an objects most private values. Used to look at the contents of the interpreter, Use the tree on the left to navigate running objects. Now allows you to automatically decompile and recompile the source code of any object.
  •  
  • Redirected output
    System.out and System.err conveniently redirected to a window.


  • Custom security manager
    Customize the security manager to your preferences. All permissions are granted by default.


  • Web Browser
    Includes a (very) simple web browser with "web" command, or use your native browser with the "webn" command .


Tips

  • Optimum running platform
    Java Mechanic has been designed and tested with:
    Sun Java 1.4.2 on Windows XP.
    You may run into platform specific bugs, so your mileage may vary.
    Please let me know if something doesn't seem to work right for you, it may be a platform specific bug.

  • Dynamic command creation
    In a new console (type "console") window, paste and execute this:

    package commands;   
    import javax.swing.*;
    public class test extends Commands{
      public void help(){return "help info";}
      public void run(){
        //your code here
        main.out(in);
        //main.out(String in) prints in to the main window.
      }
    }

    Type in whatever action you'd like to happen in the run() method. Remember to use the import statement for included classes and use the command "loadclass CLASS|JAR|URL" to include any outside classes. Main main and String in are your two program variables to work with. This program just echoes your input back to you when you use the freshly created command "test STRING".

  • Saving console source code
    Click the "Save" button.
    A new String object is then created with the contents of that window in the variable src####.
    Use the command "savesrc src#### file.java" to write the String contents to a file.
    The command "loadsrc file.java" will load AND THEN EXECUTE the java code back in the interpreter.

  • System.exit(0); disabled
    Has been disabled to keep other program's System.exit(0); from shutting Java Mechanic down. The only allowable way to shutdown fully is with a System.exit(100);.

  • Bootup files
    There are two files that Java Mechanic tries to load at startup:
    JavaMechanicDesktop - The saved desktop, use the command "desktop save" to generate one.
    JavaMechanicBoot - This is a script file that executes on startup. Script files contain one command per line, and also any one line Java code gets executed as a command.


Important Commands

  • help
    Type "help" in the Java Mechanic to see the full command list.



  • applet URL
    Given a web page, Java Mechanic will try to load the embedded applet into the interpreter. A new console window is created with some applet stub code. Examine the parameters and then click "execute" to start the applet.
  •  

  • console
    Opens the interpreter window, this is where you can execute Java code.

    Example: b=new Alert("test");
    Sets variable b as a new class of type Alert.

    Example: System.out.println("test");
    Prints "test" to STDOUT.

    Example: globe.Globe.main(new String[0]);
    Starts the main method of class globe.Globe, with no arguments.


  • desktop
    Opens the desktop window. The desktop can encapsulate commands and scripts into a button, and strip (facelift) the GUI out of any other Java application. Set up the desktop to your specifications and use "desktop save" to keep it.


  • facelift CONTAINER/COMPONENT/FRAME/JFRAME
    Strips the GUI elements out of a container and imports them into the desktop.


  • jode
    Opens the JODE decompiler window.


  • loadclass URL|JAR|CLASS
    Dynamically loads classes onto the classpath, for object creation and decompilation.


  • out
    Opens the system output window. If a command is not working for you, this is where you'd find out why. All error and system output messages are redirected here.


  • reflect
    Opens the reflector window. This window allows you to examine all the information about your variables. Variable "main" is automatically set as the running Java Mechanic, so you can inspect and change the Java Mechanic  program, while it is running.
  • Use the tree on the left to navigate, and the object information will show up on the right.

  • reset
    The built in interpreter can only create new variables and never delete them. Reset allows you to start out fresh again.


  • security
    Opens the security manager. Allows you to customize your security level.
     
  • threads
    Lists all running daemons and threads.  Double click on any one to stop it.


Full Command List:
a                               again - loads up your last command
about
applet URL tries to load a remote applet. Click 'Execute' to continue...
cd DIRECTORY change directory
ce class editor
classpath lists loaded classpath
clr clear this screen
compile FILE|NULL compiles FILE.java to FILE.class file or enter code to compile into CLASS.class
console type in straight java code to execute with this
db DATABASE PORT start a SQL DATABASE server listening on PORT
dbman USER PASSWORD Database manager - Default Admin account USER name is 'sa', PASSWORD is '' (null)
del FILE delete FILE
desktop [save|load] expiremental desktop feature - screen scrape other applications - store commands inside buttons - move AWT and Swing features around
dir returns list of current directory
ekit Ekit HTML editor
exec FILE execute system commands
exit
facelift CONTAINER|JFRAME screen scrape into destop
help
hide j [FILE] powerful code editor
javadoc PACKAGE [PACKAGE...] requires access to javadoc from a JDK, and make sure you are in the source directory
javadocview
jcards [FILE] simple database to keep track of the looser things in life
jetty turn on a HTTP(web page) server, with root being the same directory that JavaMechanic#.#.jar is started from - examine jetty.xml to change this and other settings
jftp amazing FTP and network browser
jode this would decompile the paint off your walls
load OBJECT FILE restores a saved OBJECT from FILE
loadclass PATH|FILE|URL use this to load jars and classes into the current classpath
loadsrc FILE runs source code saved in FILE
mem how much memory being consumed
mkdir DIRECTORY make a new directory
out all system output is gathered in here
prop [SYSTEM_PROPERTY VALUE] prop by itself will show you the system properties - otherwise sets properties
quit
reflect shows in realtime the values of fields of java objects - browse running objects
reflect2 different style of reflector - double click entries on the left to drill deeper
ren OLDFILE NEWFILE rename files
reset resets the realtime interpreted Java environment used by console and reflectors - close all those windows beforehand
save OBJECT FILE save an OBJECT into FILE
savesrc STRINGOBJECT FILE saves any string into FILE - IE: a=new String("test"); save a test.txt
script FILE runs JavaMechanic commands and Java code saved from FILE
security feeling a little naked? turn back on some of Java's built in security features
threads see which threads are running and put a stop to them
view FILE quick text view of file
web built in HTML browser
webn URL tries its best to open your native internet browser
whoami ip address xnap peer 2 peer networking
xor PASSWORD FILE exclusive-or a file into a random stream - exclusive-or that FILE with the same PASSWORD to restore it

Online Demo

WARNING!!!
This will load the Java Mechanic in your browser with unrestricted security, if you grant it permission. This allows the program to connect to the internet, save files, and interpret Java source code. Since this program can interpret any Java commands typed into it, you could theoretically cause major mayhem on your system with the wrong commands. Also any applets or applications loaded into the Java Mechanic will run without security restrictions. Please be careful!  Java Mechanic by default will ignore most all security checks, totally stepping out of the "sandbox" it would normally be confined to.

DISCLAIMER!!!
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. I will not be held responsible for any damages caused by this program, this program is provided "as is". Proceed at your own risk.

Java Mechanic Applet (~15 MB download.)

Java Mechanic Web Start

Note: The help command and the decompiler rely on Java being to find the location of the downloaded JavaMechanic2.x.jar file. Sometimes it's not always so easy to find in an applet or webstart context. In that case, you won't get the full functionality unless you run this as an application, or you could do a manual search for the downloaded jar file, and then use the loadclass command to load it onto the classpath.


Project Information

Java Mechanic project page

Java Mechanic download page

Licenses


History

  • 4.4.4 - Java Mechanic 3.0
    XNap peer to peer networking
    Jetty personal web server
    calculators
    HTML Editor
    improved help for commands
    improved built in web browser
  • 3.22.4 - Java Mechanic 2.4
    Fixed a bug that prevented Java Mechanic from loading in Linux. Added the Class Editor application. Updated to newest version of J-FTP.

  • 8.13.3 - Java Mechanic 2.3
    Fixed the save function in the console window, plus added a new compile command. Now compiles java source code without needing the javac tool.

  • 7.30.3 - Java Mechanic 2.1
    Completely refactored, and some parts redesigned. Updated the reflect window, it will now decompile and recompile the source code of any object. Loading applets over the network works a lot better now.
    Contains:
    Interpreter
    Decompiler
    Recompiler
    Editor
    FTP
    Database
    Object saving and loading in XML
    Applet Loader
     


©MMIV Paul Klemstine



SourceForge.net Logo