Giter VIP home page Giter VIP logo

luaexample's Introduction

Lua Obfuscator REST API Example

LuaObfuscator.com is a neat online Lua obfuscation platform that comes with some basic yet powerful obfuscation techniques. They do offer a REST API which is what this example project is all about. This repository demonstrates how to integrate the REST API into a GitHub repository using GitHub Actions.

๐Ÿ‘€ Demo

To automate the obfuscation of the src/loader.lua file using the config/loader.json I used a few basic Unix utils in a bash script. The results can be found on this GitHub Actions page.

๐Ÿ“ Setup

To get started, you will need to create a new workflow file and populate it as follows:

Give it a name and define when it should trigger.

name: Publish Lua (obfuscated)

on:
  push:
    branches: [ master, actions ]

Next, add a job and specify a target platform. For our use case, we will stick with just ubuntu-latest.

    jobs:
    build:

        runs-on: ubuntu-latest

Next, we will need to add a few steps, starting with actions/checkout@v3 to access our git files

    steps:
      - uses: actions/checkout@v3

To install our dependencies, we will be using curl for the HTTP requests and jq to handle the JSON formatting.

      # make sure its installed?
      - name: Install dependencies
        run: |
            sudo apt-get install jq curl -y

Finally, we have come to the juicy part where we perform the REST API calls and process the response. The below snippet will grab the src/loader.lua file and applies the config/loader.json as its configuration.

      # Obfuscate src/loader.lua > public/loader.lua
      - name: LuaObfuscator REST API
        shell: bash {0}
        run: |
            mkdir public
            curl -X POST https://luaobfuscator.com/api/obfuscator/newscript \
            -H "Content-type: application/json" \
            -H "apikey: test" \
            --data-binary "@src/loader.lua" \
            | curl -X POST https://luaobfuscator.com/api/obfuscator/obfuscate \
            -H "Content-type: application/json" \
            -H "apikey: test" \
            --data "@config/loader.json" \
            -H "sessionId: $(grep -o -P '(?<="sessionId":").*(?="})')" \
            | jq -r ".code" \
            > public/loader.lua

Last but not least, we need to create an artifact of our files as we can download them once our container is destroyed. Do so using actions/upload-artifact@v1.

      # publish public/loader.lua
      - name: Create artifact
        uses: actions/upload-artifact@v1
        with:
          name: release_protected
          path: public/

๐Ÿงช Example

The complete version of the above script can be found at .github/workflows/luaobfuscator.yml

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.