Giter VIP home page Giter VIP logo

llvm's Introduction

Hi there ๐Ÿ‘‹

Github Stats

Top Langs

โšก PL

C++ C# Rust Python JS

llvm's People

Contributors

deniskore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

llvm's Issues

Obfuscation quality

Hi @Deniskore
Thanks for sharing the project!
I have couple of questions.

  1. Whether I correctly understand that the '-obfuscate' parameter passed to the clang have to have the function name being obfuscated? In your example, clang is used as: clang -O2 file.cpp -mllvm -obfuscate="func1,func2"
    At the same time, your test app has only the 'main' function to be defined.
  2. I tried to pass the original parameter -obfuscate="func1,func2" as well as the -obfuscate="main" parameter for the '-target aarch64-linux-android' but the decompiled output looks as regular decompiled code without obfuscation.
    Below is the decompiled output
int __cdecl main(int argc, const char **argv, const char **envp)
{
  unsigned int v3; // w19
  unsigned int v4; // w20
  const char *v5; // x0
  __int64 v6; // x1
  __int64 v7; // x2

  v3 = rand();
  v4 = rand();
  printf("a=%d b=%d\n", v3, v4);
  printf("g=%d\n", v4 ^ v3);
  if ( (int)v3 <= (int)(v4 ^ v3) )
    printf("12345");
  printf("123456");
  printf("%d %p %d\n", (v4 ^ v3) + v3, &STACK[0xC160], (v4 ^ v3) + v3);
  printf("%d %d\n", 0xBC61BDLL, 0x96B43FLL);
  if ( v3 == v4 )
  {
    v5 = "a==b %d %d\n";
    v6 = v3;
    v7 = v3;
  }
  else
  {
    v5 = "a!=b %d %d\n";
    v6 = v3;
    v7 = v4;
  }
  printf(v5, v6, v7);
  return 0;
}

It would be nice to get your comments.

compilation issue on aarch64 ubuntu

hi, clang 14 unable to compile llvm/Transforms/Obfuscate/XorShift.h because __rdtsc ((x)intrin.h) doesn't exist on arm. I think fix is replacing __rdtsc() with __builtin_readcyclecounter()

Implementation as a plugin

How do you think whether it is possible to implement the obfuscator as a LLVM plugin?
It would be very flexible solution for using with different toolchains.
As an example, following project can be taken.
https://polarply.medium.com/build-your-first-llvm-obfuscator-80d16583392b
https://github.com/tsarpaul/llvm-string-obfuscator

The idea is clear and simple. First, we generate the bitcode then process the bitcode with our plugin and after that translate it to the native code.

clang -emit-llvm hello.c -c -o hello.bc
opt -load-pass-plugin=./build/StringObfuscator/libLLVMStringObfuscator.so -passes="string-obfuscator-pass" < hello.bc -o out.bc
llc out.bc -o out.s
clang -static out.s -o out

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.