• Stars
    star
    379
  • Rank 113,004 (Top 3 %)
  • Language
  • License
    Other
  • Created about 4 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An anti-hacking compiler forked from the ollvm (https://github.com/obfuscator-llvm/obfuscator)

DeClang

ζ—₯本θͺžγ―こけら

Introduction

DeClang is an anti-hacking compiler based on LLVM project and extended the OSS project ollvm (https://github.com/obfuscator-llvm/obfuscator).

We open sourced some of the obfuscation features of DeClang for now. Some other features might be open sourced in the future.

難θͺ­εŒ–

DeClang is a compiler based anti-hack solution and has a lot of advantages over packer based solution. For the detailed comparison, please refer to the following document. https://www.slideshare.net/dena_tech/declang-clang-dena-techcon-2020

Supported Architecture

Supported host architecture

  • x64 macOS
  • x64 Linux
  • x64 Windows

Supported target architecture

  • arm / arm64 ELF (Android)
  • arm / arm64 Mach-O (iPhone)
  • x86 / x64 ELF (Linux)
  • x86 / x64 Mach-O (macOS)

Build

$ git clone https://github.com/DeNA/DeClang
$ cd DeClang/script
$ bash build.sh
...
$ bash build_tools.sh
...
$ bash release.sh v1.0.0
...

Then you have a Release-v1.0.0 folder in the root directory of DeClang.

If you are building DeClang on Windows, you have to install MYSYS2 and run the above script in MYSYS2 shell. Also, Visual Studio 2017 is required for build.

Installation & Setup

  • Define DECLANG_HOME environment variable

    export DECLANG_HOME=/path/to/declang_home/
    
  • Copy Release folder to $DECLAHG_HOME

    • If you built DeClang by yourself
      • Copy Release-v1.0.0 to $DECLANG_HOME/.DeClang.
      mv Release-v1.0.0 $DECLANG_HOME/.DeClang
      
    • If you downloaded pre-built binary from Releases page.
      • Decompress the zip file and copy the Release folder to $DECLANG_HOME/.DeClang.
      mv Release/ $DECLANG_HOME/.DeClang
      
  • Setup DeClang for android-ndk:

    bash $DECLANG_HOME/.DeClang/script/ndk_setup.sh {/path/to/ndk_root}
    

    Recover the original NDK:

    bash $DECLANG_HOME/.DeClang/script/ndk_unset.sh {/path/to/ndk_root}
    
  • Setup DeClang for Xcode:

    bash $DECLANG_HOME/.DeClang/script/xcode_setup.sh -x {/path/to/Xcode.app} -p {/path/to/xcodeproject.xcodeproj}
    

    Recover the original xcode project file:

    bash $DECLANG_HOME/.DeClang/script/xcode_unset.sh {/path/to/xcodeproject.xcodeproj}
    
  • Setup DeClang for WebGL Build of Unity:

    bash $DECLANG_HOME/.DeClang/script/webgl_setup.sh {/path/to/unity_webgl_support}
    

    Recover the original WebGLSupport directory:

    bash $DECLANG_HOME/.DeClang/script/webgl_unset.sh {/path/to/unity_webgl_support}
    
  • Now you can build your project using your usual build pipeline.

Configuration

  • Edit config.pre.json in $DECLANG_HOME/.DeClang/ folder:

    vi $DECLANG_HOME/.DeClang/config.pre.json
    
    key description value type
    build_seed default seed to be used by obfuscation string
    overall_obfuscation strength of simple obfuscation for overall code integer 0-100 (default 0)
    flatten[name] function name to be flatten-obfuscated regex string
    flatten[seed] seed to be used by flatten-obfuscation 16-digit hexadecimal string
    flatten[split_level] level to split Basic Block for flatten-obfuscation integer (default 1)
    enable_obfuscation enable/disable flatten-obfuscation integer 0-1 (default 1)
  • Generate config.json from config.pre.json:

    $DECLANG_HOME/.DeClang/gen_config.sh -path $DECLANG_HOME/.DeClang/ -seed {your seed}
    

    "seed" can be any string. You should change "seed" for each build.

Unity Support

If you are building your Unity project using command line then set the DECLANG_HOME in command line is sufficient. But if you are building a Unity project using GUI, you should set the DECLANG_HOME environment variable in your build script:

System.Environment.SetEnvironmentVariable("DECLANG_HOME", "/path/to/DeClang/");

Notes

  • If you do not set DECLANG_HOME, DeClang will use the default directory ~/.DeClang/
  • Note that usually DeClang for NDK and DeClang for Xcode might not be compatitable with each other so when you install & setup DeClang for different architecture please make sure you are using the correct DeClang version.
  • When building the Android library using Gradle, run ndk_setup.sh according to the ndkVersion listed in build.gradle. Also, please enable the optimization by mentioning set(CMAKE_CXX_FLAGS_RELEASE "-O2") in the CMakefile.txt file. If DeClang does not enable optimization, the process will not be passed to LLVM Pass, which performs obfuscation.

More Repositories

1

HandlerSocket-Plugin-for-MySQL

HandlerSocket is a NoSQL plugin for MySQL, working as a daemon inside the mysqld process, to accept tcp connections, and execute requests from clients. HandlerSocket does not support SQL queries; instead it supports simple CRUD operations on tables.
C++
1,132
star
2

PyTorch_YOLOv3

Implementation of YOLOv3 in PyTorch
Python
433
star
3

Chainer_Realtime_Multi-Person_Pose_Estimation

Chainer version of Realtime Multi-Person Pose Estiamtion
Python
431
star
4

PacketProxy

A local proxy written in Java
Java
429
star
5

SRCNNKit

CoreML and Keras implementation of Super-Resolution Convolutional Neural Network (SRCNN)
Python
387
star
6

HandyRL

HandyRL is a handy and simple framework based on Python and PyTorch for distributed reinforcement learning that is applicable to your own environments.
Python
282
star
7

Chainer_Mask_R-CNN

Implementation of Mask R-CNN in Chainer
Python
140
star
8

nota

Web application for image and video labeling and annotation
JavaScript
112
star
9

Anjin

Autopilot tool for games made with Unity
C#
99
star
10

unity-meta-check

A tool to check problems about meta files of Unity
Go
81
star
11

techcon_app

TechCon App
Dart
57
star
12

HEVCPlayerView

C++
46
star
13

android-modern-architecture-test-handson

Kotlin
30
star
14

codelabs

DeNAγŒδ½œζˆγƒ»ε…¬ι–‹γ—γ¦γ„γ‚‹γ‚³γƒΌγƒ‰γƒ©γƒœγ§γ™γ€‚
Kotlin
28
star
15

cocoa-checker

COCOA(Covid-19 Exposure Notification System in Japan) Signal Checker / COCOA(Covid-19ζŽ₯触璺θͺγ‚’γƒ—γƒͺ)ε‹•δ½œγƒγ‚§γƒƒγ‚«γƒΌ
HTML
25
star
16

aelog

App Engine Logger
Go
24
star
17

ChainerPruner

ChainerPruner: Channel Pruning framework for Chainer
Python
21
star
18

devfarm

Tools to control iOS and Android mobile apps across several device farms
Go
20
star
19

Face2Speech

20
star
20

setup-job-workspace-action

An action creating a virtual workspace directory for each job
TypeScript
20
star
21

tflite-runtime-builder

Build TensorFlow Lite runtime with GitHub Actions
20
star
22

thrush

Some useful additions to bluebird for Node.js
JavaScript
16
star
23

punctual

Redis-backed Node.js task queue for delayed job processing
JavaScript
15
star
24

dworker

Distributed worker system.
JavaScript
11
star
25

capistrano-net_storage

Capistrano Plugin for Fast Deployment via Remote Storage
Ruby
10
star
26

cloud-datastore-interceptor

Interceptors for Cloud Datastore
Go
10
star
27

Dena.CodeAnalysis.Testing

TDD friendly test helpers for Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer
C#
9
star
28

mysql_rewinder

Ruby
8
star
29

aehcl

App Engine Http Client
Go
7
star
30

mobilize-server

Mobilize-Server includes deployment scripts via Capistrano and scheduling via whenever.
Shell
7
star
31

FBStackableURLCache

A more pluggable version of Apple's NSURLCache. Implement a filtering webbrowser, or even your own version of Amazon Silk…
Objective-C
6
star
32

digdag-operator-bq-wait

Java
6
star
33

m_logger

Ruby
6
star
34

FBFramedScrollableView

UIView subclass that manages any type of UIKit scrollable view, automatically animating a header and footer as you scroll.
Objective-C
6
star
35

mobilize-base

Mobilize is a script deployment and data visualization framework with a Google Spreadsheets UI. Mobilize uses Resque for parallelization and queueuing, MongoDB for caching, and Google Drive for hosting, user input and display.
Ruby
6
star
36

rubycf

Ruby bindings for native Property List read/writing using Core Foundation or CFLite
C
5
star
37

asyncgraph

asyncgraph is a very simply module for controlling flow between asynchronous code.
JavaScript
5
star
38

IsarTutorial

Isabelle
4
star
39

PacketProxyPlugin

Plugins for PacketProxy
Java
4
star
40

ommonitor

Open Match Ticket Monitor
Go
4
star
41

mobilize-ssh

Mobilize-Ssh adds the power of ssh to mobilize-base.
Ruby
4
star
42

ubuntu22-mysql-q4m

Dockerfile
4
star
43

RoslynAnalyzerTemplate

C#
3
star
44

capistrano-deploy_locker

Capistrano Plugin to Lock Deployment
Ruby
3
star
45

redis_info

A Scout plugin to monitor redis by using the redis-cli info command
3
star
46

PacketProxyHub

Web service for sharing configs of PacketProxy
Java
3
star
47

Login-Toboggan-Android

Java
2
star
48

mobilize-hdfs

Adds hdfs support for mobilize-ssh
Ruby
2
star
49

kobold_ruby

Tools for working with and writing tests in Ruby, Rails and Sinatra
Ruby
2
star
50

capistrano-net_storage_demo

Example application for Capistrano::NetStorage
Ruby
1
star
51

aemw

App Engine Middleware
1
star
52

mobilize-hive

adds hive support to mobilize-hdfs
Ruby
1
star
53

unity-meta-check-bins

Pre-built binaries of unity-meta-check for Windows/Linux/macOS
Shell
1
star
54

capistrano-net_storage-s3

Capistrano::NetStorage Plugin for Deployment via Amazon S3
Ruby
1
star
55

Login-Toboggan-iOS

Objective-C
1
star
56

mono-login-sample

C#
1
star
57

mempatch

Memory tampering tool for security assessment
C++
1
star