Giter Club home page Giter Club logo

uncheat's Introduction

Anti Cheat Library (UNCHEAT)

このライブラリはあなたのPEファイルを適当に難読化します。
C/C++専用です。

使い方

必ず最初にbuild.batを実行して、出来上がったuncheatディレクトリを適当な場所に置きます。
ちなみに、想定しているディレクトリ構想は、

project
 ├─── main.cpp
 └─── uncheat
      ├─── libuncheat.a
      └─── uncheat.h

こんな感じです。

※コマンドは一例です。

g++ -o main.exe main.cpp -Iuncheat -L./uncheat -static -luncheat -Ofast -s -Wall -Wextra

コンパイルオプションについてもちゃんと意味はあります。わからないならLet's DuckDuckGo!

関数の使い方

anti_debug関数

ucl::anti_debug()は、ある程度のデバッグから回避しようとする関数です。

#include "uncheat/uncheat.h"

int main() {
    ucl::anti_debug();
}

使い方は簡単ですね。特にそれといった引数はなければ、戻り値もないです。
アンチデバッグの位置は適当な場所(デバックされやすい位置)に関数を置いてみるといいかもしれません。

uc関数(マクロ)

uc()はコンパイル時に文字列を難読化してくれます。アルゴリズムはxorやで()

#include <iostream>
#include "uncheat/uncheat.h"

int main() {
    std::cout << uc("Hello, World!") << std::endl;
}

sha256関数

hashは今のところsha256しかないです。
戻り値はなし。使い方はucl::sha256(hash化する値, hash化した物を入れる配列)です。
ちなみに、uc()で文字列をxorで暗号化しておくと全く別のhash値が出力されるのでこの場合uc()は使わない方がいいです。

#include <iostream>
#include "uncheat/uncheat.h"

int main() {
    const char *text = "Hello";

    char hash[SHA256_SIZE];
    std::cout << text << std::endl;

    ucl::sha256(text, hash);
    std::cout << hash << std::endl;
}

safe_int型

私はチーター向けに新しくsafe_int型を作りました。safeって名前を付けてますが、安全性は保証しません。あくまでもチート対策向けに作った型です。使い方は下のコードを見たらだいたいわかるでしょう。

#include <iostream>
#include <windows.h>
#include "uncheat/uncheat.h"

unsigned long randseed = 0x12345678 ^ GetTickCount();

int main() {
    ucl::safe_int hp_mob{ 9999 };
    ucl::safe_int hp{ 9999 }, ran, t;

    int n;

    while (1) {
        std::cout << "mob status" << std::endl;
        std::cout << "hp:" << hp_mob.get() << std::endl << std::endl;

        std::cout << "my status" << std::endl;
        std::cout << "hp:" << hp.get() << std::endl;

        std::cin >> n;

        switch (n) {
        case 1:
            ran = ucl::rand(randseed) % 1000;
            t = hp_mob;
            hp_mob = t - ran;
            std::cout << ran.get() << "ダメージあたえた" << std::endl;
            ran = ucl::rand(randseed) % 1000;
            t = hp;
            hp = t - ran;
            std::cout << ran.get() << "ダメージくらった" << std::endl;
            break;
        default:
            return 1;
        }

        if (hp_mob.get() <= 0) {
            std::cout << "GAME クリア!" << std::endl;
            break;
        }
        else if (hp.get() <= 0) {
            std::cout << "GAME OVER!" << std::endl;
            break;
        }

        std::cin.ignore();
        std::cin.get();
        system("cls");
    }

    std::cin.get();
    return 0;
}

safe_intは文字通りintです。long型でもなければdouble型でもないです。
safe_int型を多用しすぎますと、プログラムの処理が重くなります。理由は、内部でRSA暗号が組み込まれているからです。
バグなんかありましたら、教えてください。

参考にしたもの

ADVobfuscator
C++11 metaprogramming applied to software obfuscatio
Evasion - Anti-debugging
SHA-256
SHA-256 hash calculator
Unityでのチート対策を簡単かつ高品質に行う為の取り組み
SHA-1
SHA1 and other hash functions online generator
初学者向け!RSA 暗号の基礎とシミュレーションの実装
素数判定 in C/C++
skCrypter
Anti-Debug: Direct debugger interaction
AntiDBG
冪乗法
「1000000007 で割ったあまり」の求め方を総特集!

uncheat's People

Contributors

ware255 avatar

Stargazers

 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.