Git Product home page Git Product logo

castle-builders's Introduction

Castle Builders

SWF decompilation tool, written for Castle Crashers

Goals

  • Lexer
    • Main.swf opcodes
    • All opcodes
  • Parser
    • To P-Code
    • To Actionscript
      • Expressions
      • If Else
      • If Else If
      • Ternary If Else
      • Switch case
      • While loop
      • Do While
      • Loop in loop
      • For loop
      • Arithmic precedence
      • String handling
      • Unknown byte handling
    • To Bytes
  • Reading SWF
    • Code
    • Assets
    • Other
  • Writing SWF
    • Code
    • Assets
    • Other
  • Runtime
    • One file
    • Multiple files
  • Fix Sly issues
    • WARNING: shift/reduce conflicts
    • spaces / newlines
    • DRY code

Usage

Doesn't actually accept SWF's just yet

$ python runtime.py {filename.swf}

P-Code

$ python runtime.py {filename.swf} --pcode

Tests

$ python -m unittest discover

Decompilation Example

Bytes in SWF

88 06 00 01 00 66 69 62 00 8e 0e 00 66 69 62 00 01 00 02 2a 00 01 6e 00 58 00 96 02 00 04 01 96 05 00 07 02 00 00 00 48 12 9d 02 00 0a 00 96 02 00 04 01 99 02 00 39 00 96 02 00 04 01 96 05 00 07 01 00 00 00 0b 96 05 00 07 01 00 00 00 96 02 00 08 00 3d 96 02 00 04 01 96 05 00 07 02 00 00 00 0b 96 05 00 07 01 00 00 00 96 02 00 08 00 3d 47 3e 00

Decompiled ActionScript

function fib(n)
{
  return n < 2 ? n : fib(n - 1) + fib(n - 2);
}

Links

castle-builders's People

Contributors

a1rpun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.