Java Cheat Framework

From The Bytecode Club Wiki
Jump to: navigation, search
Java Cheat Framework
Java Macros & Automation
Author Kalen (Konloch) Kinloch
Homepage The.Bytecode.Club
Download Currently Private
Source Code Currently Closed Source
Issues Currently Private

Java Cheat Framework is a private soon-to-be-released cheat framework written in Java. It contains a main script editor where you can create macro scripts with Janino to target Java 1.6. Right now it's used to bot OldSchool Runescape but the API is designed to work for any task you'd like to be automated.

Media

Coming soon.

API

Once JCF starts a script, a new Java process will be spawned (unless one is already running for that JCF instance). This Java process communicates back to the original Java process via a Socket API. This allowed us to create an Android client to monitor and control JCF live, no matter where you are. (iOS will be added eventually)

The core API is broken into two parts, the Macro API and the IOSource API.

Macro API

The macro API is what you would expect from a colorbot, we modeled our API to be familiar and easy to use. The main entry point to the entire API is to call on 'Macro' from there you can call on the following.

Macro.getImage() // Related to image searching
Macro.getKeyboard() // Related to controlling the keyboard
Macro.getMouse() // Related to controlling the mouse
Macro.getSearching() // Related to preforming more detailed searches

For example, heres a script

/**
 * Simple auto clicker, press SHIFT to set the position to click, then press CTRL to start/pause it
 * 
 * @author Konloch
 *
 */
@ScriptDescription(
	    name		= "Simple Auto Clicker",
	    version		= 1.0D,
		APIVersion	= 0.1D
	)
public class WholeComputerSimpleAutoclicker extends Script
{
 
	private WholeComputerSourceSmart smart = new WholeComputerSourceSmart();
	private boolean click = false;
	private Point lastPosition = null;
 
	@Override
	public void onStart()
	{
		smart.setSpeedFast();//setSpeedHuman normally
		Macro.setSource(smart);
		Macro.getMouse().setMouseOffset(13);
 
		this.setLoopMedian(400 + Macro.getRandom().nextInt(800));
 
		this.addComputerEvent(new ComputerEvent()
		{
			@Override
			public void globalKeyPressed(int keycode, int modifier)
			{
				System.out.println("K:" + keycode);
				if (keycode == NativeKeyEvent.VC_CONTROL_L || keycode == NativeKeyEvent.VC_CONTROL_R)
				{
					click = !click;
					if(lastPosition == null)
						lastPosition = Macro.getMouse().getPosition();
				}
 
				if (keycode == NativeKeyEvent.VC_TAB)
				{
					lastPosition = Macro.getMouse().getPosition();
				}
			}
		});
	}
 
	@Override
	public void onPause()
	{
	}
 
	@Override
	public void onResume()
	{
	}
 
	@Override
	public void onStop()
	{
	}
 
	@Override
	public void onPaint(Graphics g)
	{
	}
 
	@Override
	public void onLoop()
	{
		if(click)
		{
			Macro.getMouse().moveTo(lastPosition);
			Macro.getMouse().clickLeft(60 + Macro.getRandom().nextInt(70));
			sleep(2000, 2800);
		}
	}
}

As you've noticed there is a graphics onPaint API, for more information about that scroll down to the Tools section and check out the PaintBuilder.

IOSource API

As you saw earlier from the example script, most generic scripts are written to be ran with the 'WholeComputer' IOSource. However there is a 'CanvasSource' that is used to override the Java Canvas class to support image reading along with IO Event spoofing. All of the IOSources support a 'Smart' mode that uses bezier curves and other fun-shit in an effort to provide an 'antiban'.

Game Specific APIs

Obviously each game handles things differently, because of this the approach we took was to create an API specific to each game. Until it's open sourced the only officially supported game will be OSRS.

Antibans, LoginManagers and the bullshit concept of "Anti-Patterns" are implemented.

Tools

JCF contains several tools to assist with script development.

Base64 Utility

A simple little tool to create files from base64 strings and grab base64 value of files.

Developer's Utility

Used to assist in grabbing a quick screenshot/color value/mouse position.

Bot Settings

Used to have a secondary window to view the bot as well as set the Game Specific API settings such as account details and break handler.

PaintBuilder

Designed for the CanvasIOSource. Based off of Enfilade's Easel this paint builder allows you to drag and drop UIs and then generate the code to be ran for JCF.

ColorHelper

Used to debug/live highlight on the screen certain pixels/images/coords you select. It then allows you to generate code such as paint on screen or move the mouse to and click on.