├── .gitignore
├── CMakeLists.txt
├── Images
├── After.png
└── Execution.png
├── LLVMBuild.txt
├── Noctilucence.cpp
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(LLVM_LINK_COMPONENTS
2 | ${LLVM_TARGETS_TO_BUILD}
3 | BitReader
4 | IRReader
5 | Core
6 | Support
7 | Object
8 | Linker
9 | AsmPrinter
10 | CodeGen
11 | MC
12 | Passes
13 | AggressiveInstCombine
14 | Coroutines
15 | IPO
16 | InstCombine
17 | Instrumentation
18 | ScalarOpts
19 | TransformUtils
20 | Vectorize
21 | ObjCARCOpts
22 | Obfuscation
23 | SelectionDAG
24 | Target
25 | )
26 | add_llvm_tool(Noctilucence
27 | Noctilucence.cpp
28 | DEPENDS
29 | intrinsics_gen
30 | )
31 | target_link_libraries(Noctilucence PRIVATE xar)
32 |
--------------------------------------------------------------------------------
/Images/After.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HikariObfuscator/Noctilucence/071386a7ecb26b86c4bc06d9f6027c5e81da8514/Images/After.png
--------------------------------------------------------------------------------
/Images/Execution.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HikariObfuscator/Noctilucence/071386a7ecb26b86c4bc06d9f6027c5e81da8514/Images/Execution.png
--------------------------------------------------------------------------------
/LLVMBuild.txt:
--------------------------------------------------------------------------------
1 | ;===- ./tools/Noctilucence/LLVMBuild.txt ---------------------------*- Conf -*--===;
2 | ;
3 | ; The LLVM Compiler Infrastructure
4 | ;
5 | ; This file is distributed under the University of Illinois Open Source
6 | ; License. See LICENSE.TXT for details.
7 | ;
8 | ;===------------------------------------------------------------------------===;
9 | ;
10 | ; This is an LLVMBuild description file for the components in this subdirectory.
11 | ;
12 | ; For more information on the LLVMBuild system, please see:
13 | ;
14 | ; http://llvm.org/docs/LLVMBuild.html
15 | ;
16 | ;===------------------------------------------------------------------------===;
17 |
18 | [component_0]
19 | type = Tool
20 | name = Noctilucence
21 | parent = Tools
22 | required_libraries = Analysis BitReader BinaryFormat Support Passes AggressiveInstCombine Coroutines IPO InstCombine Instrumentation Scalar Utils Vectorize ObjCARC Obfuscation all-targets
23 |
--------------------------------------------------------------------------------
/Noctilucence.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * LLVM Bitcode Recompiler
3 | Copyright (C) 2017 Zhang(https://github.com/Naville/)
4 | Exceptions:
5 | Anyone who has associated with ByteDance in anyway at any past, current,
6 | or future time point is prohibited from direct using this piece of
7 | software or create any derivative from it.
8 |
9 |
10 | This program is free software: you can redistribute it and/or modify
11 | it under the terms of the GNU Affero General Public License as published
12 | by the Free Software Foundation, either version 3 of the License, or
13 | any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU Affero General Public License for more details.
19 | You should have received a copy of the GNU Affero General Public License
20 | along with this program. If not, see .
21 | */
22 | #include "llvm/ADT/Triple.h"
23 | #include "llvm/Analysis/TargetLibraryInfo.h"
24 | //#include "llvm/CodeGen/CommandFlags.inc"
25 | #include "llvm/CodeGen/MachineModuleInfo.h"
26 | #include "llvm/CodeGen/TargetPassConfig.h"
27 | #include "llvm/IR/DataLayout.h"
28 | #include "llvm/IR/IRPrintingPasses.h"
29 | #include "llvm/IR/LLVMContext.h"
30 | #include "llvm/IR/LegacyPassManager.h"
31 | #include "llvm/IR/Module.h"
32 | #include "llvm/IR/Verifier.h"
33 | #include "llvm/IRReader/IRReader.h"
34 | #include "llvm/Linker/Linker.h"
35 | #include "llvm/Object/Archive.h"
36 | #include "llvm/Object/COFFImportFile.h"
37 | #include "llvm/Object/ELFObjectFile.h"
38 | #include "llvm/Object/MachOUniversal.h"
39 | #include "llvm/Object/ObjectFile.h"
40 | #include "llvm/Support/CommandLine.h"
41 | #include "llvm/Support/FileSystem.h"
42 | #include "llvm/Support/Format.h"
43 | #include "llvm/Support/Path.h"
44 | #include "llvm/Support/PrettyStackTrace.h"
45 | #include "llvm/Support/Program.h"
46 | #include "llvm/Support/ScopedPrinter.h"
47 | #include "llvm/Support/Signals.h"
48 | #include "llvm/Support/SourceMgr.h"
49 | #include "llvm/Support/TargetRegistry.h"
50 | #include "llvm/Support/TargetSelect.h"
51 | #include "llvm/Support/raw_os_ostream.h"
52 | #include "llvm/Target/TargetOptions.h"
53 | #include "llvm/Transforms/IPO/PassManagerBuilder.h"
54 | #include
55 | #include
56 | #include
57 | #include
58 | #include
59 | #include
60 | #include
61 |
62 | using namespace llvm;
63 | using namespace llvm::sys;
64 | using namespace llvm::sys::fs;
65 | using namespace llvm::object;
66 | using namespace std;
67 | static cl::opt DumpIR("dump-ir", cl::init(false), cl::NotHidden,
68 | cl::desc("Dump Obfuscated IR."));
69 | static cl::opt OutputFilename("o", cl::desc("