https://github.com/monkbai/DNN-decompiler Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + By Plan + Enterprise + Teams + Compare all + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} monkbai / DNN-decompiler Public * Notifications * Fork 0 * Star 26 BTD - Bin To DNN: A DNN Executables Decompiler 26 stars 0 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights monkbai/DNN-decompiler This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 0 tags Code * Clone HTTPS GitHub CLI [https://github.com/m] Use Git or checkout with SVN using the web URL. [gh repo clone monkba] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @monkbai monkbai update TVM v0.9 artifact ... aca97b0 Oct 9, 2022 update TVM v0.9 artifact aca97b0 Git stats * 301 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time MyPinTool Char-RNN Glow 2020, 2021 May 11, 2022 compiler_opt update compiler opt Aug 8, 2021 evaluation update TVM v0.9 artifact Oct 9, 2022 ida Create README.md Oct 3, 2022 nlp_models Char-RNN Glow 2020, 2021 May 11, 2022 nnfusion neaten artifact Oct 3, 2022 operator_inference update Aug 13, 2021 recompile/gpu_recompile neaten artifact Oct 3, 2022 validation update recompilation Aug 10, 2021 white-box-attack update Oct 13, 2021 .gitignore update Oct 5, 2022 README.md Update README.md Oct 6, 2022 config.py neaten artifact Oct 3, 2022 decompile_eval.sh update TVM v0.9 artifact Oct 9, 2022 explain.py update Oct 9, 2022 fused_trace.py done: efficient lite4 TVM v0.9 O0 Apr 5, 2022 mem_slices.py done: efficient lite4 Glow 2022 Apr 5, 2022 pin_tools.py update Oct 3, 2022 se_engine.py update Apr 25, 2022 split_funcs.py resnet18 tvm O3: done, with 95% conv2d accuracy Jun 20, 2021 topo_node.py done: shufflenet v2 TVM v0.9 O0 Apr 3, 2022 trace_filter.py update Oct 6, 2022 utils.py Char-RNN Glow 2020, 2021 May 11, 2022 View code [ ] BTD: DNN Executables Decompiler Prerequisites 0.Prepare Structure Pin tools Operator Inference Symbolic Engine Taint Analysis Disassembly Scripts Decompile&Rebuild Scripts Appendix of Our Paper Data Labeled Dataset for Operator Inference ONNX Models Compiled DNN Executables Model Inputs White-box Attack Results Recompilation README.md BTD: DNN Executables Decompiler Research Artifact for our USENIX Security 2023 paper: "Decompiling x86 Deep Neural Network Executables" BTD is the first deep neural network (DNN) executables decompiler. BTD takes DNN executables (running on x86 CPUs) and outputs full model specifications, including types of DNN operators, network topology, dimensions, and parameters that are (nearly) identical to those of the input models. BTD is evaluated to be robust against complex compiler optimizations, such as operator fusion and memory layout optimization. More details are reported in our paper published at USENIX Security 2023. Paper: will release soon Extended version: https://arxiv.org/abs/2210.01075 TODO: We will release and update all code and data in a few days and a usable Docker image will be available for artifact evaluation at that time. Please check this repo later. Prerequisites ubuntu 18.04 git gcc/g++ (7.5.0) make (4.1) python3 (3.6.9 or higher) numpy-1.19.5 torch (1.9.0 or higher) Intel pin (3.14) IDA Pro (optional) You can download pin 3.14 from here, or use the docker image with all prerequisites installed. BTD relies on IDA Pro (version 7.5) for disassembly, and because IDA is commercial software, we do not provide it in this repo; instead, in order to reduce the workload of AE reviewers, we provide the disassembly results directly as input for BTD. The scripts used to disassemble DNN executable into assembly functions with IDA are presented in ida/. IDA Pro is not indispensable; any other full-fledged disassembly tool can be used to replace IDA, but we do not provide the relevant code here. 0.Prepare Download and unzip Intel pin 3.14, then update the pin home directory in config.py. git clone https://github.com/monkbai/DNN-decompiler.git mkdir /source/tools/MyPinTool/obj-intel64 cd DNN-decompiler python3 pin_tool.py pin_tool.py will copy and compile all pin tools listed in MyPinTool/. Structure Pin tools MyPinTool/ version: pin-3.14 Operator Inference operator_inference/ Symbolic Engine se_engine.py Taint Analysis trace_filter.py Disassembly Scripts ida/ Decompile&Rebuild Scripts resnet18_*/ vgg16_*/ embedding_*/ nnfusion*/ op_comprehensive/* Appendix of Our Paper docs/ Data Labeled Dataset for Operator Inference https://www.dropbox.com/s/lgkp2xfmyn7kwv4/labeled_dataset.zip?dl=0 ONNX Models https://www.dropbox.com/s/x8gwqyej7fla3rz/DNN_models.zip?dl=0 Compiled DNN Executables https://www.dropbox.com/s/lf297rjgx7e39id/DNN_executables.zip?dl=0 Model Inputs https://www.dropbox.com/s/nook5hs9srjveev/images.zip?dl=0 https://www.dropbox.com/s/9y0k71dbowixs8w/embedding_input.zip?dl=0 White-box Attack Results https://www.dropbox.com/s/9fuxmfuaroqtvjm/whitebox_steal.zip?dl=0 Recompilation The first package includes recompiled new DNN executables on x86 platforms. This is in accordance with our recompilation evaluation in Section 6.5. https://www.dropbox.com/s/i8ub0kihusy1evk/cpu_recompile.zip?dl=0 The second package includes legacy code migration demo. As clarified in Section 7 (the Discussion section; Downstream Applications paragraph), we decompiled x86 DNN executables, and try to migrate the decompiled models to GPUs by compiling them again using TVM with cuda as target device. https://www.dropbox.com/s/01zu0oyh00e57pw/gpu_recompile.zip?dl=0 About BTD - Bin To DNN: A DNN Executables Decompiler Resources Readme Stars 26 stars Watchers 2 watching Forks 0 forks Releases No releases published Packages 0 No packages published Languages * C 98.3% * Python 1.6% * Other 0.1% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.