piowind / Liberation

A runtime patching library for iOS. Major rework on unfinished branch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Liberation

Check the unfinished branch for a preview of things I am working on.

Liberation (formerly civ3) is a next generation code injection library for iOS cheaters everywhere. Unlike liberation's predecessor writeData, which was hardly ever updated and had tons of random edits floating around the net, Liberation will be updated regularly in this repo, and contributions are welcome from anyone (even if you aren't a member of ioscheaters)

Installation

To install Liberation, please follow these steps:

  • Download Liberation from the Releases page.
  • Copy the lib folder contents to $THEOS/lib
  • Copy the include folder to $THEOS/include
  • (Optional) copy the nic template folder to $THEOS/templates/ios/liberation

Usage

To use Liberation, follow these steps:

  • Inlcude <Liberation.h> in your Tweak.xm (or any other (obj)c++ file)
  • Use liberation functions in your tweak
  • Add YOURPROJECTHERE_CFLAGS += -std=c++11 to your makefile to enable c++11 (required by Liberation)
  • (Optional) Add TARGET_STRIP_FLAGS = -u -r -s /dev/null to the top of your makefile to strip your dylib (Recommended as Liberation will otherwise contain a lot of info about your tweak). Must build using make DEBUG=0 for symbols to be stripped
  • Add YOURPROJECTHERE_LIBRARIES = Liberation c++ to your Makefile

That's it!

Example

#include <Liberation.h>

void Init() {
    Settings settings("myPrefs.plist");

    // create patch from ARM hex
    Patch *goldPatch = Patch::CreatePatch(0x12345, 0x0000A0E1);
    // create patch from instruction string
    Patch *healthPatch = Patch::CreateInstrPatch(0x12346, "MOV RO, R7; BX LR");

    // create a hook patch
    Hook xpHook = Hook("__symbol", someFunc, &someOtherFunc);

    bool gold = settings["kGold"];
    if (gold) {
        goldPatch->Apply(); // applies patch
    }
    else {
        goldPatch->Reset(); // resets patch
    }
    int aVal = settings["kVal"]; // accessing an int from the plist
    float floatVal = settings["kFloat"]; // accessing a float from the plist
    xpHook.Apply(); // applies hook
    xpHook.Reset(); // resets hook
}

Building Liberation

Liberation currently isn't really built for self building. That said it should still be possible for you to build it yourself. (Please note you need a Mac with xcode and cmake installed)

To build liberation, clone this repo and cd to it, then run these commands:

./liberation setup

./liberation build

When built, there should be a libLiberation.a file in the /lib folder. Just place this in your theos lib folder to use.

License

//Copyright (c) 2016, Razzile

//Permission to use, copy, modify, and/or distribute this software for any purpose
//with or without fee is hereby granted, provided that the above copyright notice
//and this permission notice appear in all copies.

//THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
//REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
//FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
//INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
//OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
//TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
//THIS SOFTWARE.

About

A runtime patching library for iOS. Major rework on unfinished branch


Languages

Language:C++ 49.2%Language:CMake 40.3%Language:Objective-C 4.5%Language:Objective-C++ 3.5%Language:Shell 2.5%