• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simpsons: Hit & Run JavaScript API

Simpsons: Hit & Run API

This code is in a pre-pre-pre-alpha experimental state.

This is a library to automate the abandonware game Simpsons: Hit & Run with JavaScript. It uses frida to access internal state, and exposes JavaScript classes that can be used to query and control the game.

The intention is to allow easy scriptable access to state, in a similar way to how pysc2 enabled deepmind to learn how to play Starcraft II. Eventually I'd like to be able to automate finding glitches, crashes, strategies, routes and so on for speedrunning.

This is a solo hobby project, I'm a long way off from that point.

Want to see it in action? Here is an early demo video using the debugging console.

Video

Want to see an example script? Here is a simple script that just finds objects and tries to break them!

examples/breakEverything.js

    // Move in current direction.
    step();

    // Did we find the object?
    if (myPos.distanceTo(object) <= 1) {
        console.log(`object discovered at ${myPos}`);

        // Try to break it lol
        slam(); kick(5);

        return true;
    }

If you let this script run long enough (e.g. overnight), it will literally try to kick every object on the map!

Update: here is another video.

Like this idea and want to help? Let me know!

Installation

You need frida intalled, if you already have python it couldn't be easier, something like:

pip install frida-tools

The full frida install documentation is here if you need it.

Note: You must be using python for Windows, not WSL python.

Building

You can use a pre-built version if you just want to write a JavaScript script and dont want to make any changes to sharapi.

This project mostly uses TypeScript, a language that transpiles to JavaScript but adds strong typing. I find this useful for avoiding bugs during development, but the output can be used with JavaScript or TypeScript, whichever you prefer.

You need typescript and rollup to build the script, or you can just use a prebuilt version. tsc is the typescript compiler, rollup takes all of the individual files, figures out the module dependencies and produces a single file to give to frida.

Note: This project uses submodules, remember to type git submodule update --init --recursive

I use WSL, and just type make to build the final output files with GNU make, because I'm more familiar with Makefiles. In future I'll figure out how to use tsconfig.json.

Usage

Run the game Simpsons.exe, you can use the launcher if you like, and type this:

python.exe inject.py Simpsons.exe

If you don't get any error messages, then frida was started and was injected into the game. To interact with it, open chrome and go to chrome://inspect and click the Open dedicated DevTools for Node link.

You should now have a JavaScript console connected.

Try it out!

Type this:

CoinManager.SpawnInstantCoins(0, 0, 0, 10)

Some coins should fly towards you.

Get into a car, and type this:

var v = (new Character()).GetVehicle()
var p = v.GetPosition()

// p is [x, y, z] co-ordinates of the car.
p.y += 10

v.SetPosition(p)

Your car should jump 100 ft in the air.

Scripts

If yout want to run a script, try one of the examples in the examples directory.

python.exe Simpsons.exe examples/breakEverything.js

Notes

I'm using the binary with md5 9009afe5ab6c2daf8605d8b613951902.

More Repositories

1

loadlibrary

Porting Windows Dynamic Link Libraries to Linux
C
4,330
star
2

ctypes.sh

A foreign function interface for bash.
C
2,060
star
3

ctftool

Interactive CTF Exploration Tool
C
1,636
star
4

123elf

A native port of Lotus 1-2-3 to Linux.
C
1,171
star
5

avscript

Avast JavaScript Interactive Shell
C
664
star
6

wpunix

WordPerfect for UNIX Character Terminals
C
615
star
7

rbndr

Simple DNS Rebinding Service
C
613
star
8

hotcorner

Tiny Hot Corners for Windows 10
C
380
star
9

nntpit

minimalist reddit2nntp gateway
C
231
star
10

rarvmtools

Minimal RarVM Toolchain
C
228
star
11

cefdebug

Minimal code to connect to a CEF debugger.
C
193
star
12

lotusdrv

Lotus 1-2-3 R4D Display Driver for DOSEMU
C
147
star
13

kiewtai

A port of Kaitai to the Hiew hex editor
C
144
star
14

swisstable

Access Abseil Swiss Tables from C
C
103
star
15

dbusmap

This is a simple utility for enumerating D-Bus endpoints, an nmap for D-Bus.
C
76
star
16

scanlimits

Tool to examine the behaviour of setuid binaries under constrained limits.
C
62
star
17

katamascii

An ascii-art physics puzzle, roll around your terminal collecting ascii-art objects!
C
43
star
18

timex

A hello world for the timex m851
C
31
star
19

minirun

Run commands with hidden console.
C
30
star
20

iknowthis

iknowthis Linux SystemCall Fuzzer
C
20
star
21

hiewdocs

Documentation and notes on using the Hiew editor.
HTML
17
star
22

mpgravity

MicroPlanet Gravity
C++
14
star
23

nssecurity

Netscape Plugin Security
C
8
star
24

defermap

Add a server mode to X11 clients
C
7
star
25

hiewkey

Keyboard helper for Hiew
C
4
star
26

wpdfilter

Enable Windows to Index WordPerfect UNIX Documents
C++
3
star
27

ncpro

Commandline Interface to NoteCase Pro
Shell
1
star
28

stfjson

Convert Lotus Agenda STF files to JSON
C
1
star