├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── COPYRIGHT ├── LICENSE ├── MANIFEST.in ├── README.md ├── _DEPRECATED_CNN ├── README.md ├── data-prep │ ├── all_data_preprocess.py │ ├── cb_data_preprocess.py │ ├── cb_data_preprocess2.py │ ├── char_dict.py │ ├── char_frequency.py │ ├── dos_data_preprocess.py │ ├── extra_data_preprocess.py │ ├── hubble_data_preprocess.py │ ├── linux_data_preprocess.py │ ├── linux_obf_data_preprocess.py │ ├── obf_data_preprocess.py │ ├── ps_data_preprocess.py │ └── win_data_preprocess.py ├── models │ ├── best-resnet-all.pth │ ├── best-resnet-linux.pth │ └── best-resnet-windows.pth ├── obfuscation_detection │ ├── __init__.py │ ├── api.py │ ├── files │ │ ├── best-resnet-all.pth │ │ ├── best-resnet-linux.pth │ │ ├── best-resnet-windows.pth │ │ └── char_dict.pth │ └── models.py ├── pyproject.toml ├── requirements.txt ├── res │ ├── conv-layer-1.png │ ├── conv-layer-2.png │ ├── full-model.png │ ├── input-matrix.png │ └── resnet.png ├── scripts │ ├── command_dataset.py │ ├── models.py │ ├── train.py │ └── unk_word_ratio.py └── setup.py ├── commands.csv ├── obfuscation_detection ├── __init__.py ├── main.py ├── model.py └── models │ └── od-cmdexe-xgb-model.json ├── pyproject.toml └── setup.py /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ### Expected Behaviour 5 | 6 | ### Actual Behaviour 7 | 8 | ### Reproduce Scenario (including but not limited to) 9 | 10 | #### Steps to Reproduce 11 | 12 | #### Platform and Version 13 | 14 | #### Sample Code that illustrates the problem 15 | 16 | #### Logs taken while reproducing problem 17 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 4 | 5 | 6 | 7 | ## Related Issue 8 | 9 | 10 | 11 | 12 | 13 | 14 | ## Motivation and Context 15 | 16 | 17 | 18 | ## How Has This Been Tested? 19 | 20 | 21 | 22 | 23 | 24 | ## Screenshots (if appropriate): 25 | 26 | ## Types of changes 27 | 28 | 29 | 30 | - [ ] Bug fix (non-breaking change which fixes an issue) 31 | - [ ] New feature (non-breaking change which adds functionality) 32 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 33 | 34 | ## Checklist: 35 | 36 | 37 | 38 | 39 | - [ ] I have signed the [Adobe Open Source CLA](https://opensource.adobe.com/cla.html). 40 | - [ ] My code follows the code style of this project. 41 | - [ ] My change requires a change to the documentation. 42 | - [ ] I have updated the documentation accordingly. 43 | - [ ] I have read the **CONTRIBUTING** document. 44 | - [ ] I have added tests to cover my changes. 45 | - [ ] All new and existing tests passed. 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | .DS_Store 3 | .vscode/ 4 | *.txt 5 | *.pth 6 | dist/ 7 | *.egg-info 8 | build/ 9 | 10 | _DEPRECATED_CNN/data/ 11 | _DEPRECATED_CNN/models/* 12 | !_DEPRECATED_CNN/requirements.txt 13 | !_DEPRECATED_CNN/models/best-resnet-all.pth 14 | !_DEPRECATED_CNN/models/best-resnet-linux.pth 15 | !_DEPRECATED_CNN/models/best-resnet-windows.pth 16 | !_DEPRECATED_CNN/obfuscation_detection/files/*.pth -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Adobe Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language. 18 | * Being respectful of differing viewpoints and experiences. 19 | * Gracefully accepting constructive criticism. 20 | * Focusing on what is best for the community. 21 | * Showing empathy towards other community members. 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances. 27 | * Trolling, insulting/derogatory comments, and personal or political attacks. 28 | * Public or private harassment. 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission. 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting. 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at Grp-opensourceoffice@adobe.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [https://contributor-covenant.org/version/1/4][version]. 72 | 73 | [homepage]: https://contributor-covenant.org 74 | [version]: https://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thanks for choosing to contribute! 4 | 5 | The following are a set of guidelines to follow when contributing to this project. 6 | 7 | ## Code Of Conduct 8 | 9 | This project adheres to the Adobe [code of conduct](../CODE_OF_CONDUCT.md). By participating, 10 | you are expected to uphold this code. Please report unacceptable behavior to 11 | [Grp-opensourceoffice@adobe.com](mailto:Grp-opensourceoffice@adobe.com). 12 | 13 | ## Have A Question? 14 | 15 | Start by filing an issue. The existing committers on this project work to reach 16 | consensus around project direction and issue solutions within issue threads 17 | (when appropriate). 18 | 19 | ## Contributor License Agreement 20 | 21 | All third-party contributions to this project must be accompanied by a signed contributor 22 | license agreement. This gives Adobe permission to redistribute your contributions 23 | as part of the project. [Sign our CLA](https://opensource.adobe.com/cla.html). You 24 | only need to submit an Adobe CLA one time, so if you have submitted one previously, 25 | you are good to go! 26 | 27 | ## Code Reviews 28 | 29 | All submissions should come in the form of pull requests and need to be reviewed 30 | by project committers. Read [GitHub's pull request documentation](https://help.github.com/articles/about-pull-requests/) 31 | for more information on sending pull requests. 32 | 33 | Lastly, please follow the [pull request template](PULL_REQUEST_TEMPLATE.md) when 34 | submitting a pull request! 35 | 36 | ## From Contributor To Committer 37 | 38 | We love contributions from our community! If you'd like to go a step beyond contributor 39 | and become a committer with full write access and a say in the project, you must 40 | be invited to the project. The existing committers employ an internal nomination 41 | process that must reach lazy consensus (silence is approval) before invitations 42 | are issued. If you feel you are qualified and want to get more deeply involved, 43 | feel free to reach out to existing committers to have a conversation about that. 44 | 45 | ## Security Issues 46 | 47 | Security issues shouldn't be reported on this issue tracker. Instead, [file an issue to our security experts](https://helpx.adobe.com/security/alertus.html). 48 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | © Copyright 2015-2021 Adobe. All rights reserved. 2 | 3 | Adobe holds the copyright for all the files found in this repository. 4 | 5 | See the LICENSE file for licensing information. 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021 Adobe 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include obfuscation_detection/files/best-resnet-windows.pth 2 | include obfuscation_detection/files/best-resnet-linux.pth 3 | include obfuscation_detection/files/best-resnet-all.pth 4 | include obfuscation_detection/files/char_dict.pth -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Command Obfuscation Detection 2 | 3 | This project currently only supports cmd.exe command obfuscation detection on Windows. In a previous iteration of this project, we used deep learning. Now, we have shifted the approach towards XGBoost instead. 4 | 5 | - Blog post: https://medium.com/adobetech/using-deep-learning-to-better-detect-command-obfuscation-965b448973e0 6 | - Pip package: https://pypi.org/project/obfuscation-detection/ 7 | 8 | ## Quick Installation 9 | 10 | You can install our package through pip! 11 | ``` 12 | pip install obfuscation-detection 13 | ``` 14 | 15 | This is a basic usage of our package: 16 | ``` 17 | from obfuscation_detection import ObfuscationDetectionClassifier 18 | 19 | model = ObfuscationDetectionClassifier() 20 | commands = ['cmd.exe /c "echo Invoke-DOSfuscation"', 21 | 'cm%windir:~ -4, -3%.e^Xe,;^,/^C",;,S^Et ^^o^=fus^cat^ion&,;,^se^T ^ ^ ^B^=o^ke-D^OS&&,;,s^Et^^ d^=ec^ho I^nv&&,;,C^Al^l,;,^%^D%^%B%^%o^%"', 22 | 'cat /etc/passwd'] 23 | y = model.predict(commands) 24 | y_prob = model.predict_proba(commands) 25 | 26 | # 1 is obfuscated, 0 is non-obfuscated 27 | print(y) # [0, 1, 0] 28 | print(y_prob) 29 | ``` 30 | 31 | ## Usage 32 | 1. Install python dependencies: `pip install -r requirements.txt` 33 | 34 | 2. For quick usage, give a .csv file with column `commands` and you can run the commands through the model: `python obfuscation_detection/main.py --filename commands.csv` 35 | 36 | 3. You can also write your own scripts to use the model class directly: `python obfuscation_detection/model.py` 37 | 38 | ### Contributing 39 | 40 | Contributions are welcomed! Read the [Contributing Guide](./CONTRIBUTING.md) for more information. 41 | 42 | ### Licensing 43 | 44 | This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information. 45 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/README.md: -------------------------------------------------------------------------------- 1 | # Command Obfuscation Detection using Deep Learning 2 | 3 | Command obfuscation is a technique to make a piece of code intentionally hard-to-read, but still 4 | execute the same functionality. Malicious attackers often abuse obfuscation to make their malicious 5 | software (malware) evasive to traditional malware detection techniques. This creates a headache for 6 | defenders since attackers can create a virtually infinite number of ways to obfuscate their malware. 7 | Traditional malware detection techniques are often rule-based, rendering them inflexible to new 8 | types of malware and obfuscation techniques. Deep learning has been used in various domains to 9 | create models that are dynamic and can adapt to new types of information. Our project uses deep 10 | learning techniques to detect command obfuscation. 11 | 12 | - Blog post: https://medium.com/adobetech/using-deep-learning-to-better-detect-command-obfuscation-965b448973e0 13 | - Pip package: https://pypi.org/project/obfuscation-detection/ 14 | 15 | ## Usage - Quick Installation 16 | 17 | You can install our package through pip! 18 | ``` 19 | pip install obfuscation-detection 20 | ``` 21 | 22 | This is a basic usage of our package: 23 | ``` 24 | import obfuscation_detection as od 25 | 26 | oc = od.ObfuscationClassifier(od.PlatformType.ALL) 27 | commands = ['cmd.exe /c "echo Invoke-DOSfuscation"', 28 | 'cm%windir:~ -4, -3%.e^Xe,;^,/^C",;,S^Et ^^o^=fus^cat^ion&,;,^se^T ^ ^ ^B^=o^ke-D^OS&&,;,s^Et^^ d^=ec^ho I^nv&&,;,C^Al^l,;,^%^D%^%B%^%o^%"', 29 | 'cat /etc/passwd'] 30 | classifications = oc(commands) 31 | 32 | # 1 is obfuscated, 0 is non-obfuscated 33 | print(classifications) # [0, 1, 0] 34 | ``` 35 | 36 | ## Model Architecture 37 | 38 | ### Input 39 | The input into the model is a single command from the command line. We represent a single command by each character individually. Each character is represented by a one-hot vector, a vector where all the values are 0 except for one index and the one index represented which character it is. We also include an extra case bit to differentiate between uppercase and lowercase characters. We found the frequency of the most common characters in our dataset and found 73 characters. With the case bit, each character one-hot vector is 74-dimensional. Each command is also represented by its first 4096 characters. If the command is longer than 4096 characters, the rest is cut off and if the command is shorter, then the rest is padded with zero's. Therefore, the input to our model is a 74x4096 matrix. 40 | 41 | Below is a simplified illustration of the input matrix, where the vertical axis represents the command and the horizontal axis represents the one-hot encoding. 42 | 43 | ![input matrix](https://github.com/adobe/SI-Obfuscation-Detection/blob/main/res/input-matrix.png?raw=true) 44 | 45 | ### Model - it's a CNN 46 | Our model is a character-level deep convolutional neural network (CNN). What does this mean? Let's look at the first layer, turning our input matrix into a convolutional layer (conv layer). We look at a few characters that are close to each other, multiply some weights onto these characters, and come out with a resulting vector. In the image below, we first look at 3 characters depicted by the left red box. We multiply these 3 characters by the kernel weight vector and it results in the right red box vector. We continue this process for all 3-character blocks next to each other, depicted by the purple box. We stack all these resulting vectors to form a matrix that results in our 1st conv layer. 47 | 48 | ![conv layer 1](https://github.com/adobe/SI-Obfuscation-Detection/blob/main/res/conv-layer-1.png?raw=true) 49 | 50 | The 1st conv layer now contains a matrix of vectors, where each row carries semantic meaning of 3 characters. We continue this process of applying convolutions, thereby increasing the "window size" each row in the matrix sees. If we apply one more layer of convolutions to our example, the next conv layer (conv layer 2) will contain rows where each row carries semantic meaning of 5 characters. The higher the layer, the bigger the window size is. The bigger the window size, the more semantic meaning each row the conv layer can carry. 51 | 52 | ![conv layer 2](https://github.com/adobe/SI-Obfuscation-Detection/blob/main/res/conv-layer-2.png?raw=true) 53 | 54 | We apply this process of convolutions with weights to extract features from the input. After we apply a couple layers of convolutions, we finally make a decision by taking an average of the CNN's output (final layer). This average is then run through a final fully connected (FC) layer to make the final output which is a 2-dimensional vector. The first dimension is the model's prediction on how non-obfuscated the command is. The second dimension is the model's prediction on how obfuscated the command is. We take the max of these two dimensions to decide whether or not the command is obfuscated. For example, a prediction that the command is not obfuscated is <1, 0> while a prediction that the command is obfuscated is <0, 1>. 55 | 56 | ![full model](https://github.com/adobe/SI-Obfuscation-Detection/blob/main/res/full-model.png?raw=true) 57 | 58 | ### Model - and it's also a ResNet 59 | Our model also has aspects of a ResNet. Since we are using this CNN for a language task, we found it natural to apply the same types of methods in RNNs as CNNs. Now you might ask why not just use RNNs? Well, in a nutshell, CNNs are faster than RNNs. CNNs are able to do parallel computations while RNNs rely on the previous sequence before it calculates the current sequence. Since our task is character-level, we don't require this task to be a sequence task. Therefore, we believe CNNs better capture the semantics of this task. 60 | 61 | So, what ResNet components are there? Here they are: 62 | - Residual connection: The output of each layer are summed up for each layer, then this residual block is added to the final CNN output layer. This helps solve the problem of vanishing gradients in models with many layers. 63 | - Skip connection: The output of the previous layer is added onto the output of the current layer. This is so if any layer hurts the model architecture, it can be skipped by regularization. 64 | - Gated activation function: For each CNN layer, we apply a sigmoid activation on half the filters and a tanh activation on the other half, then element-wise multiply these two activations together. This has shown better performance in signal-based applications, such as WaveNet. 65 | 66 | ![resnet](https://github.com/adobe/SI-Obfuscation-Detection/blob/main/res/resnet.png?raw=true) 67 | 68 | Upgrading our model from a plain CNN to a CNN + ResNet gave us much better performance! 69 | 70 | ### Results 71 | Overall, our model performs very well on windows and linux commands! 72 | 73 | 74 | ## Development 75 | 76 | ### Pre-requisites 77 | 1. Install python dependencies: `pip install -r requirements.txt` 78 | 79 | 2. Make empty directories for runtime 80 | ``` 81 | mkdir data 82 | mkdir data/prep 83 | mkdir data/processed_tensors 84 | mkdir data/processed_csv 85 | mkdir data/scripts 86 | mkdir models 87 | ``` 88 | 89 | 3. Download the Powershell Corpus: https://aka.ms/PowerShellCorpus. Unzip the file into the `data` directory 90 | 91 | 4. Download PS corpus labels: https://github.com/danielbohannon/Revoke-Obfuscation. Clone the repo in the same-level directory as this repo. The labels are found in the `DataScience` folder. 92 | 93 | 5. Download DOSfuscated commands: https://github.com/danielbohannon/Invoke-DOSfuscation/tree/master/Samples. Download the four `STATIC_#_of_4_*` files and put them inside the `data` directory. 94 | 95 | 6. We also use internal Adobe command line executions as a bulk of our training data. We may not release this dataset to the public, so we encourage you to either not exclude this dataset or find an open-source command prompt dataset on the internet. 96 | 97 | 98 | ### Data Prep 99 | 100 | `cd data-prep`, then run the following python scripts in order: 101 | 102 | 1. `python char_frequency.py`: creates a .txt file of each charcter's frequency in the dataset 103 | 104 | 2. `python char_dict.py`: creates a python dict of the most common characters mapped to a numeric index 105 | 106 | 3. `python ps_data_preprocess.py`: creates dataset for the powershell corpus dataset 107 | 108 | 4. `python dos_data_preprocess.py`: creates dataset for the DOSfuscated commands 109 | 110 | 5. `python hubble_data_preprocess.py` and `python cb_data_preprocess.py`: creates dataset for internal Adobe data. Replace this step with other data you may find on the internet. 111 | 112 | 6. `python win_data_preprocess.py`: creates train/dev/test tensor split by accumulating all windows data. 113 | 114 | 7. `python linux_obf_data_preprocess.py`: load internal Adobe linux commands and obfuscate them 115 | 116 | 8. `python linux_data_preprocess.py`: creates train/dev/test tensor split with all linux data 117 | 118 | 9. `python all_data_preprocess.py`: combines windows and linux train/dev/test sets together for a big train/dev/test dataset. 119 | 120 | ### Usage 121 | 122 | `cd ../scripts`, then run `python train.py` with the given options! 123 | 124 | `train.py`: 125 | - `--model` - choose a model architecture 126 | - `--model-file` - filename of model checkpoint 127 | - `--cuda-device` - which cuda device to use 128 | - Choose one of: 129 | - `--reset` - start training from scratch 130 | - `--eval` - evaluate on best checkpoint on train/dev 131 | - `--analyze` - create fp/fn files from dev 132 | - `--run` - run on real scripts on `test-scripts` dir 133 | - `--test` - run model on test set 134 | - none - continue training model from checkpoint 135 | 136 | `models.py`: contains the different model architectures we experimented with 137 | 138 | ### Examples 139 | 140 | Training model: 141 | - From scratch: `python train.py --model resnet --model_file resnet.pth --reset` 142 | - From checkpoint: `python train.py --model resnet --model_file resnet.pth` 143 | 144 | Eval model: `python train.py --model resnet --model_file resnet.pth --eval` 145 | 146 | Test model: `python train.py --model resnet --model_file resnet.pth --test` 147 | 148 | Running model on new data: 149 | 1. Put each separate script/command in its own file 150 | 2. Put all script/command files in a new dir `test-scripts` 151 | 3. Run `python train.py --model resnet --model_file resnet.pth --run` 152 | 153 | We have included our best model in `models/best-resnet-*.pth`! 154 | 155 | ### Contributing 156 | 157 | Contributions are welcomed! Read the [Contributing Guide](./CONTRIBUTING.md) for more information. 158 | 159 | ### Licensing 160 | 161 | This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information. 162 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/all_data_preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import pandas as pd 16 | 17 | DATA_DIR = '../data/processed_csv/' 18 | 19 | train_rows = pd.read_csv(DATA_DIR + 'win-train-data.csv').values.tolist() 20 | linux_train_rows = pd.read_csv(DATA_DIR + 'linux-train-data.csv').values.tolist() 21 | train_rows += [[row[0], row[2]] for row in linux_train_rows] 22 | print('loaded train rows', len(train_rows)) 23 | 24 | val_rows = pd.read_csv(DATA_DIR + 'win-val-data.csv').values.tolist() 25 | linux_val_rows = pd.read_csv(DATA_DIR + 'linux-val-data.csv').values.tolist() 26 | val_rows += [[row[0], row[2]] for row in linux_val_rows] 27 | print('loaded val rows', len(val_rows)) 28 | 29 | test_rows = pd.read_csv(DATA_DIR + 'win-test-data.csv').values.tolist() 30 | linux_test_rows = pd.read_csv(DATA_DIR + 'linux-test-data.csv').values.tolist() 31 | test_rows += [[row[0], row[2]] for row in linux_test_rows] 32 | print('loaded test rows', len(test_rows)) 33 | 34 | train_df = pd.DataFrame(train_rows, columns=['label', 'command']) 35 | val_df = pd.DataFrame(val_rows, columns=['label', 'command']) 36 | test_df = pd.DataFrame(test_rows, columns=['label', 'command']) 37 | 38 | train_df.to_csv(DATA_DIR + 'all-train-data.csv', index=False) 39 | val_df.to_csv(DATA_DIR + 'all-val-data.csv', index=False) 40 | test_df.to_csv(DATA_DIR + 'all-test-data.csv', index=False) 41 | 42 | # sanity checks 43 | print(len(train_df), len(val_df), len(test_df)) 44 | print(len(train_df) + len(val_df) + len(test_df)) 45 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/cb_data_preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import torch 16 | import pandas as pd 17 | import random 18 | random.seed(42) 19 | 20 | DATA_DIR = '../data/' 21 | CSV_DIR = 'processed_csv/' 22 | TOTAL_SAMPLES = 98123 23 | NUM_SAMPLES = 41402 24 | # substrings that we found contained obfuscated code 25 | OBFUSCATED = torch.load(DATA_DIR + 'obfuscated-str.pth') 26 | # OBFUSCATED = [] 27 | print('num obfuscated:', len(OBFUSCATED)) 28 | cb_csv = pd.read_csv(DATA_DIR + 'win_cmds_cb.csv') 29 | print(cb_csv.shape[0]) 30 | 31 | # choose random 100k samples from whole dataset 32 | random_idx = random.sample(range(TOTAL_SAMPLES), NUM_SAMPLES) 33 | print(cb_csv.loc[0]['process']) 34 | print(len(random_idx)) 35 | print(random_idx[0:5]) 36 | 37 | dataset = [] 38 | x = 0 39 | num_pos = 0 40 | for i in range(len(random_idx)): 41 | if x % 10000 == 0: 42 | print(x) 43 | x += 1 44 | 45 | cmd = cb_csv.loc[random_idx[i]]['process'] 46 | 47 | # label y 48 | is_obf = 0 49 | for obf in OBFUSCATED: 50 | if obf in cmd: 51 | is_obf = 1 52 | num_pos += 1 53 | break 54 | 55 | dataset.append([is_obf, cmd]) 56 | 57 | df = pd.DataFrame(dataset, columns=['label', 'command']) 58 | df.to_csv(DATA_DIR + CSV_DIR + 'cb-data.csv', index=False) 59 | 60 | # sanity checks 61 | print('num pos:', num_pos) 62 | print(len(df)) 63 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/cb_data_preprocess2.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import torch 16 | import pandas as pd 17 | import random 18 | random.seed(42) 19 | 20 | DATA_DIR = '../data/' 21 | TOTAL_SAMPLES = 100000 22 | NUM_SAMPLES = 50000 23 | TENSOR_LENGTH = 4096 24 | # substrings that we found contained obfuscated code 25 | OBFUSCATED = torch.load(DATA_DIR + 'obfuscated-str.pth') 26 | print('num obfuscated:', len(OBFUSCATED)) 27 | CHAR_DICT = torch.load(DATA_DIR + 'prep/char_dict.pth') 28 | print(CHAR_DICT) 29 | cb_csv = pd.read_csv(DATA_DIR + 'win_cmds_cb_2.csv') 30 | print(cb_csv.shape[0]) 31 | 32 | ''' 33 | # choose random 100k samples from whole dataset 34 | random_idx = random.sample(range(TOTAL_SAMPLES), NUM_SAMPLES) 35 | print(cb_csv.loc[0]['cmd']) 36 | print(len(random_idx)) 37 | print(random_idx[0:5]) 38 | ''' 39 | 40 | # choose first or second 50k in the samples 41 | random_idx = range(NUM_SAMPLES) 42 | # random_idx = range(NUM_SAMPLES, TOTAL_SAMPLES) 43 | 44 | cb_x = torch.zeros(NUM_SAMPLES, len(CHAR_DICT) + 1, TENSOR_LENGTH, dtype=torch.int8) 45 | # cb_x = [[[0 for _ in range(TENSOR_LENGTH)] for _ in range(len(CHAR_DICT) + 1)] for _ in range(NUM_SAMPLES)] 46 | print('loaded x') 47 | cb_y = torch.stack([torch.tensor([1, 0], dtype=torch.int8) for _ in range(NUM_SAMPLES)]) 48 | # cb_y = [[1, 0] for _ in range(NUM_SAMPLES)] 49 | print('loaded y') 50 | cmds = [] 51 | x = 0 52 | num_pos = 0 53 | for i in range(len(random_idx)): 54 | if x % 10000 == 0: 55 | print(x) 56 | x += 1 57 | 58 | cmd = str(cb_csv.loc[random_idx[i]]['cmd']) 59 | tensor_len = min(TENSOR_LENGTH, len(cmd)) 60 | 61 | # label x 62 | for j in range(tensor_len): 63 | char = cmd[j] 64 | lower_char = char.lower() 65 | if char.isupper() and lower_char in CHAR_DICT: 66 | cb_x[i][len(CHAR_DICT)][j] = 1 67 | char = lower_char 68 | if char in CHAR_DICT: 69 | cb_x[i][CHAR_DICT[char]][j] = 1 70 | 71 | # label y 72 | for obf in OBFUSCATED: 73 | if obf in cmd: 74 | cb_y[i][0] = 0 75 | cb_y[i][1] = 1 76 | num_pos += 1 77 | 78 | cmds.append(cmd) 79 | 80 | print(cmds[0]) 81 | print(cb_x[0][59][0]) 82 | print(cb_x[0][73][0]) 83 | print(cb_x[0][23][1]) 84 | print(cb_x[0][73][1]) 85 | print(cb_y[0]) 86 | print(cb_x[1041][36][3]) 87 | print(cb_x[1041][73][3]) 88 | print(cb_y[1041]) 89 | print('num pos:', num_pos) 90 | # print(cb_y[OBFUSCATED[2]]) 91 | print(cb_x.shape, cb_x.dtype) 92 | print(cb_y.shape, cb_y.dtype) 93 | 94 | # torch.save(cb_x, DATA_DIR + 'processed_tensors/cb2_x.pth') 95 | # torch.save(cb_y, DATA_DIR + 'processed_tensors/cb2_y.pth') 96 | torch.save({'x': cb_x, 'y': cb_y}, DATA_DIR + 'processed_tensors/cb2-1_data.pth') 97 | torch.save(cmds, DATA_DIR + 'scripts/cb2-1_cmds.pth') 98 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/char_dict.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import torch 16 | 17 | DATA_DIR = '../data/prep/' 18 | FREQ_CUTOFF = 0.00002 # found from char_frequency.py to include ^ 19 | 20 | char_freq_file = open(DATA_DIR + 'char_freq.txt', 'r') 21 | char_dict = {} 22 | char_dict_curr_idx = 0 23 | 24 | # make character to tensor index dictionary from the char frequencies file 25 | for char_freq in char_freq_file: 26 | char_freq = char_freq.split(' ') 27 | char = char_freq[0] 28 | freq = float(char_freq[1][:-1]) # remove new line 29 | if freq > FREQ_CUTOFF: 30 | if char == '': 31 | char = ' ' 32 | elif char == '': 33 | char = '\t' 34 | elif char == '': 35 | char = '\n' 36 | elif char == '': 37 | char = '\r' 38 | char_dict[char] = char_dict_curr_idx 39 | char_dict_curr_idx += 1 40 | print(char_dict) 41 | print('len of chars:', len(char_dict)) 42 | 43 | torch.save(char_dict, DATA_DIR + 'char_dict.pth') 44 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/char_frequency.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import pandas as pd 16 | import traceback 17 | 18 | DATA_DIR = '../data/PowerShellCorpus/' 19 | LABELS_DIR = '../../Revoke-Obfuscation/DataScience/' 20 | PREP_DIR = '../data/prep/' 21 | LABEL_FILES = [ 22 | 'GithubGist-obfuscation-labeledData.csv', 23 | 'InvokeCradleCrafter-obfuscation-labeledData.csv', 24 | 'InvokeObfuscation-obfuscation-labeledData.csv', 25 | 'IseSteroids-obfuscation-labeledData.csv', 26 | 'PoshCode-obfuscation-labeledData.csv', 27 | 'TechNet-obfuscation-labeledData.csv', 28 | # 'UnderhandedPowerShell-obfuscation-labeledData.csv', # not provided to us by author 29 | ] 30 | 31 | char_freq_file = open(PREP_DIR + 'char_freq.txt', 'x') 32 | char_counts = {} 33 | total_chars = 0 34 | unparsable = 0 35 | total_cmds = 0 36 | 37 | # iterate through labels 38 | for label_file in LABEL_FILES: 39 | csv = pd.read_csv(LABELS_DIR + label_file, encoding='utf-8') 40 | # iterate through files 41 | for _, row in csv.iterrows(): 42 | total_cmds += 1 43 | if total_cmds % 1000 == 0: 44 | print(total_cmds) 45 | ps_path = row[0].replace('\\', '/') # windows to mac file reading 46 | try: 47 | # iterate through each byte and increment the count 48 | ps_file = open(DATA_DIR + ps_path, 'rb') 49 | byte = ps_file.read(1) 50 | while byte: 51 | if byte == b'\x00': 52 | # skip this null byte 53 | byte = ps_file.read(1) 54 | continue 55 | try: 56 | byte_str = str(byte, 'utf-8') 57 | # if upper, add to count for lower char 58 | if byte_str.isalpha() and byte_str.isupper(): 59 | byte = byte_str.lower().encode('utf-8') 60 | except: 61 | byte = ps_file.read(1) 62 | continue 63 | if byte not in char_counts: 64 | char_counts[byte] = 0 65 | char_counts[byte] += 1 66 | total_chars += 1 67 | byte = ps_file.read(1) 68 | ps_file.close() 69 | except Exception as e: 70 | traceback.print_exc() 71 | print(e) 72 | unparsable += 1 73 | for char in char_counts: 74 | char_counts[char] /= total_chars 75 | for k, v in sorted(char_counts.items(), key=lambda p:p[1], reverse=True): 76 | try: 77 | char_freq_file.write(k.decode('utf-8') + ' ' + str(v) + '\n') 78 | except: 79 | # skip non utf-8 characters 80 | pass 81 | 82 | print('total commands:', total_cmds) 83 | print('unparseable commands:', unparsable) 84 | print('parseable commands:', total_cmds - unparsable) 85 | 86 | char_freq_file.close() 87 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/dos_data_preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import pandas as pd 16 | 17 | DATA_DIR = '../data/' 18 | CSV_DIR = 'processed_csv/' 19 | dos_files = [open(DATA_DIR + 'STATIC_1-of-4_Out-DosConcatenatedCommand.txt', 'r', encoding='utf-16'), 20 | open(DATA_DIR + 'STATIC_2-of-4_Out-DosReversedCommand.txt', 'r', encoding='utf-16'), 21 | open(DATA_DIR + 'STATIC_3-of-4_Out-DosFORcodedCommand.txt', 'r', encoding='utf-16'), 22 | open(DATA_DIR + 'STATIC_4-of-4_Out-DosFINcodedCommand.txt', 'r', encoding='utf-16')] 23 | dos_lines = [] 24 | for dos_file in dos_files: 25 | dos_lines += dos_file.read().splitlines() 26 | print(dos_lines[0]) 27 | print(len(dos_lines[0])) 28 | print(len(dos_lines)) 29 | 30 | dataset = [] 31 | 32 | for line in dos_lines: 33 | dataset.append([1, line]) 34 | 35 | df = pd.DataFrame(dataset, columns=['label', 'command']) 36 | df.to_csv(DATA_DIR + CSV_DIR + 'dos-data.csv', index=False) 37 | 38 | # sanity checks 39 | print(len(df)) 40 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/extra_data_preprocess.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | DATA_DIR = '../data/' 4 | CSV_DIR = '../data/processed_csv/' 5 | 6 | win_csv = pd.read_csv(DATA_DIR + 'val-win-data-1500.csv').values.tolist() 7 | linux_csv = pd.read_csv(DATA_DIR + 'val-linux-data-31k.csv').values.tolist() 8 | 9 | dataset = [] 10 | 11 | for row in win_csv: 12 | dataset.append([0, row[0]]) 13 | 14 | for row in linux_csv[0:1500]: 15 | dataset.append([0, '"' + row[0] + '"']) 16 | 17 | df = pd.DataFrame(dataset, columns=['label', 'command']) 18 | df.to_csv(CSV_DIR + 'extra-val-data.csv', index=False) 19 | 20 | print(len(df)) -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/hubble_data_preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import torch 16 | import pandas as pd 17 | import random 18 | random.seed(42) 19 | 20 | DATA_DIR = '../data/' 21 | CSV_DIR = 'processed_csv/' 22 | TOTAL_SAMPLES = 664793 23 | NUM_SAMPLES = 41402 24 | # substrings that we found contained obfuscated code 25 | OBFUSCATED = torch.load(DATA_DIR + 'obfuscated-str.pth') 26 | print('num obfuscated:', len(OBFUSCATED)) 27 | hubble_csv = pd.read_csv(DATA_DIR + 'win_cmds_hubble.csv') 28 | print(hubble_csv.shape[0]) 29 | 30 | # choose random 100k samples from whole dataset 31 | random_idx = random.sample(range(TOTAL_SAMPLES), NUM_SAMPLES) 32 | print(hubble_csv.loc[0]['process']) 33 | print(len(random_idx)) 34 | print(random_idx[0:5]) 35 | 36 | dataset = [] 37 | x = 0 38 | num_pos = 0 39 | for i in range(len(random_idx)): 40 | if x % 10000 == 0: 41 | print(x) 42 | x += 1 43 | 44 | cmd = hubble_csv.loc[random_idx[i]]['process'] 45 | 46 | # label y 47 | is_obf = 0 48 | for obf in OBFUSCATED: 49 | if obf in cmd: 50 | is_obf = 1 51 | num_pos += 1 52 | break 53 | 54 | dataset.append([is_obf, cmd]) 55 | 56 | df = pd.DataFrame(dataset, columns=['label', 'command']) 57 | df.to_csv(DATA_DIR + CSV_DIR + 'hubble-data.csv', index=False) 58 | 59 | # sanity checks 60 | print('num pos:', num_pos) 61 | print(len(df)) 62 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/linux_data_preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import pandas as pd 16 | import torch 17 | import random 18 | 19 | DATA_DIR = '../data/processed_csv/' 20 | 21 | all_rows = pd.read_csv(DATA_DIR + 'linux-data.csv').values.tolist() 22 | print(len(all_rows)) 23 | print(all_rows[0]) 24 | 25 | random_idx = random.sample(range(len(all_rows)), 20) 26 | for i in random_idx: 27 | print(all_rows[i]) 28 | 29 | # split all data into train, val, test 30 | train = [] 31 | val = [] 32 | test = [] 33 | train_idx, val_idx, test_idx = torch.utils.data.random_split(range(len(all_rows)), 34 | # hard-calculated 80-15-5 split 35 | [88080, 16515, 5505], # 110100 samples 36 | generator=torch.Generator().manual_seed(42)) 37 | for i in train_idx: 38 | train.append(all_rows[i]) 39 | for i in val_idx: 40 | val.append(all_rows[i]) 41 | for i in test_idx: 42 | test.append(all_rows[i]) 43 | 44 | train_df = pd.DataFrame(train, columns=['label', 'obf technique', 'command']) 45 | val_df = pd.DataFrame(val, columns=['label', 'obf technique', 'command']) 46 | test_df = pd.DataFrame(test, columns=['label', 'obf technique', 'command']) 47 | # train_df = pd.DataFrame(train, columns=['label', 'command']) 48 | # val_df = pd.DataFrame(val, columns=['label', 'command']) 49 | # test_df = pd.DataFrame(test, columns=['label', 'command']) 50 | 51 | train_df.to_csv(DATA_DIR + 'linux-train-data.csv', index=False) 52 | val_df.to_csv(DATA_DIR + 'linux-val-data.csv', index=False) 53 | test_df.to_csv(DATA_DIR + 'linux-test-data.csv', index=False) 54 | 55 | # sanity checks 56 | print(len(train_df), len(val_df), len(test_df)) -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/linux_obf_data_preprocess.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import pandas as pd 3 | import random 4 | random.seed(42) 5 | 6 | DATA_DIR = '../data/' 7 | CSV_DIR = 'processed_csv/' 8 | # install bashfuscator from https://github.com/Bashfuscator/Bashfuscator 9 | BASHFUSCATOR_EXEC = '../../Bashfuscator/bashfuscator/bin/bashfuscator' 10 | BASHFUSCATOR_TEMPLATE_SIMPLE = [BASHFUSCATOR_EXEC, '-q', '-c', '', '-s', '1', '-t', '1'] 11 | BASHFUSCATOR_TEMPLATE = [BASHFUSCATOR_EXEC, '-q', '-c',\ 12 | '',\ 13 | '-s', '1', '-t', '1',\ 14 | '--choose-mutators'] 15 | MUTATORS = ['command/case_swapper', 'command/reverse', 'string/file_glob',\ 16 | 'string/folder_glob', 'string/hex_hash', 'token/forcode',\ 17 | 'token/special_char_only', 'encode/base64', 'encode/rotn',\ 18 | 'encode/xor_non_null', 'compress/bzip2', 'compress/gzip'] 19 | 20 | LINUX_CMDS = pd.read_csv(DATA_DIR + 'linux_cmds.csv') 21 | NUM_CMDS = LINUX_CMDS.shape[0] 22 | print(NUM_CMDS) 23 | 24 | dataset = [] 25 | 26 | ### add raw samples to dataset 27 | for i in range(NUM_CMDS): 28 | dataset.append([0, 'none', LINUX_CMDS.loc[i]['command']]) 29 | print(len(dataset)) 30 | print('done raw samples') 31 | 32 | 33 | ### add bashfuscated samples to dataset 34 | def bashfuscate(cmd, mutator_list): 35 | bashfuscator_cmd = list(BASHFUSCATOR_TEMPLATE) 36 | bashfuscator_cmd[3] = cmd 37 | for mutator in mutator_list: 38 | bashfuscator_cmd.append(mutator) 39 | return subprocess.run(bashfuscator_cmd, stdout=subprocess.PIPE, text=True) 40 | 41 | # cmd = list(BASHFUSCATOR_TEMPLATE_SIMPLE) 42 | # cmd[3] = 'cat /etc/passwd' 43 | # # cmd.append('command/case_swapper') 44 | # res = subprocess.run(cmd, stdout=subprocess.PIPE, text=True) 45 | # print(res) 46 | # print(len(res.stdout)) 47 | 48 | # for i in plain_idx: 49 | # if i % 50 == 0: 50 | # print(i) 51 | # cmd = LINUX_CMDS.loc[i]['command'] 52 | # bashfuscator_cmd = list(BASHFUSCATOR_TEMPLATE_SIMPLE) 53 | # bashfuscator_cmd[3] = cmd 54 | # bashfuscated = subprocess.run(bashfuscator_cmd, stdout=subprocess.PIPE, text=True) 55 | # if bashfuscated.returncode != 0: 56 | # print(cmd) 57 | # dataset.append([1, 'random', bashfuscated.stdout]) 58 | # print('done plain') 59 | 60 | unparseable = 0 61 | 62 | random_1_layer_idx = random.sample(range(NUM_CMDS), 10000) 63 | print(random_1_layer_idx[0:5]) 64 | x = 0 65 | for i in random_1_layer_idx: 66 | if x % 1000 == 0: 67 | print(x) 68 | x += 1 69 | 70 | try: 71 | cmd = '"{:s}"'.format(LINUX_CMDS.loc[i]['command']) 72 | mutator_list = [MUTATORS[random.randint(0, len(MUTATORS) - 1)]] 73 | bashfuscated = bashfuscate(cmd, mutator_list) 74 | # dataset.append([1, mutator_list[0], bashfuscated.stdout]) 75 | dataset.append([1, bashfuscated.stdout]) 76 | except Exception as e: 77 | print('error') 78 | print(e) 79 | unparseable += 1 80 | print('done 1 type') 81 | 82 | random_2_layer_idx = random.sample(range(NUM_CMDS), 100) 83 | print(random_2_layer_idx[0:5]) 84 | x = 0 85 | for i in random_2_layer_idx: 86 | if x % 10 == 0: 87 | print(x) 88 | x += 1 89 | 90 | try: 91 | cmd = '"{:s}"'.format(LINUX_CMDS.loc[i]['command']) 92 | mutator_list = [MUTATORS[random.randint(0, len(MUTATORS) - 1)] for _ in range(2)] 93 | bashfuscated = bashfuscate(cmd, mutator_list) 94 | # dataset.append([1, ', '.join(mutator_list), bashfuscated.stdout]) 95 | dataset.append([1, bashfuscated.stdout]) 96 | except Exception as e: 97 | print('error') 98 | print(e) 99 | unparseable += 1 100 | print('done 2 type') 101 | 102 | # df = pd.DataFrame(dataset, columns=['label', 'obf technique', 'command']) 103 | df = pd.DataFrame(dataset, columns=['label', 'command']) 104 | df.to_csv(DATA_DIR + CSV_DIR + 'linux-data.csv', index=False) 105 | 106 | # sanity checks 107 | print(len(df)) 108 | print('unparseable:', unparseable) 109 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/obf_data_preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import pandas as pd 16 | 17 | DATA_DIR = '../data/' 18 | CSV_DIR = 'processed_csv/' 19 | obf_csv = pd.read_csv(DATA_DIR + 'new-positives.csv', sep='\t') 20 | print(obf_csv.shape[0]) 21 | 22 | dataset = [] 23 | x = 0 24 | for i in range(obf_csv.shape[0]): 25 | if x % 10000 == 0: 26 | print(x) 27 | x += 1 28 | 29 | dataset.append([1, obf_csv.loc[i]['process']]) 30 | 31 | df = pd.DataFrame(dataset, columns=['label', 'command']) 32 | df.to_csv(DATA_DIR + CSV_DIR + 'obf-data.csv', index=False) 33 | 34 | # sanity checks 35 | print(len(df)) 36 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/ps_data_preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import pandas as pd 16 | import traceback 17 | import re 18 | 19 | # dataset from Bohannon (2017) 20 | DATA_DIR = '../data/' 21 | CSV_DIR = 'processed_csv/' 22 | PS_DIR = DATA_DIR + 'PowerShellCorpus/' 23 | LABELS_DIR = '../../Revoke-Obfuscation/DataScience/' 24 | LABEL_FILES = [ 25 | 'GithubGist-obfuscation-labeledData.csv', 26 | 'InvokeCradleCrafter-obfuscation-labeledData.csv', 27 | 'InvokeObfuscation-obfuscation-labeledData.csv', 28 | 'IseSteroids-obfuscation-labeledData.csv', 29 | 'PoshCode-obfuscation-labeledData.csv', 30 | 'TechNet-obfuscation-labeledData.csv', 31 | # 'UnderhandedPowerShell-obfuscation-labeledData.csv' 32 | ] 33 | PROCESSED_TENSORS_DIR = DATA_DIR + 'processed_tensors/' 34 | SCRIPTS_DIR = DATA_DIR + 'scripts/' 35 | 36 | # iterate through labels 37 | dataset = [] 38 | x = 0 39 | unparseable, num_pos = 0, 0 40 | filenames = [] 41 | for label_file in LABEL_FILES: 42 | csv = pd.read_csv(LABELS_DIR + label_file) 43 | # iterate through files 44 | for _, row in csv.iterrows(): 45 | if x % 1000 == 0: 46 | print(x) 47 | x += 1 48 | 49 | ps_path = row[0].replace('\\', '/') # windows to mac file reading 50 | ''' 51 | # only for filtering it out 52 | # skip "real-world" obfuscated b/c it's not that obfuscated in the dataset 53 | if (ps_path.startswith('GithubGist') or ps_path.startswith('PoshCode') or ps_path.startswith('TechNet')) and \ 54 | int(row[1]) == 1: 55 | continue 56 | ''' 57 | 58 | # parse powershell script 59 | 60 | # filter out non-utf8 characters 61 | try: 62 | ps_file = open(PS_DIR + ps_path, 'rb') 63 | file_str = '' 64 | byte = ps_file.read(1) 65 | while byte: 66 | if byte == b'\x00': 67 | # skip this null byte 68 | byte = ps_file.read(1) 69 | continue 70 | try: 71 | byte_str = str(byte, 'utf-8') 72 | except: 73 | # non-utf8 byte 74 | byte = ps_file.read(1) 75 | continue 76 | # valid utf-8 byte 77 | file_str += byte_str 78 | byte = ps_file.read(1) 79 | ps_file.close() 80 | except Exception as e: 81 | unparseable += 1 82 | traceback.print_exc() 83 | print(e) 84 | continue 85 | 86 | file_str_split = file_str.splitlines() 87 | 88 | # filter out multi-line comments 89 | # only looks at multi-line comment start/end points if they are on their own line 90 | # only comments like '<#\nasdfasdf\nasdfasdf\n#>' or ' <# \nasdfasdf\nasdfasdf\n #> ' 91 | # NOTE: do this before filtering out single line comments b/c '#>' looks like a single-line comment 92 | multi_line_indices = [] 93 | start = -1 94 | for i in range(len(file_str_split)): 95 | line = file_str_split[i] 96 | if re.match('[ \t]*<#[ \t]*', line): 97 | start = i 98 | elif re.match('[ \t]*#>[ \t]*', line) and start != -1: 99 | multi_line_indices += range(start, i + 1) 100 | start = -1 101 | for i in multi_line_indices[::-1]: 102 | del file_str_split[i] 103 | 104 | # filter out single line comments 105 | # only lines like '# asdf' or ' # asdf', not inline comments 106 | file_str_split = [i for i in file_str_split if not re.match('[ \t]*#.*', i)] 107 | 108 | # convert file string into tensor 109 | file_str = '\n'.join(file_str_split) 110 | # if ps_path == 'GithubGist/9to5IT_9620565_raw_04b5a0e0d62290ccf025de4ab9c75597a75d6d9c_Logging_Functions.ps1': 111 | # print(multi_line_indices) 112 | # print(file_str) 113 | is_obf = 1 if int(row[1]) == 1 else 0 114 | if is_obf == 1: 115 | num_pos += 1 116 | 117 | dataset.append([is_obf, file_str]) 118 | filenames.append(ps_path) 119 | 120 | df = pd.DataFrame(dataset, columns=['label', 'command']) 121 | df.to_csv(DATA_DIR + CSV_DIR + 'ps-data.csv', index=False) 122 | 123 | # sanity checks 124 | print('unparseable files: {:d}'.format(unparseable)) 125 | print('num pos:', num_pos) 126 | print(len(df)) 127 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/data-prep/win_data_preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import pandas as pd 16 | import torch 17 | 18 | DATA_DIR = '../data/processed_csv/' 19 | 20 | all_rows = [] 21 | all_rows += pd.read_csv(DATA_DIR + 'ps-data.csv').values.tolist() 22 | all_rows += pd.read_csv(DATA_DIR + 'dos-data.csv').values.tolist() 23 | all_rows += pd.read_csv(DATA_DIR + 'hubble-data.csv').values.tolist() 24 | all_rows += pd.read_csv(DATA_DIR + 'cb-data.csv').values.tolist() 25 | all_rows += pd.read_csv(DATA_DIR + 'obf-data.csv').values.tolist() 26 | print(len(all_rows)) 27 | print(all_rows[0]) 28 | 29 | # split all data into train, val, test 30 | train = [] 31 | val = [] 32 | test = [] 33 | train_idx, val_idx, test_idx = torch.utils.data.random_split(range(len(all_rows)), 34 | # hard-calculated 80-15-5 split 35 | # [64000, 12000, 4000], # 80k samples 36 | # [32000, 6000, 2000], # 40k samples 37 | # [40000, 7500, 2500], # 50k samples 38 | [80000, 15000, 5000], #100k samples] 39 | generator=torch.Generator().manual_seed(42)) 40 | for i in train_idx: 41 | train.append(all_rows[i]) 42 | for i in val_idx: 43 | val.append(all_rows[i]) 44 | for i in test_idx: 45 | test.append(all_rows[i]) 46 | 47 | train_df = pd.DataFrame(train, columns=['label', 'command']) 48 | val_df = pd.DataFrame(val, columns=['label', 'command']) 49 | test_df = pd.DataFrame(test, columns=['label', 'command']) 50 | 51 | train_df.to_csv(DATA_DIR + 'win-train-data.csv', index=False) 52 | val_df.to_csv(DATA_DIR + 'win-val-data.csv', index=False) 53 | test_df.to_csv(DATA_DIR + 'win-test-data.csv', index=False) 54 | 55 | # sanity checks 56 | print(len(train_df), len(val_df), len(test_df)) 57 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/models/best-resnet-all.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/models/best-resnet-all.pth -------------------------------------------------------------------------------- /_DEPRECATED_CNN/models/best-resnet-linux.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/models/best-resnet-linux.pth -------------------------------------------------------------------------------- /_DEPRECATED_CNN/models/best-resnet-windows.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/models/best-resnet-windows.pth -------------------------------------------------------------------------------- /_DEPRECATED_CNN/obfuscation_detection/__init__.py: -------------------------------------------------------------------------------- 1 | from . import api 2 | from .api import * -------------------------------------------------------------------------------- /_DEPRECATED_CNN/obfuscation_detection/api.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import torch 16 | from enum import Enum 17 | from typing import List 18 | import pkg_resources 19 | 20 | from obfuscation_detection.models import ResNet 21 | 22 | class PlatformType(Enum): 23 | WINDOWS: str='windows' 24 | LINUX: str='linux' 25 | ALL: str='all' 26 | 27 | class ObfuscationClassifier: 28 | def __init__(self, platform: PlatformType, gpu: bool = False): 29 | # set platform type 30 | if platform == PlatformType.WINDOWS: 31 | model_file = pkg_resources.resource_filename(__name__, 'files/best-resnet-windows.pth') 32 | elif platform == PlatformType.LINUX: 33 | model_file = pkg_resources.resource_filename(__name__, 'files/best-resnet-linux.pth') 34 | elif platform == PlatformType.ALL: 35 | model_file = pkg_resources.resource_filename(__name__, 'files/best-resnet-all.pth') 36 | else: 37 | raise Exception("Unknown platform type") 38 | 39 | # init device, model 40 | device = torch.device('cpu') 41 | if gpu and torch.cuda.is_available(): 42 | device = torch.device('cuda') 43 | model = ResNet().to(device) 44 | optimizer = torch.optim.Adam(model.parameters()) 45 | 46 | # load model 47 | checkpoint = torch.load(model_file, map_location=device) 48 | model.load_state_dict(checkpoint['model_state_dict']) 49 | optimizer.load_state_dict(checkpoint['optimizer_state_dict']) 50 | model.eval() 51 | 52 | self.device = device 53 | self.model = model 54 | self.optimizer = optimizer 55 | self.char_dict = torch.load(pkg_resources.resource_filename(__name__, 'files/char_dict.pth')) 56 | 57 | 58 | def __call__(self, commands_list: List[str]): 59 | BATCH_SIZE = 64 60 | indices = list(range(0, len(commands_list), BATCH_SIZE)) 61 | res = [] 62 | for i in range(len(indices)): 63 | # split commands into batches 64 | if i < len(indices) - 1: 65 | commands = commands_list[indices[i]:indices[i+1]] 66 | else: 67 | commands = commands_list[indices[i]:] 68 | x = self._convert_batch(commands) 69 | y = self.model(x) 70 | y = list(torch.max(y, dim=1).indices.cpu().numpy()) 71 | res += y 72 | # return 1 for obfuscated, 0 o.w. 73 | return res 74 | 75 | def _convert_batch(self, commands_list): 76 | TENSOR_LENGTH = 4096 77 | # convert batch of command strings into tensors 78 | x = torch.zeros(len(commands_list), len(self.char_dict) + 1, TENSOR_LENGTH).to(self.device) 79 | for i in range(len(commands_list)): 80 | cmd = str(commands_list[i]) 81 | tensor_len = min(TENSOR_LENGTH, len(cmd)) 82 | for j in range(tensor_len): 83 | char = cmd[j] 84 | lower_char = char.lower() 85 | if char.isupper() and lower_char in self.char_dict: 86 | x[i][len(self.char_dict)][j] = 1 87 | char = lower_char 88 | if char in self.char_dict: 89 | x[i][self.char_dict[char]][j] = 1 90 | return x 91 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/obfuscation_detection/files/best-resnet-all.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/obfuscation_detection/files/best-resnet-all.pth -------------------------------------------------------------------------------- /_DEPRECATED_CNN/obfuscation_detection/files/best-resnet-linux.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/obfuscation_detection/files/best-resnet-linux.pth -------------------------------------------------------------------------------- /_DEPRECATED_CNN/obfuscation_detection/files/best-resnet-windows.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/obfuscation_detection/files/best-resnet-windows.pth -------------------------------------------------------------------------------- /_DEPRECATED_CNN/obfuscation_detection/files/char_dict.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/obfuscation_detection/files/char_dict.pth -------------------------------------------------------------------------------- /_DEPRECATED_CNN/obfuscation_detection/models.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import torch 16 | import torch.nn as nn 17 | 18 | class View(nn.Module): 19 | def __init__(self, shape): 20 | super(View, self).__init__() 21 | self.shape = shape 22 | 23 | def forward(self, x): 24 | return x.view(*self.shape) 25 | 26 | class GatedActivation(nn.Module): 27 | def __init__(self): 28 | super(GatedActivation, self).__init__() 29 | self.tanh = nn.Tanh() 30 | self.sigmoid = nn.Sigmoid() 31 | 32 | def forward(self, x): 33 | t = self.tanh(x[:, :int(x.shape[1]/2)]) 34 | s = self.sigmoid(x[:, int(x.shape[1]/2):]) 35 | return t * s 36 | 37 | class LinearNorm(nn.Module): 38 | def __init__(self, in_dim, out_dim): 39 | super(LinearNorm, self).__init__() 40 | self.flatten = nn.Flatten() 41 | self.linear_layer = nn.Linear(in_dim, out_dim) 42 | nn.init.xavier_normal_( 43 | self.linear_layer.weight, 44 | gain=nn.init.calculate_gain('linear')) 45 | 46 | def forward(self, x): 47 | x = self.flatten(x) # flatten b/c it's too large for fc right now? 48 | return self.linear_layer(x) 49 | 50 | class ConvNorm(nn.Module): 51 | def __init__(self, in_channels, out_channels, kernel_size=5, stride=1, padding=2, dilation=1): 52 | super(ConvNorm, self).__init__() 53 | self.conv = nn.Conv1d(in_channels, out_channels, kernel_size, 54 | stride=stride, padding=padding, dilation=dilation) 55 | nn.init.xavier_normal_( 56 | self.conv.weight, 57 | gain=nn.init.calculate_gain('tanh')) 58 | 59 | def forward(self, x): 60 | return self.conv(x) 61 | 62 | class ResNet(nn.Module): 63 | def __init__(self): 64 | super(ResNet, self).__init__() 65 | NUM_LAYERS = 3 66 | NUM_FILTERS = 512 67 | input_size = 74 68 | convolutions_char = [] 69 | self.num_filters = NUM_FILTERS 70 | for _ in range(NUM_LAYERS): 71 | conv_layer = nn.Sequential( 72 | ConvNorm(input_size, NUM_FILTERS, 73 | kernel_size=5, stride=1, 74 | padding=2, dilation=1), 75 | nn.BatchNorm1d(NUM_FILTERS) 76 | ) 77 | convolutions_char.append(conv_layer) 78 | input_size = NUM_FILTERS // 2 79 | self.convolutions_char = nn.ModuleList(convolutions_char) 80 | self.pre_out = LinearNorm(NUM_FILTERS // 2, 2) 81 | 82 | def forward(self, x): 83 | # x = x.permute(0, 2, 1) 84 | half = self.num_filters // 2 85 | res = None 86 | skip = None 87 | for i in range(len(self.convolutions_char)): 88 | conv = self.convolutions_char[i] 89 | drop = True 90 | if i >= len(self.convolutions_char) - 1: 91 | drop = False 92 | if skip is not None: 93 | x = x + skip 94 | conv_out = conv(x) 95 | tmp = torch.tanh(conv_out[:, :half, :]) * torch.sigmoid(conv_out[:, half:, :]) 96 | if res is None: 97 | res = tmp 98 | else: 99 | res = res + tmp 100 | skip = tmp 101 | x = torch.dropout(tmp, 0.1, drop) 102 | x = x + res 103 | # x = x.permute(0, 2, 1) 104 | pre = torch.sum(x, dim=2, dtype=torch.float) 105 | pre /= 4096 106 | return torch.softmax(self.pre_out(pre), dim=1) 107 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel" 5 | ] 6 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /_DEPRECATED_CNN/requirements.txt: -------------------------------------------------------------------------------- 1 | joblib==1.1.0 2 | numpy==1.23.1 3 | pandas==1.4.3 4 | python-dateutil==2.8.2 5 | pytz==2022.1 6 | scikit-learn==1.1.1 7 | scipy==1.8.1 8 | six==1.16.0 9 | sklearn==0.0 10 | threadpoolctl==3.1.0 11 | torch==1.12.0 12 | typing_extensions==4.3.0 13 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/res/conv-layer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/res/conv-layer-1.png -------------------------------------------------------------------------------- /_DEPRECATED_CNN/res/conv-layer-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/res/conv-layer-2.png -------------------------------------------------------------------------------- /_DEPRECATED_CNN/res/full-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/res/full-model.png -------------------------------------------------------------------------------- /_DEPRECATED_CNN/res/input-matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/res/input-matrix.png -------------------------------------------------------------------------------- /_DEPRECATED_CNN/res/resnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/obfuscation-detection/8dcd2f17560161a0f7e184e492086b27b09db37b/_DEPRECATED_CNN/res/resnet.png -------------------------------------------------------------------------------- /_DEPRECATED_CNN/scripts/command_dataset.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import pandas as pd 3 | 4 | DATA_DIR = '../data/' 5 | TENSOR_LENGTH = 4096 6 | 7 | class CommandDataset(torch.utils.data.Dataset): 8 | def __init__(self, csv_file): 9 | self.df = pd.read_csv(csv_file) 10 | self.char_dict = torch.load(DATA_DIR + 'prep/char_dict.pth') 11 | 12 | def __len__(self): 13 | return len(self.df) 14 | 15 | def __getitem__(self, index): 16 | row = self.df.loc[index] 17 | cmd = str(row['command']) 18 | label = int(row['label']) 19 | 20 | x = torch.zeros(len(self.char_dict) + 1, TENSOR_LENGTH, dtype=torch.int8) 21 | tensor_len = min(TENSOR_LENGTH, len(cmd)) 22 | # label x 23 | for j in range(tensor_len): 24 | char = cmd[j] 25 | lower_char = char.lower() 26 | if char.isupper() and lower_char in self.char_dict: 27 | x[len(self.char_dict)][j] = 1 28 | char = lower_char 29 | if char in self.char_dict: 30 | x[self.char_dict[char]][j] = 1 31 | 32 | # label y 33 | if label == 1: 34 | y = torch.tensor([0, 1], dtype=torch.int8) 35 | else : 36 | y = torch.tensor([1, 0], dtype=torch.int8) 37 | 38 | return x, y 39 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/scripts/models.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import torch 16 | import torch.nn as nn 17 | 18 | class Shape(nn.Module): 19 | def __init__(self): 20 | super(Shape, self).__init__() 21 | 22 | def forward(self, x): 23 | print(x.shape) 24 | return x 25 | 26 | class View(nn.Module): 27 | def __init__(self, shape): 28 | super(View, self).__init__() 29 | self.shape = shape 30 | 31 | def forward(self, x): 32 | return x.view(*self.shape) 33 | 34 | ### 35 | # start ResNet classes 36 | 37 | class GatedActivation(nn.Module): 38 | def __init__(self): 39 | super(GatedActivation, self).__init__() 40 | self.tanh = nn.Tanh() 41 | self.sigmoid = nn.Sigmoid() 42 | 43 | def forward(self, x): 44 | t = self.tanh(x[:, :int(x.shape[1]/2)]) 45 | s = self.sigmoid(x[:, int(x.shape[1]/2):]) 46 | return t * s 47 | 48 | class LinearNorm(nn.Module): 49 | def __init__(self, in_dim, out_dim): 50 | super(LinearNorm, self).__init__() 51 | self.flatten = nn.Flatten() 52 | self.linear_layer = nn.Linear(in_dim, out_dim) 53 | nn.init.xavier_normal_( 54 | self.linear_layer.weight, 55 | gain=nn.init.calculate_gain('linear')) 56 | 57 | def forward(self, x): 58 | x = self.flatten(x) # flatten b/c it's too large for fc right now? 59 | return self.linear_layer(x) 60 | 61 | class ConvNorm(nn.Module): 62 | def __init__(self, in_channels, out_channels, kernel_size=5, stride=1, padding=2, dilation=1): 63 | super(ConvNorm, self).__init__() 64 | self.conv = nn.Conv1d(in_channels, out_channels, kernel_size, 65 | stride=stride, padding=padding, dilation=dilation) 66 | nn.init.xavier_normal_( 67 | self.conv.weight, 68 | gain=nn.init.calculate_gain('tanh')) 69 | 70 | def forward(self, x): 71 | return self.conv(x) 72 | 73 | class ResNet(nn.Module): 74 | def __init__(self): 75 | super(ResNet, self).__init__() 76 | NUM_LAYERS = 3 77 | NUM_FILTERS = 512 78 | input_size = 74 79 | convolutions_char = [] 80 | self.num_filters = NUM_FILTERS 81 | for _ in range(NUM_LAYERS): 82 | conv_layer = nn.Sequential( 83 | ConvNorm(input_size, NUM_FILTERS, 84 | kernel_size=5, stride=1, 85 | padding=2, dilation=1), 86 | nn.BatchNorm1d(NUM_FILTERS) 87 | ) 88 | convolutions_char.append(conv_layer) 89 | input_size = NUM_FILTERS // 2 90 | self.convolutions_char = nn.ModuleList(convolutions_char) 91 | self.pre_out = LinearNorm(NUM_FILTERS // 2, 2) 92 | 93 | def forward(self, x): 94 | # x = x.permute(0, 2, 1) 95 | half = self.num_filters // 2 96 | res = None 97 | skip = None 98 | for i in range(len(self.convolutions_char)): 99 | conv = self.convolutions_char[i] 100 | drop = True 101 | if i >= len(self.convolutions_char) - 1: 102 | drop = False 103 | if skip is not None: 104 | x = x + skip 105 | conv_out = conv(x) 106 | tmp = torch.tanh(conv_out[:, :half, :]) * torch.sigmoid(conv_out[:, half:, :]) 107 | if res is None: 108 | res = tmp 109 | else: 110 | res = res + tmp 111 | skip = tmp 112 | x = torch.dropout(tmp, 0.1, drop) 113 | x = x + res 114 | # x = x.permute(0, 2, 1) 115 | pre = torch.sum(x, dim=2, dtype=torch.float) 116 | pre /= 4096 117 | return torch.softmax(self.pre_out(pre), dim=1) 118 | 119 | # end ResNet classes 120 | ### 121 | 122 | # best acc: 98.67% train, 84.56% val 123 | class MLP(nn.Module): 124 | def __init__(self): 125 | super(MLP, self).__init__() 126 | self.fc = nn.Sequential( 127 | nn.Flatten(), 128 | nn.Linear(72704, 1024), 129 | nn.Dropout(p=0.9), 130 | nn.ReLU(), 131 | nn.Linear(1024, 512), 132 | nn.Dropout(p=0.9), 133 | nn.ReLU(), 134 | nn.Linear(512, 2), 135 | nn.Softmax(dim=1) 136 | ) 137 | 138 | def forward(self, x): 139 | x = self.fc(x) 140 | return x 141 | 142 | # best acc so far: 92.11% train, 82.78%, taking forever to train 143 | class DeepMLP(nn.Module): 144 | def __init__(self): 145 | super(DeepMLP, self).__init__() 146 | self.fc = nn.Sequential( 147 | nn.Flatten(), 148 | nn.Linear(72704, 4096), 149 | nn.Dropout(p=0.9), 150 | nn.ReLU(), 151 | nn.Linear(4096, 2048), 152 | nn.Dropout(p=0.9), 153 | nn.ReLU(), 154 | nn.Linear(2048, 512), 155 | nn.Dropout(p=0.9), 156 | nn.ReLU(), 157 | nn.Linear(512, 2), 158 | nn.Softmax(dim=1) 159 | ) 160 | 161 | def forward(self, x): 162 | x = self.fc(x) 163 | return x 164 | 165 | # Hendler (2018) 166 | # best acc: 96.94% train, 89.68% val 167 | class ShallowCNN(nn.Module): 168 | def __init__(self): 169 | super(ShallowCNN, self).__init__() 170 | self.conv = nn.Sequential( 171 | nn.Conv2d(1, 128, kernel_size=(71, 3), stride=1), # 71 for num of chars 172 | nn.ReLU(), 173 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 174 | ) 175 | self.fc = nn.Sequential( 176 | nn.Flatten(), 177 | nn.Linear(43520, 1024), 178 | nn.Dropout(p=0.8), 179 | nn.ReLU(), 180 | nn.Linear(1024, 1024), 181 | nn.Dropout(p=0.8), 182 | nn.ReLU(), 183 | nn.Linear(1024, 2), 184 | nn.Softmax(dim=1) 185 | ) 186 | 187 | def forward(self, x): 188 | x = self.conv(x) 189 | x = self.fc(x) 190 | return x 191 | 192 | class GatedCNN(nn.Module): 193 | def __init__(self): 194 | super(GatedCNN, self).__init__() 195 | self.conv = nn.Sequential( 196 | nn.Conv2d(1, 128, kernel_size=(71, 3), stride=1), # 71 for num of chars 197 | GatedActivation(), 198 | nn.MaxPool2d(kernel_size=(1, 3), stride=3) 199 | ) 200 | self.fc = nn.Sequential( 201 | nn.Flatten(), 202 | nn.Linear(14620, 1024), 203 | nn.Dropout(p=0.8), 204 | nn.ReLU(), 205 | nn.Linear(1024, 1024), 206 | nn.Dropout(p=0.8), 207 | nn.ReLU(), 208 | nn.Linear(1024, 2), 209 | nn.Softmax(dim=1) 210 | ) 211 | 212 | def forward(self, x): 213 | x = self.conv(x) 214 | x = self.fc(x) 215 | return x 216 | 217 | # Zhang (2015) 218 | # best acc: not run yet 219 | class DeepCNN(nn.Module): 220 | def __init__(self): 221 | super(DeepCNN, self).__init__() 222 | self.conv = nn.Sequential( 223 | # conv1 224 | nn.Conv2d(1, 16, kernel_size=(71, 7), stride=1), 225 | nn.ReLU(), 226 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 227 | View((-1, 1, 16, 339)), 228 | # conv2 229 | nn.Conv2d(1, 16, kernel_size=(16, 7), stride=1), 230 | nn.ReLU(), 231 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 232 | View((-1, 1, 16, 111)), 233 | # conv3 234 | nn.Conv2d(1, 16, kernel_size=(16, 3), stride=1), 235 | nn.ReLU(), 236 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 237 | View((-1, 1, 16, 36)), 238 | # conv4 239 | nn.Conv2d(1, 16, kernel_size=(16, 3), stride=1), 240 | nn.ReLU(), 241 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 242 | View((-1, 1, 16, 11)), 243 | # conv5 244 | nn.Conv2d(1, 16, kernel_size=(16, 3), stride=1), 245 | nn.ReLU(), 246 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 247 | ) 248 | self.fc = nn.Sequential( 249 | nn.Flatten(), 250 | # output 251 | nn.Linear(48, 2), 252 | nn.Softmax(dim=1), 253 | ) 254 | 255 | def forward(self, x): 256 | x = self.conv(x) 257 | x = self.fc(x) 258 | return x 259 | 260 | class Conv2(nn.Module): 261 | def __init__(self): 262 | super(Conv2, self).__init__() 263 | self.conv = nn.Sequential( 264 | # conv1 265 | nn.Conv2d(1, 128, kernel_size=(71, 7), stride=1), 266 | nn.ReLU(), 267 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 268 | View((-1, 1, 128, 339)), 269 | # conv2 270 | nn.Conv2d(1, 128, kernel_size=(128,3), stride=1), 271 | nn.ReLU(), 272 | nn.MaxPool2d(kernel_size=(1,3), stride=3), 273 | ) 274 | self.fc = nn.Sequential( 275 | nn.Flatten(), 276 | # fc1 277 | nn.Linear(14336, 1024), 278 | nn.Dropout(p=0.8), 279 | nn.ReLU(), 280 | # fc2 281 | nn.Linear(1024, 1024), 282 | nn.Dropout(p=0.8), 283 | nn.ReLU(), 284 | # output 285 | nn.Linear(1024, 2), 286 | nn.Softmax(dim=1), 287 | ) 288 | 289 | def forward(self, x): 290 | x = self.conv(x) 291 | x = self.fc(x) 292 | return x 293 | 294 | class Conv2Gated(nn.Module): 295 | def __init__(self): 296 | super(Conv2Gated, self).__init__() 297 | self.conv = nn.Sequential( 298 | # conv1 299 | nn.Conv2d(1, 256, kernel_size=(71, 7), stride=1), 300 | GatedActivation(), 301 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 302 | View((-1, 1, 128, 339)), 303 | # conv2 304 | nn.Conv2d(1, 256, kernel_size=(128,3), stride=1), 305 | GatedActivation(), 306 | nn.MaxPool2d(kernel_size=(1,3), stride=3), 307 | ) 308 | self.fc = nn.Sequential( 309 | nn.Flatten(), 310 | # fc1 311 | nn.Linear(14336, 1024), 312 | nn.Dropout(p=0.8), 313 | nn.ReLU(), 314 | # fc2 315 | nn.Linear(1024, 1024), 316 | nn.Dropout(p=0.8), 317 | nn.ReLU(), 318 | # output 319 | nn.Linear(1024, 2), 320 | nn.Softmax(dim=1), 321 | ) 322 | 323 | def forward(self, x): 324 | x = self.conv(x) 325 | x = self.fc(x) 326 | return x 327 | 328 | class LargeCNN2(nn.Module): 329 | def __init__(self): 330 | super(LargeCNN2, self).__init__() 331 | self.conv = nn.Sequential( 332 | # conv1 333 | nn.Conv2d(1, 1024, kernel_size=(71, 7), stride=1), 334 | nn.ReLU(), 335 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 336 | View((-1, 1, 1024, 339)), 337 | # conv2 338 | nn.Conv2d(1, 1024, kernel_size=(1024,3), stride=1), 339 | nn.ReLU(), 340 | nn.MaxPool2d(kernel_size=(1,3), stride=3), 341 | ) 342 | self.fc = nn.Sequential( 343 | nn.Flatten(), 344 | # fc1 345 | nn.Linear(114688, 2048), 346 | nn.Dropout(p=0.8), 347 | nn.ReLU(), 348 | # fc2 349 | nn.Linear(2048, 2048), 350 | nn.Dropout(p=0.8), 351 | nn.ReLU(), 352 | # output 353 | nn.Linear(2048, 2), 354 | nn.Softmax(dim=1), 355 | ) 356 | 357 | def forward(self, x): 358 | x = self.conv(x) 359 | x = self.fc(x) 360 | return x 361 | 362 | class Conv3(nn.Module): 363 | def __init__(self): 364 | super(Conv3, self).__init__() 365 | self.conv = nn.Sequential( 366 | # conv1 367 | nn.Conv2d(1, 128, kernel_size=(71, 7), stride=1), 368 | nn.ReLU(), 369 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 370 | View((-1, 1, 128, 339)), 371 | # conv2 372 | nn.Conv2d(1, 128, kernel_size=(128, 3), stride=1), 373 | nn.ReLU(), 374 | View((-1, 1, 128, 337)), 375 | # conv3 376 | nn.Conv2d(1, 128, kernel_size=(128,3), stride=1), 377 | nn.ReLU(), 378 | nn.MaxPool2d(kernel_size=(1,3), stride=3), 379 | ) 380 | self.fc = nn.Sequential( 381 | nn.Flatten(), 382 | # fc1 383 | nn.Linear(14208, 1024), 384 | nn.Dropout(p=0.8), 385 | nn.ReLU(), 386 | # fc2 387 | nn.Linear(1024, 1024), 388 | nn.Dropout(p=0.8), 389 | nn.ReLU(), 390 | # output 391 | nn.Linear(1024, 2), 392 | nn.Softmax(dim=1), 393 | ) 394 | 395 | def forward(self, x): 396 | x = self.conv(x) 397 | x = self.fc(x) 398 | return x 399 | 400 | class Conv4(nn.Module): 401 | def __init__(self): 402 | super(Conv4, self).__init__() 403 | self.conv = nn.Sequential( 404 | # conv1 405 | nn.Conv2d(1, 256, kernel_size=(71, 7), stride=1), 406 | nn.ReLU(), 407 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 408 | View((-1, 1, 256, 339)), 409 | # conv2 410 | nn.Conv2d(1, 256, kernel_size=(256, 3), stride=1), 411 | nn.ReLU(), 412 | nn.MaxPool2d(kernel_size=(1,3), stride=3), 413 | View((-1, 1, 256, 112)), 414 | # conv3 415 | nn.Conv2d(1, 256, kernel_size=(256, 3), stride=1), 416 | nn.ReLU(), 417 | View((-1, 1, 256, 110)), 418 | # conv4 419 | nn.Conv2d(1, 256, kernel_size=(256,3), stride=1), 420 | nn.ReLU(), 421 | nn.MaxPool2d(kernel_size=(1,3), stride=3), 422 | ) 423 | self.fc = nn.Sequential( 424 | nn.Flatten(), 425 | # fc1 426 | nn.Linear(9216, 1024), 427 | nn.Dropout(p=0.5), 428 | nn.ReLU(), 429 | # fc2 430 | nn.Linear(1024, 1024), 431 | nn.Dropout(p=0.5), 432 | nn.ReLU(), 433 | # output 434 | nn.Linear(1024, 2), 435 | nn.Softmax(dim=1), 436 | ) 437 | 438 | def forward(self, x): 439 | x = self.conv(x) 440 | x = self.fc(x) 441 | return x 442 | 443 | class Conv5(nn.Module): 444 | def __init__(self): 445 | super(Conv5, self).__init__() 446 | self.conv = nn.Sequential( 447 | # conv1 448 | nn.Conv2d(1, 256, kernel_size=(71, 7), stride=1), 449 | nn.ReLU(), 450 | nn.MaxPool2d(kernel_size=(1, 3), stride=3), 451 | View((-1, 1, 256, 339)), 452 | # conv2 453 | nn.Conv2d(1, 256, kernel_size=(256, 3), stride=1), 454 | nn.ReLU(), 455 | nn.MaxPool2d(kernel_size=(1,3), stride=3), 456 | View((-1, 1, 256, 112)), 457 | # conv3 458 | nn.Conv2d(1, 256, kernel_size=(256, 3), stride=1), 459 | nn.ReLU(), 460 | View((-1, 1, 256, 110)), 461 | # conv4 462 | nn.Conv2d(1, 256, kernel_size=(256, 3), stride=1), 463 | nn.ReLU(), 464 | View((-1, 1, 256, 108)), 465 | # conv5 466 | nn.Conv2d(1, 256, kernel_size=(256,3), stride=1), 467 | nn.ReLU(), 468 | nn.MaxPool2d(kernel_size=(1,3), stride=3), 469 | ) 470 | self.fc = nn.Sequential( 471 | nn.Flatten(), 472 | # fc1 473 | nn.Linear(8960, 1024), 474 | nn.Dropout(p=0.5), 475 | nn.ReLU(), 476 | # fc2 477 | nn.Linear(1024, 1024), 478 | nn.Dropout(p=0.5), 479 | nn.ReLU(), 480 | # output 481 | nn.Linear(1024, 2), 482 | nn.Softmax(dim=1), 483 | ) 484 | 485 | def forward(self, x): 486 | x = self.conv(x) 487 | x = self.fc(x) 488 | return x 489 | 490 | class SimpleLSTM(nn.Module): 491 | def __init__(self): 492 | super(SimpleLSTM, self).__init__() 493 | self.lstm = nn.LSTM(71, 256, batch_first=True) 494 | self.fc = nn.Sequential( 495 | nn.Flatten(), 496 | # fc1 497 | nn.Linear(262144, 256), 498 | nn.Dropout(p=0.8), 499 | nn.ReLU(), 500 | # fc2 501 | nn.Linear(256, 256), 502 | nn.Dropout(p=0.8), 503 | nn.ReLU(), 504 | # output 505 | nn.Linear(256, 2), 506 | nn.Softmax(dim=1), 507 | ) 508 | 509 | # def forward(self, x, hn, cn): 510 | def forward(self, x): 511 | # x = self.lstm(x, (hn, cn)) 512 | x, _ = self.lstm(x) 513 | x = self.fc(x) 514 | return x 515 | 516 | class SmallLSTM(nn.Module): 517 | def __init__(self): 518 | super(SmallLSTM, self).__init__() 519 | self.lstm = nn.LSTM(71, 128, batch_first=True) 520 | self.fc = nn.Sequential( 521 | nn.Flatten(), 522 | # fc1 523 | nn.Linear(131072, 256), 524 | nn.Dropout(p=0.5), 525 | nn.ReLU(), 526 | # fc2 527 | nn.Linear(256, 256), 528 | nn.Dropout(p=0.5), 529 | nn.ReLU(), 530 | # output 531 | nn.Linear(256, 2), 532 | nn.Softmax(dim=1), 533 | ) 534 | 535 | # def forward(self, x, hn, cn): 536 | def forward(self, x): 537 | # x = self.lstm(x, (hn, cn)) 538 | x, _ = self.lstm(x) 539 | x = self.fc(x) 540 | return x 541 | 542 | class LargeLSTM(nn.Module): 543 | def __init__(self): 544 | super(LargeLSTM, self).__init__() 545 | self.lstm = nn.LSTM(71, 512, batch_first=True) 546 | self.fc = nn.Sequential( 547 | nn.Flatten(), 548 | # fc1 549 | nn.Linear(524288, 256), 550 | nn.Dropout(p=0.5), 551 | nn.ReLU(), 552 | # fc2 553 | nn.Linear(256, 256), 554 | nn.Dropout(p=0.5), 555 | nn.ReLU(), 556 | # output 557 | nn.Linear(256, 2), 558 | nn.Softmax(dim=1), 559 | ) 560 | 561 | # def forward(self, x, hn, cn): 562 | def forward(self, x): 563 | # x = self.lstm(x, (hn, cn)) 564 | x, _ = self.lstm(x) 565 | x = self.fc(x) 566 | return x 567 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/scripts/train.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import argparse 16 | import os 17 | import pandas as pd 18 | import torch 19 | import torch.nn as nn 20 | from torch.autograd import Variable 21 | from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, confusion_matrix 22 | 23 | from models import * 24 | from command_dataset import CommandDataset 25 | 26 | DATA_DIR = '../data/processed_csv/' 27 | SCRIPTS_DIR = '../data/scripts/' 28 | PREP_DIR = '../data/prep/' 29 | EPOCHS = 100 30 | BATCH_SIZE = 64 31 | 32 | model = ShallowCNN() 33 | model_file = 'models/cnn-shallow-conv-1-fc-2048-1024.pth' 34 | cuda_device = 0 35 | 36 | # set random seed for reproducibility 37 | torch.manual_seed(42) 38 | 39 | parser = argparse.ArgumentParser(description='obfuscation detection train file') 40 | parser.add_argument('--reset', help='start over training', action='store_true') 41 | parser.add_argument('--eval', help='eval model', action='store_true') 42 | parser.add_argument('--analyze', help='analyze statistics and samples of model', action='store_true') 43 | parser.add_argument('--run', help='run model on a real script', action='store_true') 44 | parser.add_argument('--test', help='eval model on test set', action='store_true') 45 | parser.add_argument('--model', default='cnn', help='model to run (mlp, deep-mlp, cnn, deep-cnn)') 46 | parser.add_argument('--model_file', default='cnn-shallow-conv-1-fc-2048-1024.pth', help='model file to save/load') 47 | parser.add_argument('--cuda_device', default=0, type=int, help='which cuda device to use') 48 | parser.add_argument('--os', default='win', help='which os data to run on win/linux/all') 49 | args = parser.parse_args() 50 | 51 | if args.model == 'mlp': 52 | print('using MLP model') 53 | model = MLP() 54 | elif args.model == 'deep-mlp': 55 | print('using deep MLP model') 56 | model = DeepMLP() 57 | elif args.model == 'cnn': 58 | print('using CNN model') 59 | model = ShallowCNN() 60 | elif args.model == 'deep-cnn': 61 | print('using deep CNN model') 62 | model = DeepCNN() 63 | elif args.model == 'cnn-2': 64 | print('using CNN 2') 65 | model = Conv2() 66 | elif args.model == 'cnn-3': 67 | print('using CNN 3') 68 | model = Conv3() 69 | elif args.model == 'cnn-4': 70 | print('using CNN 4') 71 | model = Conv4() 72 | elif args.model == 'cnn-5': 73 | print('using CNN 5') 74 | model = Conv5() 75 | elif args.model == 'large-cnn-2': 76 | print('using Large CNN 2') 77 | model = LargeCNN2() 78 | elif args.model == 'cnn-gated': 79 | print('using Gated CNN') 80 | model = GatedCNN() 81 | elif args.model == 'cnn-2-gated': 82 | print('using Gated CNN 2') 83 | model = Conv2Gated() 84 | elif args.model == 'lstm-simple': 85 | print('using simple LSTM') 86 | model = SimpleLSTM() 87 | elif args.model == 'lstm-small': 88 | print('using small LSTM') 89 | model = SmallLSTM() 90 | elif args.model == 'lstm-large': 91 | print('using large LSTM') 92 | model = LargeLSTM() 93 | elif args.model == 'resnet': 94 | print('using resnet') 95 | model = ResNet() 96 | 97 | model_file = '../models/' + args.model_file 98 | 99 | device = torch.device('cpu') 100 | if torch.cuda.is_available(): 101 | torch.cuda.set_device(args.cuda_device) 102 | device = torch.device('cuda') 103 | print('using CUDA', torch.cuda.current_device()) 104 | 105 | if args.eval and args.reset: 106 | print('cannot eval without loading model') 107 | exit(1) 108 | 109 | # init model 110 | model = model.to(device) 111 | optimizer = torch.optim.Adam(model.parameters()) 112 | mse = nn.MSELoss() 113 | epoch = 0 114 | 115 | # load data 116 | if args.os == 'win': 117 | TRAIN_CSV = 'win-train-data.csv' 118 | VAL_CSV = 'win-val-data.csv' 119 | TEST_CSV = 'win-test-data.csv' 120 | print('using win dataset') 121 | elif args.os == 'linux': 122 | TRAIN_CSV = 'linux-train-data.csv' 123 | VAL_CSV = 'linux-val-data.csv' 124 | TEST_CSV = 'linux-test-data.csv' 125 | print('using linux dataset') 126 | else: 127 | TRAIN_CSV = 'all-train-data.csv' 128 | VAL_CSV = 'all-val-data.csv' 129 | TEST_CSV = 'all-test-data.csv' 130 | print('using win/linux dataset') 131 | train_data = CommandDataset(DATA_DIR + TRAIN_CSV) 132 | val_data = CommandDataset(DATA_DIR + VAL_CSV) 133 | train_loader = torch.utils.data.DataLoader(train_data, batch_size=BATCH_SIZE, shuffle=True) 134 | val_loader = torch.utils.data.DataLoader(val_data, batch_size=BATCH_SIZE, shuffle=False) 135 | print('loaded data:', len(train_data), len(val_data)) 136 | 137 | best_val_f1 = 0. 138 | if not args.reset: 139 | # load checkpoint if eval or not retraining 140 | checkpoint = torch.load(model_file, map_location=device) 141 | model.load_state_dict(checkpoint['model_state_dict']) 142 | optimizer.load_state_dict(checkpoint['optimizer_state_dict']) 143 | epoch = checkpoint['epoch'] 144 | if 'val_f1' in checkpoint: 145 | val_f1 = checkpoint['val_f1'] 146 | best_val_f1 = val_f1 147 | print('loaded {:s} on epoch {:d} with val f1 {:f}'.format(model_file, epoch, val_f1)) 148 | else: 149 | print('loaded model with acc ' + str(checkpoint['val_acc'])) 150 | 151 | def eval_model(dataset_name, model, data_loader, num_data, loss_fn): 152 | model.eval() 153 | avg_loss = 0. 154 | num_batches = 0 155 | y_true = [] 156 | y_pred = [] 157 | for _, (data, label) in enumerate(data_loader): 158 | # run model 159 | data, label = Variable(data.type(torch.float).to(device)), \ 160 | Variable(label.type(torch.float).to(device)) 161 | output = model(data) 162 | 163 | # calculate loss 164 | loss = loss_fn(output, label) 165 | avg_loss += loss.data 166 | num_batches += 1 167 | # calculate accuracy 168 | y_pred += list(torch.max(output, dim=1).indices.cpu().numpy()) 169 | y_true += list(torch.max(label, dim=1).indices.cpu().numpy()) 170 | avg_loss /= num_batches 171 | acc = accuracy_score(y_true, y_pred) 172 | f1 = f1_score(y_true, y_pred) 173 | prec = precision_score(y_true, y_pred) 174 | recall = recall_score(y_true, y_pred) 175 | tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel() 176 | print('\t{:s} loss: {:f}'.format(dataset_name, avg_loss)) 177 | print('\t{:s} accuracy: {:f}'.format(dataset_name, acc)) 178 | print('\t{:s} f1: {:f}'.format(dataset_name, f1)) 179 | print('\t{:s} precision: {:f}'.format(dataset_name, prec)) 180 | print('\t{:s} recall: {:f}'.format(dataset_name, recall)) 181 | print('\t{:s} confusion matrix (tn, fp, fn, tp): {:d}, {:d}, {:d}, {:d}'.format(dataset_name, tn, fp, fn, tp)) 182 | return avg_loss, f1 183 | 184 | if args.eval: 185 | # eval model 186 | eval_model('train', model, train_loader, len(train_data), mse) 187 | eval_model('val', model, val_loader, len(val_data), mse) 188 | elif args.test: 189 | # eval model on test 190 | test_data = CommandDataset(torch.load(DATA_DIR + TEST_CSV)) 191 | test_loader = torch.utils.data.DataLoader(test_data, batch_size=BATCH_SIZE, shuffle=False) 192 | eval_model('test', model, test_loader, len(test_data), mse) 193 | elif args.analyze: 194 | model.eval() 195 | CSV_FILE = 'val-data.csv' 196 | eval_csv = pd.read_csv(DATA_DIR + CSV_FILE) 197 | # eval_data = CommandDataset(DATA_DIR + CSV_FILE) 198 | # eval_loader = torch.utils.data.DataLoader(eval_data, batch_size=BATCH_SIZE, shuffle=False) 199 | fn_file = open('fn.txt', 'w') 200 | fp_file = open('fp.txt', 'w') 201 | tp_file = open('tp.txt', 'w') 202 | tp_file.write('process\n') 203 | 204 | # print(len(eval_loader)) 205 | # print(len(eval_data)) 206 | 207 | # analyze on all val samples 208 | y_true = [] 209 | y_pred = [] 210 | for i, (data, label) in enumerate(val_loader): 211 | if i % 1000 == 0: 212 | print(i) 213 | 214 | data, label = Variable(data.type(torch.float).to(device)), \ 215 | Variable(label.type(torch.float).to(device)) 216 | output = model(data) 217 | 218 | curr_y_pred = list(torch.max(output, dim=1).indices.cpu().numpy()) 219 | curr_y_true = list(torch.max(label, dim=1).indices.cpu().numpy()) 220 | for j in range(len(curr_y_pred)): 221 | curr_idx = i * BATCH_SIZE + j 222 | # print(i, j) 223 | # false negatives 224 | if curr_y_pred[j] == 0 and curr_y_true[j] == 1: 225 | fn_file.write('\nScript {:d}\n'.format(curr_idx)) 226 | fn_file.write(eval_csv.loc[curr_idx]['command']) 227 | 228 | # fn_file.write('"{:s}"\n'.format(commands[curr_idx])) 229 | 230 | # false positives 231 | if curr_y_pred[j] == 1 and curr_y_true[j] == 0: 232 | fp_file.write('\nScript {:d}\n'.format(curr_idx)) 233 | fp_file.write(eval_csv.loc[curr_idx]['command']) 234 | 235 | # fp_file.write('"{:s}"\n'.format(commands[curr_idx])) 236 | 237 | # true positives 238 | if curr_y_pred[j] == 1 and curr_y_true[j] == 1: 239 | tp_file.write('\nScript {:d}\n'.format(curr_idx)) 240 | tp_file.write(eval_csv.loc[curr_idx]['command']) 241 | 242 | # tp_file.write('"{:s}"\n'.format(commands[curr_idx])) 243 | 244 | y_pred += curr_y_pred 245 | y_true += curr_y_true 246 | 247 | ''' 248 | # analyze on random 100 samples 249 | data = [] 250 | label = [] 251 | sampled_filenames = [] 252 | for i in range(0, 300): 253 | x, y = val_data[i] 254 | data.append(x) 255 | label.append(y) 256 | sampled_filenames.append(val_filenames[i]) 257 | data = Variable(torch.stack(data)) 258 | label = Variable(torch.stack(label)) 259 | output = model(data) 260 | y_pred = list(torch.max(output, dim=1).indices.cpu().numpy()) 261 | y_true = list(torch.max(label, dim=1).indices.cpu().numpy()) 262 | 263 | for i in range(len(y_pred)): 264 | # false negatives 265 | if y_pred[i] == 0 and y_true[i] == 1: 266 | fn_file.write('\n{:s}\n'.format(sampled_filenames[i])) 267 | fn_file.write('Script {:d}\n'.format(i)) 268 | print_command(data[i], int_to_char_dict, fn_file) 269 | 270 | # true positives 271 | if y_pred[i] == 1 and y_true[i] == 1: 272 | tp_file.write('\n{:s}\n'.format(sampled_filenames[i])) 273 | tp_file.write('Script {:d}\n'.format(i)) 274 | print_command(data[i], int_to_char_dict, tp_file) 275 | ''' 276 | 277 | acc = accuracy_score(y_true, y_pred) 278 | f1 = f1_score(y_true, y_pred) 279 | prec = precision_score(y_true, y_pred) 280 | recall = recall_score(y_true, y_pred) 281 | tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel() 282 | 283 | print('\taccuracy: {:f}'.format(acc)) 284 | print('\tf1: {:f}'.format(f1)) 285 | print('\tprecision: {:f}'.format(prec)) 286 | print('\trecall: {:f}'.format(recall)) 287 | print('\tconfusion matrix (tn, fp, fn, tp): {:d}, {:d}, {:d}, {:d}'.format(tn, fp, fn, tp)) 288 | elif args.run: 289 | # run classification on test-scripts directory 290 | TEST_DIR = '../test-scripts/' 291 | for ffile in os.listdir(TEST_DIR): 292 | TENSOR_LENGTH = 1024 293 | char_dict = torch.load('../data/prep/char_dict.pth') 294 | try: 295 | ps_path = ffile 296 | ps_file = open(TEST_DIR + ps_path, 'rb') 297 | ps_tensor = torch.zeros(len(char_dict) + 1, TENSOR_LENGTH) # + 1 for case bit 298 | tensor_len = min(os.path.getsize(TEST_DIR + ps_path), TENSOR_LENGTH) 299 | 300 | for i in range(tensor_len): 301 | byte = ps_file.read(1) 302 | try: 303 | byte_char = byte.decode('utf-8') 304 | except: 305 | continue # invalid char 306 | # check for uppercase 307 | lower_char = byte_char.lower() 308 | if byte_char.isupper() and lower_char in char_dict: 309 | ps_tensor[len(char_dict)][i] = 1 310 | byte_char = lower_char 311 | # check if byte is most frequent 312 | if byte_char in char_dict: 313 | ps_tensor[char_dict[byte_char]][i] = 1 314 | ps_file.close() 315 | # run input through model 316 | ps_tensor = ps_tensor.view(1, ps_tensor.shape[0], ps_tensor.shape[1]).to(device) 317 | output = model(ps_tensor) 318 | # 1 is positive obfuscated, 0 is negative non-obfuscated 319 | print(ffile + ' output:', int(torch.argmax(output[0]))) 320 | except Exception as e: 321 | print(e) 322 | else: 323 | # train model 324 | print(len(train_loader)) 325 | for i in range(epoch, EPOCHS): 326 | print('epoch', i) 327 | # run training 328 | model.train() 329 | avg_loss = 0. 330 | y_true = [] 331 | y_pred = [] 332 | for batch_idx, (data, label) in enumerate(train_loader): 333 | data, label = Variable(data.type(torch.float).to(device)), \ 334 | Variable(label.type(torch.float).to(device)) 335 | output = model(data) 336 | loss = mse(output, label) 337 | optimizer.zero_grad() 338 | loss.backward() 339 | optimizer.step() 340 | 341 | avg_loss += loss.data 342 | y_pred += list(torch.max(output, dim=1).indices.cpu().numpy()) 343 | y_true += list(torch.max(label, dim=1).indices.cpu().numpy()) 344 | 345 | if batch_idx % int(len(train_loader) / 5) == 0: 346 | print('\t\tbatch {:d}: {:f}'.format(batch_idx, loss.data)) 347 | 348 | # eval model 349 | # eval_model('train', model, train_loader, len(train_data), mse) 350 | avg_loss /= len(train_loader) 351 | acc = accuracy_score(y_true, y_pred) 352 | f1 = f1_score(y_true, y_pred) 353 | prec = precision_score(y_true, y_pred) 354 | recall = recall_score(y_true, y_pred) 355 | tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel() 356 | print('\ttrain loss: {:f}'.format(avg_loss)) 357 | print('\ttrain accuracy: {:f}'.format(acc)) 358 | print('\ttrain f1: {:f}'.format(f1)) 359 | print('\ttrain precision: {:f}'.format(prec)) 360 | print('\ttrain recall: {:f}'.format(recall)) 361 | print('\ttrain confusion matrix (tn, fp, fn, tp): {:d}, {:d}, {:d}, {:d}'.format(tn, fp, fn, tp)) 362 | 363 | _, val_f1 = eval_model('val', model, val_loader, len(val_data), mse) 364 | 365 | # save model every epoch if better val f1 366 | if val_f1 > best_val_f1: 367 | print('saving this best checkpoint') 368 | best_val_f1 = val_f1 369 | torch.save({ 370 | 'epoch': i, 371 | 'model_state_dict': model.state_dict(), 372 | 'optimizer_state_dict': optimizer.state_dict(), 373 | 'val_f1': val_f1 374 | }, model_file) 375 | -------------------------------------------------------------------------------- /_DEPRECATED_CNN/scripts/unk_word_ratio.py: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: Security Intelligence Team within the Security Coordination Center 3 | # 4 | # Copyright 2021 Adobe. All rights reserved. 5 | # This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. You may obtain a copy 7 | # of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software distributed under 10 | # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | # OF ANY KIND, either express or implied. See the License for the specific language 12 | # governing permissions and limitations under the License. 13 | # 14 | 15 | import torch 16 | import re 17 | 18 | # from https://github.com/first20hours/google-10000-english, removed a-z letters 19 | top_10k_file = open('../data/top-10k-words.txt') 20 | top_10k_words = set(top_10k_file.read().split()) 21 | 22 | print(len(top_10k_words)) 23 | 24 | commands = torch.load('../data/scripts/all_scripts.pth') 25 | print(len(commands)) 26 | # print(commands[0]) 27 | # command = ''.join(e for e in commands[0] if e.isalnum() or e == ' ') 28 | # print(command) 29 | # tokens = command.split() 30 | # print(tokens) 31 | # known = 0 32 | # for token in tokens: 33 | # token = token.lower() 34 | # if token in top_10k_words: 35 | # known += 1 36 | # print(known) 37 | # print(len(tokens)) 38 | 39 | ratios = [] 40 | for command in commands: 41 | command = re.sub(r'\W+', ' ', command) 42 | tokens = command.split() 43 | if len(tokens) == 0: 44 | ratios.append(0) 45 | continue 46 | known = 0 47 | for token in tokens: 48 | token = token.lower() 49 | if token in top_10k_words: 50 | known += 1 51 | ratios.append(known / len(tokens)) 52 | 53 | print(len(ratios)) 54 | print(ratios[0]) 55 | 56 | sorted_idx = sorted(range(len(ratios)), key = lambda k: ratios[k], reverse = True) 57 | ranked_file = open('../data/unk_word_ratio_ranked_only_cmd.txt', 'w') 58 | for i in sorted_idx: 59 | ranked_file.write('ratio: ' + str(ratios[i]) + '\n') 60 | ranked_file.write(commands[i] + '\n') 61 | 62 | 63 | # print(ratios[len(ratios) - 1]) 64 | # command = commands[sorted_idx[len(ratios) - 1]] 65 | # print(command) 66 | # command = re.sub(r'\W+', ' ', command) 67 | # print(command) 68 | # tokens = command.split() 69 | # print(tokens) 70 | # known = 0 71 | # for token in tokens: 72 | # token = token.lower() 73 | # if token in top_10k_words: 74 | # known += 1 75 | # print(known) 76 | # print(len(tokens)) 77 | # print(str(known / len(tokens))) 78 | 79 | for i in sorted_idx[0:5]: 80 | print(ratios[i]) 81 | print(re.sub(r'\W+', ' ', commands[i]).split()) 82 | print() 83 | for i in sorted_idx[len(ratios)-5:]: 84 | print(ratios[i]) 85 | print(re.sub(r'\W+', ' ', commands[i]).split()) 86 | print() -------------------------------------------------------------------------------- /_DEPRECATED_CNN/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | with open("README.md", "r", encoding="utf-8") as fh: 4 | long_description = fh.read() 5 | 6 | setuptools.setup( 7 | name="obfuscation-detection", 8 | version="1.0.0", 9 | author="Wilson Tang", 10 | author_email="wilson.tang06@gmail.com", 11 | description="Python module for obfuscation classification in command line executions", 12 | long_description=long_description, 13 | long_description_content_type="text/markdown", 14 | url="https://github.com/adobe/obfuscation-detection", 15 | project_urls={ 16 | "Bug Tracker": "https://github.com/adobe/obfuscation-detection/issues", 17 | }, 18 | classifiers=[ 19 | "Programming Language :: Python :: 3.0", 20 | "License :: OSI Approved :: Apache Software License", 21 | "Operating System :: OS Independent", 22 | ], 23 | packages=setuptools.find_packages(), 24 | install_requires = ['xgboost', 'scikit-learn'], 25 | python_requires=">=3.10", 26 | include_package_data=True, 27 | ) -------------------------------------------------------------------------------- /commands.csv: -------------------------------------------------------------------------------- 1 | commands 2 | cmd.exe /c "echo Invoke-DOSfuscation" 3 | cm%windir:~ -4, -3%.e^Xe,;^,/^C",;,S^Et ^^o^=fus^cat^ion&,;,^se^T ^ ^ ^B^=o^ke-D^OS&&,;,s^Et^^ d^=ec^ho I^nv&&,;,C^Al^l,;,^%^D%^%B%^%o^%" 4 | cat /etc/passwd -------------------------------------------------------------------------------- /obfuscation_detection/__init__.py: -------------------------------------------------------------------------------- 1 | from . import model 2 | from .model import * -------------------------------------------------------------------------------- /obfuscation_detection/main.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import pandas as pd 3 | from model import ObfuscationDetectionClassifier 4 | 5 | def main(): 6 | parser = argparse.ArgumentParser(description="Provide a .csv file with commands") 7 | parser.add_argument("--filename", help="Path to the input file") 8 | 9 | args = parser.parse_args() 10 | filename = args.filename 11 | 12 | commands = pd.read_csv(filename, sep='\t')['commands'].tolist() 13 | model = ObfuscationDetectionClassifier() 14 | y = model.predict(commands) 15 | 16 | print(y) 17 | 18 | if __name__ == "__main__": 19 | main() -------------------------------------------------------------------------------- /obfuscation_detection/model.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import os 3 | from importlib.resources import files 4 | from xgboost import XGBClassifier 5 | 6 | class ObfuscationDetectionClassifier: 7 | MAX_INPUT_LENGTH = 8192 8 | 9 | MODEL_PARAMS = { 10 | "booster": "gbtree", 11 | "device": "cpu", 12 | "random_state": 42, 13 | "n_estimators": 50, 14 | "learning_rate": 0.3, 15 | "gamma": 0, 16 | "max_depth": 6, 17 | "min_child_weight": 1, 18 | "max_delta_step": 0, 19 | "subsample": 1, 20 | "sampling_method": "uniform", 21 | "colsample_bylevel": 1, 22 | "colsample_bynode": 1, 23 | "colsample_bytree": 1, 24 | "reg_lambda": 1, 25 | "reg_alpha": 0, 26 | "tree_method": "auto", 27 | "scale_pos_weight": 1, 28 | "max_leaves": 0, 29 | "max_bin": 256, 30 | "num_parallel_tree": 1, 31 | "objective": "binary:logistic", 32 | "validate_parameters": True, 33 | } 34 | 35 | CHAR_DICT = { 36 | ' ': 9, 37 | '"': 22, 38 | '#': 93, 39 | '$': 69, 40 | '%': 82, 41 | '&': 77, 42 | "'": 70, 43 | '(': 74, 44 | ')': 73, 45 | '*': 91, 46 | '+': 85, 47 | ',': 68, 48 | '-': 27, 49 | '.': 34, 50 | '/': 45, 51 | '0': 28, 52 | '1': 44, 53 | '2': 47, 54 | '3': 53, 55 | '4': 37, 56 | '5': 60, 57 | '6': 62, 58 | '7': 66, 59 | '8': 46, 60 | '9': 61, 61 | ':': 49, 62 | ';': 72, 63 | '<': 81, 64 | '=': 71, 65 | '>': 78, 66 | '?': 92, 67 | '@': 90, 68 | 'A': 0, 69 | 'B': 2, 70 | 'C': 4, 71 | 'D': 30, 72 | 'E': 31, 73 | 'F': 38, 74 | 'G': 16, 75 | 'H': 23, 76 | 'I': 8, 77 | 'J': 63, 78 | 'K': 67, 79 | 'L': 50, 80 | 'M': 36, 81 | 'N': 43, 82 | 'O': 55, 83 | 'P': 39, 84 | 'Q': 14, 85 | 'R': 56, 86 | 'S': 32, 87 | 'T': 42, 88 | 'U': 25, 89 | 'V': 76, 90 | 'W': 59, 91 | 'X': 75, 92 | 'Y': 57, 93 | 'Z': 35, 94 | '[': 88, 95 | '\\': 5, 96 | ']': 87, 97 | '^': 64, 98 | '_': 41, 99 | '`': 89, 100 | 'a': 11, 101 | 'b': 24, 102 | 'c': 12, 103 | 'd': 19, 104 | 'e': 1, 105 | 'f': 51, 106 | 'g': 3, 107 | 'h': 52, 108 | 'i': 17, 109 | 'j': 58, 110 | 'k': 33, 111 | 'l': 15, 112 | 'm': 26, 113 | 'n': 18, 114 | 'o': 6, 115 | 'p': 21, 116 | 'q': 84, 117 | 'r': 13, 118 | 's': 10, 119 | 't': 7, 120 | 'u': 29, 121 | 'v': 48, 122 | 'w': 20, 123 | 'x': 54, 124 | 'y': 40, 125 | 'z': 65, 126 | '{': 79, 127 | '|': 86, 128 | '}': 80, 129 | '~': 83 130 | } 131 | 132 | def __init__(self): 133 | self.model = XGBClassifier(**ObfuscationDetectionClassifier.MODEL_PARAMS) 134 | try: 135 | # Works when installed as a package (via pip) 136 | model_file = str(files("obfuscation_detection.models") / "od-cmdexe-xgb-model.json") 137 | except (ModuleNotFoundError, AttributeError): 138 | # Fallback for local run: find relative path manually 139 | model_file = os.path.join(os.path.dirname(__file__), "models", "od-cmdexe-xgb-model.json") 140 | self.model.load_model(model_file) 141 | 142 | def vectorize_commands(self, commands): 143 | VECTOR_LENGTH = len(ObfuscationDetectionClassifier.CHAR_DICT) + 3 144 | X = [] 145 | for command in commands: 146 | command_vectorized = [0.0 for _ in range(VECTOR_LENGTH)] 147 | command_vectorized[VECTOR_LENGTH - 1] = float(len(command)) # command line length 148 | # shorten command 149 | command = command[:ObfuscationDetectionClassifier.MAX_INPUT_LENGTH] 150 | command_chars = {s: command.count(s) for s in set(command)} 151 | unk_chars = 0 152 | alnum_chars = 0 153 | 154 | for char in command_chars: 155 | if char in ObfuscationDetectionClassifier.CHAR_DICT: 156 | command_vectorized[ObfuscationDetectionClassifier.CHAR_DICT[char]] = command_chars[char] / len(command) # char frequency 157 | elif not (char.isalnum() or char in ('!', '\n', '\r', '\t')): 158 | unk_chars += command_chars[char] 159 | 160 | if char.isalnum(): 161 | alnum_chars += command_chars[char] 162 | # else continue bc one of character exclusions 163 | 164 | command_vectorized[VECTOR_LENGTH - 2] = unk_chars / len(command) # unknown chars 165 | command_vectorized[VECTOR_LENGTH - 3] = alnum_chars / len(command) # alphanumeric chars 166 | X.append(command_vectorized) 167 | return np.array(X) 168 | 169 | def predict(self, commands): 170 | X = self.vectorize_commands(commands) 171 | return self.model.predict(X) 172 | 173 | def predict_proba(self, commands): 174 | X = self.vectorize_commands(commands) 175 | return self.model.predict_proba(X) 176 | 177 | if __name__ == "__main__": 178 | model = ObfuscationDetectionClassifier() 179 | commands = [ 180 | 'cmd.exe /c "echo Invoke-DOSfuscation"', 181 | 'cm%windir:~ -4, -3%.e^Xe,;^,/^C",;,S^Et ^^o^=fus^cat^ion&,;,^se^T ^ ^ ^B^=o^ke-D^OS&&,;,s^Et^^ d^=ec^ho I^nv&&,;,C^Al^l,;,^%^D%^%B%^%o^%"', 182 | 'cat /etc/passwd' 183 | ] 184 | y = model.predict(commands) 185 | y_prob = model.predict_proba(commands) 186 | 187 | print(y) 188 | print(y_prob) 189 | -------------------------------------------------------------------------------- /obfuscation_detection/models/od-cmdexe-xgb-model.json: -------------------------------------------------------------------------------- 1 | {"learner":{"attributes":{"scikit_learn":"{\"_estimator_type\": \"classifier\"}"},"feature_names":[],"feature_types":[],"gradient_booster":{"model":{"gbtree_model_param":{"num_parallel_tree":"1","num_trees":"50"},"iteration_indptr":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"tree_info":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"trees":[{"base_weights":[-1.0491086E0,5.323152E0,-1.1179794E0,-7.530378E-1,7.901344E0,-1.1331086E0,4.077546E0,5.477887E0,-3.39007E-1,8.011666E0,-4.1946507E-1,-1.1372051E0,4.8364224E0,-7.988944E-1,7.4087296E0,1.9824818E-1,1.9648489E0,3.06881E0,2.4150271E0,-2.376501E-1,1.1033056E-1,-1.1399857E0,-2.5333902E-1,-8.778448E-1,2.2100878E0,-3.3367717E-1,1.420544E0,8.416308E-2,7.713461E0,1.4639966E0,-1.7785878E-1,-3.420397E-1,-7.9098976E-1,-1.1087453E0,2.138005E0,-3.3764113E-2,-2.937605E-1,-1.9333582E-1,2.5442523E-1,7.8133616E0,3.985199E-1,-3.2031432E-1,2.8276762E-1,8.797287E-2,-3.3870658E-1,2.3692014E0,8.67516E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":0,"left_children":[1,3,5,7,9,11,13,15,-1,17,19,21,23,25,27,-1,-1,29,-1,-1,-1,31,33,35,-1,-1,-1,37,39,-1,-1,-1,41,43,-1,-1,-1,-1,-1,45,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[1.5201023E4,5.80821E3,2.6971523E3,2.6751804E2,2.4215137E2,8.407461E2,1.6250737E3,2.9317963E1,0E0,2.4064453E1,1.568839E0,8.360156E1,3.479156E2,7.698695E1,1.3175E2,0E0,0E0,2.6746376E1,0E0,0E0,0E0,8.4375E-1,6.917855E2,5.2127266E-1,0E0,0E0,0E0,2.428054E0,2.5939453E1,0E0,0E0,0E0,9.427335E0,3.1153793E0,0E0,0E0,0E0,0E0,0E0,2.4853516E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,9,9,10,10,11,11,12,12,13,13,14,14,17,17,21,21,22,22,23,23,27,27,28,28,32,32,33,33,39,39],"right_children":[2,4,6,8,10,12,14,16,-1,18,20,22,24,26,28,-1,-1,30,-1,-1,-1,32,34,36,-1,-1,-1,38,40,-1,-1,-1,42,44,-1,-1,-1,-1,-1,46,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.0198434E-4,1.5873017E-2,7.352941E-3,3.7037037E-2,8.3402835E-4,8.241759E-3,1.0989011E-3,-3.39007E-1,6.455778E-4,1.7456358E-2,1.14613185E-2,1.0683761E-3,1.0683761E-3,1.34E2,1.9824818E-1,1.9648489E0,3.2967033E-3,2.4150271E0,-2.376501E-1,1.1033056E-1,1.0256411E-2,1.0683761E-3,6.1068702E-2,2.2100878E0,-3.3367717E-1,1.420544E0,7.712766E-2,5.6834327E-4,1.4639966E0,-1.7785878E-1,-3.420397E-1,5.4054055E-3,1.5544041E-2,2.138005E0,-3.3764113E-2,-2.937605E-1,-1.9333582E-1,2.5442523E-1,1.6420361E-3,3.985199E-1,-3.2031432E-1,2.8276762E-1,8.797287E-2,-3.3870658E-1,2.3692014E0,8.67516E-1],"split_indices":[94,82,77,19,27,64,71,66,0,71,15,77,68,68,96,0,0,1,0,0,0,77,68,9,0,0,0,1,92,0,0,0,82,12,0,0,0,0,0,78,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[3.4622758E4,3.693827E2,3.4253375E4,1.1025218E2,2.591305E2,3.41547E4,9.867516E1,5.518019E0,1.0473417E2,2.5577641E2,3.35409E0,3.4132086E4,2.2613058E1,4.0357277E1,5.8317886E1,1.2983575E0,4.2196617E0,2.596715E0,2.531797E2,2.2721255E0,1.0819645E0,3.4024754E4,1.0733088E2,7.140966E0,1.5472093E1,3.895072E1,1.4065539E0,2.380322E0,5.5937565E1,1.5147504E0,1.0819645E0,3.40082E4,1.6554058E1,9.694402E1,1.038686E1,1.0819645E0,6.0590014E0,1.2983575E0,1.0819645E0,5.4855602E1,1.0819645E0,1.4606521E1,1.9475361E0,1.190161E0,9.575386E1,5.334085E1,1.5147504E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"47","size_leaf_vector":"1"}},{"base_weights":[-1.0218124E0,1.2846205E0,-1.0792767E0,-7.306975E-1,1.6126971E0,-1.0935013E0,1.0309812E0,1.6895027E0,-3.2603317E-1,1.6247178E0,-5.709192E-1,-1.096934E0,1.2232143E0,-6.036835E-1,1.5972148E0,5.723299E-1,-7.4363515E-2,1.6291955E0,-9.228669E-2,-2.0110115E-2,-2.1880056E-1,-3.2973993E-1,-5.044277E-1,-8.5713905E-1,5.176645E-1,-3.260746E-1,1.6316212E0,-2.1702757E-1,1.6334275E0,1.6332271E0,-8.107175E-2,-1.079954E0,1.8798378E0,-3.3480844E-1,1.1603488E-1,-4.6595573E-2,5.740253E-1,1.6665862E0,1.947855E-1,4.909618E-1,1.8707773E-1,-3.276879E-1,-2.1271288E-2,1.4424373E-1,5.807076E-1,5.117199E-1,2.4327928E-1,2.9115334E-1,-2.498083E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":1,"left_children":[1,3,5,7,9,11,13,15,-1,17,19,21,23,25,27,-1,-1,29,-1,-1,-1,-1,31,33,-1,-1,35,-1,37,39,-1,41,43,-1,-1,-1,-1,45,47,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[3.572998E3,4.3460583E2,7.903965E2,8.151996E1,1.5733765E1,2.0904102E2,1.6439265E2,5.6531944E0,0E0,5.3571777E0,2.5668728E-1,3.342383E1,4.23541E1,5.162451E1,1.2225189E1,0E0,0E0,4.7304688E0,0E0,0E0,0E0,0E0,1.3689143E2,3.0967646E0,0E0,0E0,4.6294518E0,0E0,5.8625183E0,8.491211E-1,0E0,9.1617584E-1,5.911255E-1,0E0,0E0,0E0,0E0,2.8589783E0,4.039685E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,9,9,10,10,11,11,12,12,13,13,14,14,17,17,22,22,23,23,26,26,28,28,29,29,31,31,32,32,37,37,38,38],"right_children":[2,4,6,8,10,12,14,16,-1,18,20,22,24,26,28,-1,-1,30,-1,-1,-1,-1,32,34,-1,-1,36,-1,38,40,-1,42,44,-1,-1,-1,-1,46,48,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.0198434E-4,1.4652015E-2,7.352941E-3,3.7433155E-2,8.3402835E-4,8.241759E-3,6.4102565E-3,-3.2603317E-1,4.8034936E-2,1.2376238E-2,1.0256411E-2,6.2539085E-4,6.2539085E-4,1.2E2,5.723299E-1,-7.4363515E-2,4.3196544E-2,-9.228669E-2,-2.0110115E-2,-2.1880056E-1,-3.2973993E-1,6.2539085E-4,8.223684E-4,5.176645E-1,-3.260746E-1,2.7149322E-3,-2.1702757E-1,2.4725275E-2,7.843138E-3,-8.107175E-2,2.4561403E-2,5.050505E-2,-3.3480844E-1,1.1603488E-1,-4.6595573E-2,5.740253E-1,4.1198503E-2,1.9950125E-2,4.909618E-1,1.8707773E-1,-3.276879E-1,-2.1271288E-2,1.4424373E-1,5.807076E-1,5.117199E-1,2.4327928E-1,2.9115334E-1,-2.498083E-1],"split_indices":[94,82,77,19,27,64,71,54,0,17,5,77,83,83,96,0,0,11,0,0,0,0,83,65,0,0,68,0,31,78,0,51,9,0,0,0,0,12,17,0,0,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[2.694696E4,6.545375E2,2.6292424E4,9.146381E1,5.6307367E2,2.611686E4,1.7556445E2,1.1250661E1,8.021316E1,5.602455E2,2.8281612E0,2.6078746E4,3.8113678E1,4.515113E1,1.3041331E2,1.0125248E1,1.1254135E0,5.591068E2,1.1386875E0,1.0168717E0,1.8112894E0,2.5981465E4,9.728053E1,7.2757516E0,3.0837927E1,3.754775E1,7.6033826E0,1.7122004E0,1.2870111E2,5.5806244E2,1.0443647E0,7.880518E1,1.8475351E1,6.1074624E0,1.1682895E0,1.0968454E0,6.5065374E0,1.256467E2,3.054422E0,5.556188E2,2.4436517E0,7.777167E1,1.0335131E0,1.0781591E0,1.7397192E1,1.19199745E2,6.4469533E0,1.7720252E0,1.2823966E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"49","size_leaf_vector":"1"}},{"base_weights":[-9.92592E-1,1.0964515E0,-1.050404E0,-6.9222355E-1,1.3646954E0,-1.064924E0,8.6857086E-1,1.2839898E0,-3.1653067E-1,-4.0965772E-1,1.3783203E0,-1.0684627E0,9.9937505E-1,-3.1356856E-1,1.2102277E0,-6.784712E-2,4.598268E-1,1.2896368E-1,-2.3720919E-1,1.3864892E0,1.7185026E-1,-3.2122633E-1,-4.7605485E-1,-9.433422E-1,1.3841317E0,1.3719056E0,-9.0932447E-1,1.3903735E0,3.9377904E-1,-3.1885418E-1,2.9991806E-1,-1.0439643E0,1.5053262E0,-3.131198E-1,-7.014041E-2,-4.7481903E-3,4.311244E-1,4.3101457E-1,1.424203E0,-3.0412236E-1,-5.370584E-3,4.177036E-1,7.755187E-2,-6.360736E-2,2.428899E-1,-3.1798673E-1,-1.2798819E-2,4.7003803E-1,1.1456939E-1,-1.6721478E-1,3.350095E-1,6.589401E-2,4.3797848E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":2,"left_children":[1,3,5,7,9,11,13,15,-1,17,19,21,23,-1,25,-1,-1,-1,-1,27,29,-1,31,33,35,37,39,41,43,-1,-1,45,47,-1,-1,-1,-1,49,51,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[2.4754668E3,2.6588666E2,5.564219E2,5.3471863E1,1.2181274E1,1.4561328E2,9.95192E1,4.75165E0,0E0,1.757858E0,4.463623E0,2.6308594E1,2.700267E1,0E0,4.510031E1,0E0,0E0,0E0,0E0,1.2791748E0,5.5090795E0,0E0,8.925301E1,2.0314932E-1,2.1799011E0,5.2563324E0,8.8201475E-1,6.923828E-1,9.882874E-1,0E0,0E0,9.339905E-1,6.2861633E-1,0E0,0E0,0E0,0E0,5.8515778E0,4.524063E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,9,9,10,10,11,11,12,12,14,14,19,19,20,20,22,22,23,23,24,24,25,25,26,26,27,27,28,28,31,31,32,32,37,37,38,38],"right_children":[2,4,6,8,10,12,14,16,-1,18,20,22,24,-1,26,-1,-1,-1,-1,28,30,-1,32,34,36,38,40,42,44,-1,-1,46,48,-1,-1,-1,-1,50,52,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.0198434E-4,1.4652015E-2,7.352941E-3,1.01E2,8.3402835E-4,5.4945056E-3,9.3E2,-3.1653067E-1,2.8653296E-2,3.539823E-2,1.0256411E-2,6.1500614E-4,-3.1356856E-1,3.649635E-2,-6.784712E-2,4.598268E-1,1.2896368E-1,-2.3720919E-1,7.843138E-3,1.2096774E-2,-3.2122633E-1,6.2539085E-4,3.6585366E-3,3.09E2,9.0198434E-4,7.782101E-3,7.7922076E-2,8.130081E-3,-3.1885418E-1,2.9991806E-1,2.9351536E-2,7.5510204E-1,-3.131198E-1,-7.014041E-2,-4.7481903E-3,4.311244E-1,2.8910303E-2,2.0050125E-2,-3.0412236E-1,-5.370584E-3,4.177036E-1,7.755187E-2,-6.360736E-2,2.428899E-1,-3.1798673E-1,-1.2798819E-2,4.7003803E-1,1.1456939E-1,-1.6721478E-1,3.350095E-1,6.589401E-2,4.3797848E-1],"split_indices":[94,82,77,19,96,64,71,96,0,22,11,77,76,0,27,0,0,0,0,78,4,0,83,36,96,82,51,10,28,0,0,20,94,0,0,0,0,71,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[2.0486535E4,5.511912E2,1.9935344E4,7.1675026E1,4.795162E2,1.9786076E4,1.4926744E2,1.0725625E1,6.0949398E1,3.4325376E0,4.7608368E2,1.9752697E4,3.337843E1,2.2299109E1,1.2696833E2,1.5297987E0,9.195827E0,1.0315564E0,2.4009812E0,4.7273364E2,3.3500514E0,1.9675775E4,7.692214E1,5.277819E0,2.8100613E1,1.18297424E2,8.670905E0,4.704921E2,2.2415316E0,1.2307234E0,2.119328E0,6.0153793E1,1.6768349E1,4.21102E0,1.0667995E0,1.0496447E0,2.7050966E1,6.7157083E0,1.1158172E2,7.6389055E0,1.0319995E0,4.6944415E2,1.0479405E0,1.1118982E0,1.1296334E0,5.9150543E1,1.0032482E0,1.5524302E1,1.2440481E0,2.8273144E0,3.8883939E0,3.419901E0,1.0816181E2],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"53","size_leaf_vector":"1"}},{"base_weights":[-9.717786E-1,9.921221E-1,-1.0298176E0,-6.597208E-1,1.2299863E0,-1.0484197E0,4.0974817E-1,1.0640904E0,-3.091221E-1,-3.5788155E-1,1.2432277E0,-1.0506094E0,6.8129987E-1,-5.731527E-1,1.3070438E0,-5.657187E-2,3.8762435E-1,-2.1929418E-1,1.13005206E-1,1.2506758E0,2.3846788E-2,-3.1560713E-1,-9.905901E-1,-2.8237617E-1,1.1715144E0,-9.4619143E-1,1.1614854E0,-1.7080995E-1,3.9986777E-1,1.254174E0,3.415503E-2,-2.393068E-1,2.2769977E-1,-3.1476486E-1,2.4252975E0,3.7638038E-1,1.0677363E-3,-1.0177217E0,3.156466E-1,-6.992782E-2,3.8106236E-1,3.77114E-1,4.2685144E-2,-3.1197655E-1,9.1928504E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":3,"left_children":[1,3,5,7,9,11,13,15,-1,17,19,21,23,25,27,-1,-1,-1,-1,29,31,-1,33,-1,35,37,39,-1,-1,41,-1,-1,-1,-1,-1,-1,-1,43,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[1.763793E3,1.7543546E2,4.0269824E2,3.725912E1,8.620544E0,5.688672E1,1.7039725E2,3.2446575E0,0E0,1.3694856E0,3.4744263E0,2.1582031E-1,1.6499332E1,6.0950516E1,5.6509857E0,0E0,0E0,0E0,0E0,1.3822632E0,2.635884E0,0E0,1.9901758E2,0E0,1.4813709E0,1.20308E1,2.8462715E0,0E0,0E0,1.0419312E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,2.5096436E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,9,9,10,10,11,11,12,12,13,13,14,14,19,19,20,20,22,22,24,24,25,25,26,26,29,29,37,37],"right_children":[2,4,6,8,10,12,14,16,-1,18,20,22,24,26,28,-1,-1,-1,-1,30,32,-1,34,-1,36,38,40,-1,-1,42,-1,-1,-1,-1,-1,-1,-1,44,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.0198434E-4,1.0256411E-2,7.352941E-3,1.01E2,8.3402835E-4,6.2539085E-4,9.3E2,-3.091221E-1,1.4336918E-2,4.375E-2,1.5E-3,3.96E2,2.8910303E-2,9.0198434E-4,-5.657187E-2,3.8762435E-1,-2.1929418E-1,1.13005206E-1,2.8880866E-2,8E-3,-3.1560713E-1,6.2539085E-4,-2.8237617E-1,4.1800644E-2,8E2,3.6363637E-3,-1.7080995E-1,3.9986777E-1,1.5384615E-2,3.415503E-2,-2.393068E-1,2.2769977E-1,-3.1476486E-1,2.4252975E0,3.7638038E-1,1.0677363E-3,1.6501651E-3,3.156466E-1,-6.992782E-2,3.8106236E-1,3.77114E-1,4.2685144E-2,-3.1197655E-1,9.1928504E-2],"split_indices":[94,82,77,19,96,64,83,96,0,71,17,82,96,71,82,0,0,0,0,0,28,0,83,0,10,96,20,0,0,70,0,0,0,0,0,0,0,35,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.5464238E4,4.434328E2,1.5020806E4,5.5593235E1,3.8783957E2,1.482945E4,1.9135513E2,9.507884E0,4.608535E1,2.9922433E0,3.8484732E2,1.4811094E4,1.835712E1,9.1493774E1,9.986137E1,1.4906437E0,8.017241E0,1.9875908E0,1.0046525E0,3.824854E2,2.361908E0,1.4453962E4,3.5713168E2,4.0458236E0,1.4311297E1,7.567433E1,1.5819441E1,1.0712427E0,9.879012E1,3.8120914E2,1.2762818E0,1.0752478E0,1.2866603E0,3.5571805E2,1.4136364E0,1.3291566E1,1.0197315E0,7.353296E1,2.1413722E0,1.0613686E0,1.4758072E1,3.8009662E2,1.1125089E0,7.253158E1,1.001381E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"45","size_leaf_vector":"1"}},{"base_weights":[-9.568738E-1,9.235199E-1,-1.0151353E0,-6.2987757E-1,1.1432314E0,-1.0340518E0,3.8111016E-1,9.0969455E-1,-3.02904E-1,-2.2594711E-1,1.1591004E0,-1.0363209E0,6.0641146E-1,-5.40085E-1,1.2017076E0,3.3399403E-1,-1.0132492E-1,-2.2463226E-1,2.0157689E-1,1.1690911E0,9.1147665E-3,-3.113576E-1,-9.7192574E-1,-2.6246384E-1,1.0535781E0,-9.416701E-1,9.0283644E-1,-4.383064E-2,3.6882383E-1,1.1741247E0,6.814791E-2,-2.6343206E-1,2.2470137E-1,-3.102606E-1,1.2337513E0,3.4342307E-1,9.060518E-4,-1.022448E0,2.7861768E-1,-1.5626751E-1,1.0728207E0,3.5333392E-1,8.5063435E-2,6.7162365E-1,-3.230897E-1,-3.095157E-1,-7.8445435E-2,1.0829276E-2,3.4454295E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":4,"left_children":[1,3,5,7,9,11,13,15,-1,17,19,21,23,25,27,-1,-1,-1,-1,29,31,-1,33,-1,35,37,39,-1,-1,41,-1,-1,-1,-1,43,-1,-1,45,-1,-1,47,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[1.2739082E3,1.2007916E2,2.9808008E2,2.663485E1,6.9265747E0,4.202246E1,1.1508772E2,2.72013E0,0E0,2.5457506E0,3.4750366E0,9.082031E-2,1.15139885E1,4.2578022E1,3.1809235E0,0E0,0E0,0E0,0E0,1.1593018E0,3.0346427E0,0E0,3.9016663E1,0E0,1.2164001E0,9.534782E0,4.476738E0,0E0,0E0,6.390991E-1,0E0,0E0,0E0,0E0,2.0990456E1,0E0,0E0,1.178627E-1,0E0,0E0,1.1185131E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,9,9,10,10,11,11,12,12,13,13,14,14,19,19,20,20,22,22,24,24,25,25,26,26,29,29,34,34,37,37,40,40],"right_children":[2,4,6,8,10,12,14,16,-1,18,20,22,24,26,28,-1,-1,-1,-1,30,32,-1,34,-1,36,38,40,-1,-1,42,-1,-1,-1,-1,44,-1,-1,46,-1,-1,48,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.0198434E-4,1.0256411E-2,7.352941E-3,1.16E2,8.3402835E-4,6.2539085E-4,6.4102565E-3,-3.02904E-1,1.8181818E-2,3.539823E-2,1.5E-3,3.96E2,2.1276595E-2,5.1282053E-3,3.3399403E-1,-1.0132492E-1,-2.2463226E-1,2.0157689E-1,7.843138E-3,1.2096774E-2,-3.113576E-1,6.2539085E-4,-2.6246384E-1,4.1800644E-2,8E2,3.4482758E-3,-4.383064E-2,3.6882383E-1,4.375E-2,6.814791E-2,-2.6343206E-1,2.2470137E-1,-3.102606E-1,7.575758E-3,3.4342307E-1,9.060518E-4,6.116208E-3,2.7861768E-1,-1.5626751E-1,2.5720164E-2,3.5333392E-1,8.5063435E-2,6.7162365E-1,-3.230897E-1,-3.095157E-1,-7.8445435E-2,1.0829276E-2,3.4454295E-1],"split_indices":[94,82,77,19,96,64,83,54,0,71,11,82,96,71,71,0,0,0,0,78,4,0,83,0,10,96,20,0,0,17,0,0,0,0,47,0,0,63,0,0,71,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.1618514E4,3.487197E2,1.1269794E4,4.2979626E1,3.0574008E2,1.1119406E4,1.5038788E2,8.228658E0,3.475097E1,3.3512952E0,3.023888E2,1.1104415E4,1.4991078E1,7.101214E1,7.937573E1,7.1664157E0,1.0622417E0,2.2229393E0,1.128356E0,2.9976788E2,2.6209166E0,1.0830659E4,2.7375577E2,3.25431E0,1.1736769E1,5.5823162E1,1.5188976E1,1.5126792E0,7.786306E1,2.979293E2,1.8385895E0,1.1068525E0,1.514064E0,2.667552E2,7.0005817E0,1.0717106E1,1.019663E0,5.394669E1,1.8764724E0,1.3998628E0,1.3789114E1,2.9639038E2,1.5388899E0,4.9004073E0,2.1001744E0,5.2945827E1,1.0008636E0,1.038298E0,1.2750815E1],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"49","size_leaf_vector":"1"}},{"base_weights":[-9.457463E-1,8.7615734E-1,-1.0042512E0,-6.0206574E-1,1.0855019E0,-1.0235283E0,3.5811433E-1,7.758665E-1,-2.9722917E-1,1.0989909E0,-1.1706432E-1,-1.0258937E0,5.4452807E-1,-5.1308125E-1,1.1255562E0,-7.375835E-2,3.0934682E-1,1.1073203E0,-9.427077E-2,-3.0828506E-1,-9.537807E-1,-2.2671053E-1,9.919287E-1,-9.735013E-1,6.4974463E-1,-3.622182E-2,3.4730673E-1,1.1153649E0,1.6931598E-1,-3.0721298E-1,8.626402E-1,5.430516E-2,3.1946912E-1,-3.0338585E-1,7.300153E-2,8.895201E-1,-6.654687E-1,3.3636448E-1,6.0899E-2,-1.3759865E-1,2.0096494E-1,4.60115E-1,-2.5527954E-1,3.034194E-1,-9.2934355E-2,-5.6844015E-2,-2.4099994E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":5,"left_children":[1,3,5,7,9,11,13,15,-1,17,-1,19,21,23,25,-1,-1,27,-1,-1,29,-1,31,33,35,-1,-1,37,39,-1,41,-1,-1,-1,-1,43,45,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[9.280137E2,8.456514E1,2.2170312E2,1.9129332E1,5.1640015E0,3.138379E1,7.96919E1,2.3671565E0,0E0,3.125824E0,0E0,5.1757812E-2,8.41122E0,3.067085E1,2.6717224E0,0E0,0E0,1.5830688E0,0E0,0E0,2.73779E1,0E0,4.1262627E-1,2.1124268E0,5.799618E0,0E0,0E0,1.0140991E0,1.3055248E0,0E0,1.0819511E1,0E0,0E0,0E0,0E0,2.4174356E0,5.242014E-2,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,9,9,11,11,12,12,13,13,14,14,17,17,20,20,22,22,23,23,24,24,27,27,28,28,30,30,35,35,36,36],"right_children":[2,4,6,8,10,12,14,16,-1,18,-1,20,22,24,26,-1,-1,28,-1,-1,30,-1,32,34,36,-1,-1,38,40,-1,42,-1,-1,-1,-1,44,46,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.0198434E-4,1.0256411E-2,7.352941E-3,3.7433155E-2,8.3402835E-4,6.2539085E-4,9.3E2,-2.9722917E-1,6.969697E-2,-1.1706432E-1,1.5E-3,6.1500614E-4,1.6064256E-2,5.1282053E-3,-7.375835E-2,3.0934682E-1,4.152249E-2,-9.427077E-2,-3.0828506E-1,4.2E2,-2.2671053E-1,1.4836795E-3,5.45E2,4.6332046E-2,-3.622182E-2,3.4730673E-1,7.843138E-3,9.803922E-3,-3.0721298E-1,7.575758E-3,5.430516E-2,3.1946912E-1,-3.0338585E-1,7.300153E-2,1.8292682E-2,4.1666668E-2,3.3636448E-1,6.0899E-2,-1.3759865E-1,2.0096494E-1,4.60115E-1,-2.5527954E-1,3.034194E-1,-9.2934355E-2,-5.6844015E-2,-2.4099994E-1],"split_indices":[94,82,77,19,27,64,83,96,0,5,0,82,76,71,71,0,0,17,0,0,96,0,46,96,6,0,0,78,71,0,47,0,0,0,0,27,12,0,0,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[8.697093E3,2.7015674E2,8.426936E3,3.3280518E1,2.3687624E2,8.309606E3,1.1732986E2,7.1033E0,2.6177216E1,2.3498361E2,1.8926244E0,8.297436E3,1.2170545E1,5.5105667E1,6.2224194E1,1.4274094E0,5.6758904E0,2.3382195E2,1.1616697E0,8.090841E3,2.0659465E2,2.939299E0,9.231245E0,3.959204E1,1.5513627E1,1.4946712E0,6.072952E1,2.3164621E2,2.1757276E0,1.993208E2,7.27386E0,1.049435E0,8.18181E0,3.8563507E1,1.0285347E0,1.3395223E1,2.1184042E0,2.2994295E2,1.7032648E0,1.0021776E0,1.1735501E0,5.302307E0,1.9715527E0,1.2301747E1,1.0934759E0,1.0090314E0,1.1093727E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"47","size_leaf_vector":"1"}},{"base_weights":[-9.3716615E-1,8.3827955E-1,-9.959881E-1,-5.7212555E-1,1.0406308E0,-1.0157192E0,3.3338553E-1,6.7112064E-1,-2.9159546E-1,-2.540756E-1,1.0598602E0,-1.0182406E0,4.8897254E-1,-4.88748E-1,1.0655191E0,-7.155841E-2,2.8913763E-1,1.0031329E-1,-1.892284E-1,1.073856E0,-9.80881E-2,-3.0552036E-1,-4.1293466E-1,-2.2923377E-1,9.0174216E-1,-8.461362E-1,8.9854187E-1,-2.9909993E-2,3.3108947E-1,1.0843046E0,2.2039594E-1,-2.243681E-1,1.7656374E-1,-1.7442119E-1,-3.4818235E-3,3.0212113E-1,1.6985796E-2,-9.990142E-1,3.8369504E-1,3.1241465E-1,-3.5745673E-2,3.264536E-1,8.37015E-2,1.9212312E-1,-1.1810608E-1,-3.0461526E-1,-8.4634595E-2,-1.5705262E-1,2.8398684E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":6,"left_children":[1,3,5,7,9,11,13,15,-1,17,19,21,23,25,27,-1,-1,-1,-1,29,31,-1,33,-1,35,37,39,-1,-1,41,43,-1,-1,-1,-1,-1,-1,45,47,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[6.7933887E2,6.0211365E1,1.652998E2,1.4002191E1,4.826172E0,2.4009766E1,5.633705E1,2.1272168E0,0E0,9.8347646E-1,3.0313568E0,1.8066406E-1,6.400918E0,2.2757282E1,2.3023071E0,0E0,0E0,0E0,0E0,1.3526001E0,1.8110412E0,0E0,2.1789104E-1,0E0,7.232442E-1,7.1129646E0,1.5157232E0,0E0,0E0,2.456665E-1,1.132597E0,0E0,0E0,0E0,0E0,0E0,0E0,9.041977E-2,2.8855758E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,9,9,10,10,11,11,12,12,13,13,14,14,19,19,20,20,22,22,24,24,25,25,26,26,29,29,30,30,37,37,38,38],"right_children":[2,4,6,8,10,12,14,16,-1,18,20,22,24,26,28,-1,-1,-1,-1,30,32,-1,34,-1,36,38,40,-1,-1,42,44,-1,-1,-1,-1,-1,-1,46,48,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.0198434E-4,1.0256411E-2,7.352941E-3,1.16E2,8.3402835E-4,6.2539085E-4,1.9305019E-3,-2.9159546E-1,1.0752688E-3,3.539823E-2,1.8154312E-3,3.96E2,2.8910303E-2,5.1282053E-3,-7.155841E-2,2.8913763E-1,1.0031329E-1,-1.892284E-1,1.0948905E-2,1.2096774E-2,-3.0552036E-1,5.076142E-2,-2.2923377E-1,5.0847456E-2,8.223684E-4,3.1486146E-2,-2.9909993E-2,3.3108947E-1,2.631579E-2,3.6319613E-3,-2.243681E-1,1.7656374E-1,-1.7442119E-1,-3.4818235E-3,3.0212113E-1,1.6985796E-2,4.9342103E-3,1.1029412E-2,3.1241465E-1,-3.5745673E-2,3.264536E-1,8.37015E-2,1.9212312E-1,-1.1810608E-1,-3.0461526E-1,-8.4634595E-2,-1.5705262E-1,2.8398684E-1],"split_indices":[94,82,77,19,96,64,83,62,0,59,11,93,96,71,71,0,0,0,0,70,4,0,9,0,7,65,18,0,0,31,3,0,0,0,0,0,0,61,49,0,0,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[6.4959004E3,2.0788785E2,6.2880127E3,2.5854237E1,1.8203362E2,6.196281E3,9.17317E1,6.1266875E0,1.9727549E1,2.4853253E0,1.795483E2,6.186238E3,1.0043104E1,4.3366573E1,4.8365124E1,1.5364043E0,4.590283E0,1.0138382E0,1.471487E0,1.7747581E2,2.0724735E0,6.1839155E3,2.3224933E0,2.2775967E0,7.765507E0,3.479333E1,8.573242E0,1.4806578E0,4.6884464E1,1.750621E2,2.4137068E0,1.0189543E0,1.0535191E0,1.3197796E0,1.0027138E0,6.7345495E0,1.0309576E0,3.1113369E1,3.679962E0,7.497624E0,1.075618E0,1.7387437E2,1.1877272E0,1.4078834E0,1.0058233E0,3.0011711E1,1.1016585E0,1.4359068E0,2.2440553E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"49","size_leaf_vector":"1"}},{"base_weights":[-9.2954445E-1,8.067557E-1,-9.8873055E-1,-4.8438796E-1,1.0183748E0,-1.0089698E0,3.1687495E-1,-2.9620823E-1,7.9291636E-1,-2.2863513E-1,1.0555774E0,-1.011647E0,4.3818578E-1,-4.6062836E-1,1.0135398E0,-9.266202E-4,2.7735817E-1,3.1895068E-1,3.1123333E-2,-1.0146374E0,-8.897055E-1,-1.7951667E-1,2.6618972E-1,-2.9267773E-1,4.4511193E-1,-2.46836E-2,3.1778896E-1,-3.044575E-1,-3.561075E-1,-3.020817E-1,9.535211E-1,7.6632726E-1,-5.362476E-1,-3.1059848E-3,-1.5619993E-1,4.2550004E-1,-2.0309342E-1,2.7899864E-1,-8.195148E-2,-2.2482605E-1,1.0266991E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":7,"left_children":[1,3,5,7,9,11,13,-1,15,-1,17,19,21,23,25,-1,-1,-1,-1,27,29,-1,-1,-1,31,-1,-1,-1,33,-1,35,37,39,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[4.990249E2,4.4310364E1,1.2421924E2,1.57265835E1,9.952484E0,1.8333496E1,3.9649025E1,0E0,7.494254E-1,0E0,8.7023926E-1,7.7734375E-1,4.8251686E0,1.669975E1,2.0158157E0,0E0,0E0,0E0,0E0,2.9248047E-1,2.655568E1,0E0,0E0,0E0,4.612005E0,0E0,0E0,0E0,1.6794458E-1,0E0,6.7176094E0,2.0323286E0,4.9685454E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,8,8,10,10,11,11,12,12,13,13,14,14,19,19,20,20,24,24,28,28,30,30,31,31,32,32],"right_children":[2,4,6,8,10,12,14,-1,16,-1,18,20,22,24,26,-1,-1,-1,-1,28,30,-1,-1,-1,32,-1,-1,-1,34,-1,36,38,40,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.049774E-4,1.0256411E-2,7.9631455E-2,6.455778E-4,8.3402835E-4,6.2539085E-4,-2.9620823E-1,3.8610038E-3,-2.2863513E-1,1.3888889E-2,1.5E-3,6.2539085E-4,1.2048192E-2,5.1282053E-3,-9.266202E-4,2.7735817E-1,3.1895068E-1,3.1123333E-2,1.8154312E-3,4.2E2,-1.7951667E-1,2.6618972E-1,-2.9267773E-1,3.723404E-2,-2.46836E-2,3.1778896E-1,-3.044575E-1,7.025761E-3,-3.020817E-1,7.575758E-3,1.8248174E-2,1.0830325E-2,-3.1059848E-3,-1.5619993E-1,4.2550004E-1,-2.0309342E-1,2.7899864E-1,-8.195148E-2,-2.2482605E-1,1.0266991E-2],"split_indices":[94,77,77,64,71,64,83,0,37,0,70,82,83,71,71,0,0,0,0,93,96,0,0,0,6,0,0,0,59,0,47,31,49,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[4.84722E3,1.5936661E2,4.6878535E3,2.2260494E1,1.3710612E2,4.6165166E3,7.13373E1,1.6134212E1,6.126282E0,2.4073362E0,1.3469879E2,4.608292E3,8.224178E0,3.3872814E1,3.746449E1,1.0077523E0,5.11853E0,1.3351694E2,1.181852E0,4.490843E3,1.17449646E2,2.3856366E0,5.838542E0,2.1545736E1,1.2327077E1,1.4696642E0,3.5994823E1,4.488796E3,2.0464747E0,1.1085285E2,6.5967927E0,9.452299E0,2.8747783E0,1.0026742E0,1.0438005E0,5.2346535E0,1.3621389E0,8.257504E0,1.1947948E0,1.8644041E0,1.0103742E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"41","size_leaf_vector":"1"}},{"base_weights":[-9.23909E-1,7.807254E-1,-9.834477E-1,-4.5061603E-1,9.901179E-1,-1.0043343E0,2.9496828E-1,7.1488595E-1,-2.920949E-1,-2.1186157E-1,1.0294226E0,-1.0072453E0,3.8405174E-1,-4.3764403E-1,9.6459615E-1,-2.0870376E-2,2.6279563E-1,1.0404038E0,9.704606E-3,-1.0105263E0,-8.736631E-1,7.6857424E-1,-2.0745942E-1,-7.847849E-1,7.5020087E-1,-2.7246252E-2,3.102936E-1,3.1365743E-1,8.1164554E-2,-3.0324662E-1,-9.6331686E-2,-2.997581E-1,7.950819E-1,2.8121304E-2,2.6995227E-1,-9.1489244E-1,2.0383541E-1,2.781866E-1,-4.0950626E-2,3.6619824E-1,-1.9508855E-1,-2.9517537E-1,-1.6455622E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":8,"left_children":[1,3,5,7,9,11,13,15,-1,-1,17,19,21,23,25,-1,-1,27,-1,29,31,33,-1,35,37,-1,-1,-1,-1,-1,-1,-1,39,-1,-1,41,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[3.6738574E2,3.2022537E1,9.350806E1,1.1965301E1,7.726471E0,1.4268799E1,2.8330612E1,8.574698E-1,0E0,0E0,1.094223E0,6.196289E-1,3.803286E0,1.2074638E1,2.303833E0,0E0,0E0,1.1869049E-1,0E0,3.5668945E-1,1.9555908E1,4.738233E-1,0E0,4.8211975E0,1.1960192E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,4.99067E0,0E0,0E0,1.173172E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,10,10,11,11,12,12,13,13,14,14,17,17,19,19,20,20,21,21,23,23,24,24,32,32,35,35],"right_children":[2,4,6,8,10,12,14,16,-1,-1,18,20,22,24,26,-1,-1,28,-1,30,32,34,-1,36,38,-1,-1,-1,-1,-1,-1,-1,40,-1,-1,42,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.049774E-4,1.0256411E-2,2.4725275E-2,6.455778E-4,8.3402835E-4,6.2539085E-4,4.830918E-3,-2.920949E-1,-2.1186157E-1,4.1353382E-2,1.5E-3,4.400978E-2,2.8910303E-2,1.3297872E-3,-2.0870376E-2,2.6279563E-1,1.0989011E-2,9.704606E-3,1.8154312E-3,6.2539085E-4,9.940357E-4,-2.0745942E-1,1.0989011E-2,2.8368793E-2,-2.7246252E-2,3.102936E-1,3.1365743E-1,8.1164554E-2,-3.0324662E-1,-9.6331686E-2,-2.997581E-1,7.575758E-3,2.8121304E-2,2.6995227E-1,8.223684E-4,2.0383541E-1,2.781866E-1,-4.0950626E-2,3.6619824E-1,-1.9508855E-1,-2.9517537E-1,-1.6455622E-2],"split_indices":[94,77,77,1,71,64,83,60,0,0,13,82,10,71,82,0,0,69,0,93,83,23,0,61,18,0,0,0,0,0,0,0,47,0,0,65,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[3.6112974E3,1.21468025E2,3.4898293E3,1.748641E1,1.0398161E2,3.4339402E3,5.588898E1,5.3028946E0,1.2183516E1,1.9705086E0,1.0201111E2,3.4270295E3,6.9107947E0,2.6854746E1,2.9034235E1,1.0002874E0,4.302607E0,1.0085687E2,1.154237E0,3.3384668E3,8.8562775E1,5.301084E0,1.6097103E0,2.104406E1,5.810686E0,1.7802703E0,2.7253965E1,9.983471E1,1.0221593E0,3.336569E3,1.8974844E0,8.273993E1,5.822841E0,1.1423596E0,4.158725E0,1.9671303E1,1.3727568E0,4.805238E0,1.0054482E0,4.61845E0,1.2043908E0,1.8076479E1,1.5948247E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"43","size_leaf_vector":"1"}},{"base_weights":[-9.188568E-1,7.567064E-1,-9.7884107E-1,-2.2970885E-1,1.0157768E0,-1.0006653E0,2.8162193E-1,-7.504611E-1,7.419925E-1,3.0818146E-1,9.4012514E-2,-1.0038565E0,3.382485E-1,-8.4397167E-1,6.808463E-1,-9.5806235E-1,1.768619E-1,2.6694566E-1,-8.392828E-3,-1.0074106E0,-8.5872906E-1,-1.6894506E-1,2.3062871E-1,-2.9342198E-1,8.112801E-2,-2.441316E-1,9.004249E-1,-8.277031E-2,-2.9861534E-1,-3.0234247E-1,-8.310376E-2,-2.9786196E-1,6.724712E-1,1.5119265E-1,3.0570042E-1,-1.19673654E-1,3.0509153E-1,1.8948914E-1,-1.5796404E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":9,"left_children":[1,3,5,7,9,11,13,15,17,-1,-1,19,21,23,25,27,-1,-1,-1,29,31,-1,-1,-1,-1,-1,33,-1,-1,-1,-1,-1,35,37,-1,-1,-1,-1,-1],"loss_changes":[2.7108057E2,2.4134415E1,7.172803E1,1.0813782E1,2.776184E-1,1.1249023E1,2.0789043E1,4.374428E0,8.871527E-1,0E0,0E0,4.4873047E-1,3.0791514E0,2.09132E0,1.1812387E1,3.6958694E-2,0E0,0E0,0E0,4.4140625E-1,1.4567131E1,0E0,0E0,0E0,0E0,0E0,2.5032253E0,0E0,0E0,0E0,0E0,0E0,2.637588E0,2.0456781E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,11,11,12,12,13,13,14,14,15,15,19,19,20,20,26,26,32,32,33,33],"right_children":[2,4,6,8,10,12,14,16,18,-1,-1,20,22,24,26,28,-1,-1,-1,30,32,-1,-1,-1,-1,-1,34,-1,-1,-1,-1,-1,36,38,-1,-1,-1,-1,-1],"split_conditions":[6.666667E-1,6.2539085E-4,1.0256411E-2,1.0989011E-3,4.3165468E-2,8.3402835E-4,1.0989011E-3,2.1276595E-2,1.7964073E-2,3.0818146E-1,9.4012514E-2,1.5E-3,6.1500614E-4,3.6363635E-2,1.8181818E-3,9.302326E-3,1.768619E-1,2.6694566E-1,-8.392828E-3,1.8154312E-3,4.2E2,-1.6894506E-1,2.3062871E-1,-2.9342198E-1,8.112801E-2,-2.441316E-1,1.1029412E-2,-8.277031E-2,-2.9861534E-1,-3.0234247E-1,-8.310376E-2,-2.9786196E-1,3.4013607E-2,5.586592E-3,3.0570042E-1,-1.19673654E-1,3.0509153E-1,1.8948914E-1,-1.5796404E-1],"split_indices":[94,83,77,66,5,64,43,71,19,0,0,82,76,82,71,22,0,0,0,93,96,0,0,0,0,0,49,0,0,0,0,0,9,45,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[2.6887524E3,9.2527626E1,2.5962249E3,1.9270014E1,7.325761E1,2.5522402E3,4.3984497E1,1.269449E1,6.5755234E0,7.1622986E1,1.6346254E0,2.5464214E3,5.8190265E0,1.1224248E1,3.276025E1,1.1238398E1,1.4560935E0,5.385839E0,1.1896844E0,2.4797517E3,6.6669685E1,1.7812996E0,4.037727E0,1.0127841E1,1.0964072E0,3.8497663E0,2.8910484E1,1.018318E0,1.0220079E1,2.478023E3,1.7286336E0,6.1622673E1,5.047015E0,4.2611613E0,2.4649323E1,1.1895663E0,3.8574488E0,2.5333483E0,1.7278131E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"39","size_leaf_vector":"1"}},{"base_weights":[-9.1407293E-1,7.334825E-1,-9.74848E-1,-4.2251205E-1,9.45167E-1,-9.974937E-1,2.582072E-1,-2.6775464E-1,1.9555135E-1,-1.806439E-1,9.897918E-1,-1.0010424E0,2.8980637E-1,-3.8658905E-1,8.836358E-1,3.0309114E-1,2.103597E-2,-1.0015585E0,-7.768728E-2,-1.8055657E-1,6.676238E-1,-2.7423596E-1,2.9859284E-1,-2.5579743E-2,2.9109854E-1,-3.0165744E-1,-8.397675E-1,2.3699768E-1,3.3142984E-2,2.4915454E-1,-1.7331485E-1,-2.9544252E-1,1.8115728E-1,-1.8445858E-1,1.2845139E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":10,"left_children":[1,3,5,7,9,11,13,-1,-1,-1,15,17,19,21,23,-1,-1,25,-1,-1,27,-1,29,-1,-1,-1,31,-1,-1,-1,33,-1,-1,-1,-1],"loss_changes":[2.01245E2,1.7973602E1,5.420227E1,6.543584E0,4.808716E0,8.956909E0,1.471207E1,0E0,0E0,0E0,1.0549545E0,4.6557617E-1,2.42013E0,6.8663263E0,1.6277075E0,0E0,0E0,3.6865234E-1,0E0,0E0,2.3194075E-1,0E0,2.3249698E0,0E0,0E0,0E0,1.1336876E1,0E0,0E0,0E0,1.7057726E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,10,10,11,11,12,12,13,13,14,14,17,17,20,20,22,22,26,26,30,30],"right_children":[2,4,6,8,10,12,14,-1,-1,-1,16,18,20,22,24,-1,-1,26,-1,-1,28,-1,30,-1,-1,-1,32,-1,-1,-1,34,-1,-1,-1,-1],"split_conditions":[6.666667E-1,9.049774E-4,1.0256411E-2,7.9631455E-2,6.455778E-4,8.3402835E-4,6.2539085E-4,-2.6775464E-1,1.9555135E-1,-1.806439E-1,1.0948905E-2,1.8154312E-3,3.96E2,1.2048192E-2,1.3297872E-3,3.0309114E-1,2.103597E-2,1.5E-3,-7.768728E-2,-1.8055657E-1,3.2258064E-2,-2.7423596E-1,6.6225166E-3,-2.5579743E-2,2.9109854E-1,-3.0165744E-1,6.2539085E-4,2.3699768E-1,3.3142984E-2,2.4915454E-1,4.032258E-3,-2.9544252E-1,1.8115728E-1,-1.8445858E-1,1.2845139E-1],"split_indices":[94,77,77,64,71,64,83,0,0,0,70,93,96,71,82,0,0,82,0,0,10,0,24,0,0,0,83,0,0,0,61,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[2.0016929E3,7.081779E1,1.9308751E3,1.0806777E1,6.001101E1,1.8962406E3,3.463449E1,7.6356196E0,3.1711571E0,1.3319979E0,5.8679012E1,1.8912495E3,4.991111E0,1.7241234E1,1.739326E1,5.730242E1,1.3765899E0,1.8895853E3,1.6641977E0,1.3089548E0,3.6821556E0,9.552504E0,7.68873E0,1.4298052E0,1.5963454E1,1.8392817E3,5.030362E1,2.6764028E0,1.0057528E0,3.257288E0,4.431442E0,4.599984E1,4.303777E0,2.5426564E0,1.8887852E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"35","size_leaf_vector":"1"}},{"base_weights":[-9.08881E-1,-9.987504E-1,2.2909212E-1,-1.0003965E0,1.6922937E-1,-7.073726E-1,9.6998817E-1,-1.001899E0,6.558569E-2,7.1370757E-1,-9.248535E-1,-7.197323E-2,1.0091507E0,-1.0026118E0,-6.5417916E-2,2.5529504E-1,-1.570075E-2,-9.801799E-1,9.6868806E-2,9.174994E-2,3.056808E-1,-3.3697662E-1,-3.010075E-1,-2.9806378E-1,-6.668875E-2,1.1282794E-2,-1.614337E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":11,"left_children":[1,3,5,7,-1,9,11,13,-1,15,17,-1,19,21,-1,-1,-1,23,-1,-1,-1,25,-1,-1,-1,-1,-1],"loss_changes":[1.5281812E2,4.1223145E0,7.70207E1,2.750122E0,0E0,1.585787E1,3.1725197E0,5.526123E-1,0E0,7.902441E-1,3.2906914E0,0E0,1.0198593E-1,3.470459E-1,0E0,0E0,0E0,1.9954681E-1,0E0,0E0,0E0,2.5006932E-1,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,5,5,6,6,7,7,9,9,10,10,12,12,13,13,17,17,21,21],"right_children":[2,4,6,8,-1,10,12,14,-1,16,18,-1,20,22,-1,-1,-1,24,-1,-1,-1,26,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,2.5411913E-1,6.2539085E-4,2.8910303E-2,1.6922937E-1,1.9950125E-2,6.455778E-4,1.8921476E-3,6.558569E-2,2.5062656E-2,2.1276595E-2,-7.197323E-2,9.049774E-4,5.4945056E-3,-6.5417916E-2,2.5529504E-1,-1.570075E-2,2.3923444E-3,9.6868806E-2,9.174994E-2,3.056808E-1,3.7171353E-2,-3.010075E-1,-2.9806378E-1,-6.668875E-2,1.1282794E-2,-1.614337E-1],"split_indices":[82,64,83,71,0,17,71,93,0,22,71,0,77,12,0,0,0,84,0,0,0,9,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.4910406E3,1.3820205E3,1.0902021E2,1.3809258E3,1.0946156E0,4.817459E1,6.084562E1,1.3794037E3,1.5221266E0,6.091215E0,4.2083374E1,1.7470126E0,5.909861E1,1.3778717E3,1.5320016E0,5.0715127E0,1.0197024E0,4.0501923E1,1.5814527E0,1.2535553E0,5.7845055E1,2.0504823E0,1.3758213E3,3.9494453E1,1.0074712E0,1.0003994E0,1.050083E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"27","size_leaf_vector":"1"}},{"base_weights":[-9.0400517E-1,-9.957454E-1,2.228839E-1,-9.988771E-1,7.975247E-2,-6.7642725E-1,9.4337356E-1,-1.0008464E0,1.9105833E-2,-1.7881721E-1,2.008758E-1,5.838719E-1,-9.131427E-1,-5.8652077E-2,9.909119E-1,-3.0054277E-1,-5.6007862E-2,2.2838846E-1,-2.5722263E-2,-2.9252324E-1,9.335907E-2,7.862288E-2,3.0141646E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":12,"left_children":[1,3,5,7,9,11,13,15,-1,-1,-1,17,19,-1,21,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[1.15086365E2,3.5407715E0,5.5363937E1,2.2078857E0,1.957551E0,1.1914717E1,2.7551193E0,6.1486816E-1,0E0,0E0,0E0,8.54439E-1,2.7684994E0,0E0,1.9543839E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,11,11,12,12,14,14],"right_children":[2,4,6,8,10,12,14,16,-1,-1,-1,18,20,-1,22,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,8.3402835E-4,6.2539085E-4,2.5720164E-2,8E2,2.1052632E-2,6.455778E-4,1.8921476E-3,1.9105833E-2,-1.7881721E-1,2.008758E-1,7.633588E-3,2.1276595E-2,-5.8652077E-2,9.049774E-4,-3.0054277E-1,-5.6007862E-2,2.2838846E-1,-2.5722263E-2,-2.9252324E-1,9.335907E-2,7.862288E-2,3.0141646E-1],"split_indices":[82,64,83,71,96,17,71,93,0,0,0,3,71,0,77,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.110077E3,1.0266163E3,8.346066E1,1.02370667E3,2.909633E0,3.715062E1,4.631004E1,1.0218709E3,1.8358021E0,1.351072E0,1.558561E0,5.6425424E0,3.1508078E1,1.7308694E0,4.457917E1,1.02043353E3,1.4373481E0,4.3523974E0,1.2901448E0,3.0184736E1,1.3233423E0,1.2004435E0,4.3378727E1],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"23","size_leaf_vector":"1"}},{"base_weights":[-8.9833415E-1,-9.926499E-1,2.163867E-1,-9.961843E-1,7.095678E-2,-6.370048E-1,9.137908E-1,-9.9877626E-1,2.7830588E-2,-1.650481E-1,1.842008E-1,5.8859944E-1,-8.665001E-1,-4.771286E-2,9.715841E-1,-1.0000721E0,-4.7867365E-2,2.281164E-1,-9.42659E-3,-9.458397E-1,7.444013E-2,6.721287E-2,2.9722846E-1,-9.5648944E-2,-3.0025452E-1,-2.9151624E-1,-5.375046E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":13,"left_children":[1,3,5,7,9,11,13,15,-1,-1,-1,17,19,-1,21,23,-1,-1,-1,25,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[8.72832E1,2.9417114E0,3.9519993E1,2.241455E0,1.5058553E0,8.951248E0,2.412243E0,6.665039E-1,0E0,0E0,0E0,5.9147465E-1,2.5059013E0,0E0,2.7537537E-1,8.178711E-2,0E0,0E0,0E0,3.057537E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,11,11,12,12,14,14,15,15,19,19],"right_children":[2,4,6,8,10,12,14,16,-1,-1,-1,18,20,-1,22,24,-1,-1,-1,26,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,8.3402835E-4,6.2539085E-4,2.5477707E-2,8E2,1.847575E-2,6.455778E-4,1.8921476E-3,2.7830588E-2,-1.650481E-1,1.842008E-1,2.5929127E-2,2.1276595E-2,-4.771286E-2,9.049774E-4,5.4945056E-3,-4.7867365E-2,2.281164E-1,-9.42659E-3,1.0695187E-2,7.444013E-2,6.721287E-2,2.9722846E-1,-9.5648944E-2,-3.0025452E-1,-2.9151624E-1,-5.375046E-2],"split_indices":[82,64,83,77,96,17,71,93,0,0,0,26,71,0,77,12,0,0,0,62,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[8.271527E2,7.6272833E2,6.44244E1,7.602653E2,2.4630082E0,2.9011074E1,3.541333E1,7.585426E2,1.7227118E0,1.1428057E0,1.3202026E0,4.3287764E0,2.4682297E1,1.7206395E0,3.369269E1,7.571817E2,1.3608594E0,3.212346E0,1.1164303E0,2.3183527E1,1.498769E0,1.1599537E0,3.2532738E1,1.3303864E0,7.558513E2,2.2167742E1,1.0157856E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"27","size_leaf_vector":"1"}},{"base_weights":[-8.9166254E-1,-9.891836E-1,2.0838645E-1,-9.944877E-1,-4.941942E-2,-5.9453136E-1,8.7994087E-1,-9.975184E-1,-1.199668E-2,1.617033E-1,-1.8011363E-1,3.2976127E-1,-9.0920466E-1,-3.876761E-2,9.499706E-1,-9.992676E-1,-4.085704E-2,6.087449E-1,-7.550657E-2,-2.8336766E-1,-6.2461592E-2,5.735864E-2,2.92843E-1,-3.0003166E-1,-8.080005E-2,2.183583E-1,2.693151E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":14,"left_children":[1,3,5,7,9,11,13,15,-1,-1,-1,17,19,-1,21,23,-1,25,-1,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[6.6519806E1,2.7820435E0,2.8110567E1,1.593811E0,1.6982409E0,7.250943E0,2.120222E0,7.1203613E-1,0E0,0E0,0E0,1.2568936E0,2.5180435E-1,0E0,3.4061813E-1,7.4157715E-2,0E0,2.369659E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,11,11,12,12,14,14,15,15,17,17],"right_children":[2,4,6,8,10,12,14,16,-1,-1,-1,18,20,-1,22,24,-1,26,-1,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,1.6064256E-2,6.2539085E-4,8.3402835E-4,2.2058824E-2,3.2608695E-2,6.455778E-4,1.8921476E-3,-1.199668E-2,1.617033E-1,-1.8011363E-1,9.689922E-3,1.5873017E-2,-3.876761E-2,9.049774E-4,5.882353E-2,-4.085704E-2,2.5316456E-2,-7.550657E-2,-2.8336766E-1,-6.2461592E-2,5.735864E-2,2.92843E-1,-3.0003166E-1,-8.080005E-2,2.183583E-1,2.693151E-2],"split_indices":[82,71,83,64,12,6,71,93,0,0,0,32,77,0,77,60,0,17,0,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[6.1714813E2,5.669848E2,5.0163315E1,5.6374475E2,3.2400517E0,2.2899324E1,2.7263988E1,5.619155E2,1.8292342E0,1.5772347E0,1.662817E0,5.803806E0,1.7095518E1,1.7143271E0,2.5549662E1,5.606169E2,1.2986487E0,3.8902793E0,1.9135264E0,1.5943955E1,1.1515632E0,1.1288278E0,2.4420835E1,5.596044E2,1.012504E0,2.836693E0,1.0535862E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"27","size_leaf_vector":"1"}},{"base_weights":[-8.831031E-1,-9.8484784E-1,1.966547E-1,-9.9059045E-1,4.6194464E-2,-5.465134E-1,8.4076744E-1,-9.954824E-1,8.234245E-3,1.672199E-1,-1.373927E-1,-7.6741785E-1,1.937944E-1,9.177866E-1,-5.5995725E-2,-9.97833E-1,-3.362981E-2,1.3001038E-1,-2.836862E-1,2.8650638E-1,4.1429386E-2,-2.9971027E-1,-9.146786E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":15,"left_children":[1,3,5,7,9,11,13,15,-1,-1,-1,17,-1,19,-1,21,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[5.1014954E1,2.5498962E0,1.9927746E1,2.1221924E0,1.1052842E0,5.629741E0,1.9265194E0,7.574463E-1,0E0,0E0,0E0,4.0261745E0,0E0,4.7206497E-1,0E0,4.2816162E-2,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,11,11,13,13,15,15],"right_children":[2,4,6,8,10,12,14,16,-1,-1,-1,18,-1,20,-1,22,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,1.724138E-2,6.2539085E-4,8.3402835E-4,2.2058824E-2,2.8910303E-2,2.2222223E-2,1.8921476E-3,8.234245E-3,1.672199E-1,-1.373927E-1,4.9477736E-3,1.937944E-1,1.3840831E-2,-5.5995725E-2,4.587156E-2,-3.362981E-2,1.3001038E-1,-2.836862E-1,2.8650638E-1,4.1429386E-2,-2.9971027E-1,-9.146786E-2],"split_indices":[82,77,83,64,12,71,52,93,0,0,0,82,0,30,0,53,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[4.616016E2,4.2193124E2,3.9670364E1,4.1963324E2,2.2980034E0,1.8489252E1,2.118111E1,4.1764847E2,1.9847643E0,1.0886172E0,1.2093862E0,1.5900258E1,2.5889935E0,1.9803291E1,1.3778201E0,4.1641086E2,1.2375994E0,1.869707E0,1.4030551E1,1.8686049E1,1.1172428E0,4.1524933E2,1.1615233E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"23","size_leaf_vector":"1"}},{"base_weights":[-8.732621E-1,5.6702304E-1,-9.5142496E-1,7.413212E-1,-1.4879782E-1,-9.8371524E-1,1.7839307E-1,8.6073285E-1,-6.9448136E-2,-9.893193E-1,1.09132975E-2,-1.9032861E-1,5.2036786E-1,1.6792985E-2,2.7517006E-1,-2.977279E-1,-1.9636732E-2,-5.9885494E-2,6.6705036E-1,-1.2512448E-2,2.4602666E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":16,"left_children":[1,3,5,7,-1,9,11,13,-1,15,-1,-1,17,-1,-1,-1,-1,-1,19,-1,-1],"loss_changes":[3.956131E1,3.7896967E0,1.2183716E1,2.089075E0,0E0,1.866272E0,3.107656E0,6.171322E-1,0E0,8.491516E-1,0E0,0E0,9.339552E-1,0E0,0E0,0E0,0E0,0E0,7.424562E-1,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,5,5,6,6,7,7,9,9,12,12,18,18],"right_children":[2,4,6,8,-1,10,12,14,-1,16,-1,-1,18,-1,-1,-1,-1,-1,20,-1,-1],"split_conditions":[6.730769E-1,4.109589E-2,1.0256411E-2,2.425876E-2,-1.4879782E-1,8.3402835E-4,1.0989011E-3,1.49E2,-6.9448136E-2,1.25E-1,1.09132975E-2,-1.9032861E-1,6.756757E-3,1.6792985E-2,2.7517006E-1,-2.977279E-1,-1.9636732E-2,-5.9885494E-2,1.1029412E-2,-1.2512448E-2,2.4602666E-1],"split_indices":[94,5,77,18,0,64,43,96,0,9,0,0,71,0,0,0,0,0,49,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[3.4562375E2,1.7469213E1,3.2815454E2,1.52683525E1,2.2008615E0,3.191622E2,8.992352E0,1.3701701E1,1.5666507E0,3.174484E2,1.7138044E0,2.4096918E0,6.5826597E0,1.0294633E0,1.2672238E1,3.163104E2,1.1379807E0,1.0530266E0,5.529633E0,1.1111398E0,4.4184933E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"21","size_leaf_vector":"1"}},{"base_weights":[-8.5738015E-1,-9.755574E-1,2.1935949E-1,-9.841646E-1,-1.9768523E-2,-4.635223E-1,7.900584E-1,-9.918293E-1,-1.4167778E-1,1.2200134E-1,-1.3554311E-1,2.6894873E-1,-8.276121E-1,-5.3349502E-2,8.910194E-1,-4.5268975E-2,-2.9888883E-1,1.2150795E-1,-1.6820265E-1,1.7338854E-1,-4.428365E-2,-2.6186788E-1,-7.391332E-2,2.8002378E-1,5.421402E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":17,"left_children":[1,3,5,7,9,11,13,15,17,-1,-1,19,21,-1,23,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[3.349829E1,1.9211273E0,1.0766313E1,1.3689575E0,7.5963473E-1,3.6306155E0,1.615138E0,7.191925E-1,9.770972E-1,0E0,0E0,7.2864544E-1,1.6054153E-2,0E0,2.4281025E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,11,11,12,12,14,14],"right_children":[2,4,6,8,10,12,14,16,18,-1,-1,20,22,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,1.6064256E-2,6.2539085E-4,1.25E-1,2.3529412E-2,3.2967035E-2,6.455778E-4,6.666667E-1,3.6764707E-2,1.2200134E-1,-1.3554311E-1,1.9950125E-2,1.5873017E-2,-5.3349502E-2,1.3245033E-2,-4.5268975E-2,-2.9888883E-1,1.2150795E-1,-1.6820265E-1,1.7338854E-1,-4.428365E-2,-2.6186788E-1,-7.391332E-2,2.8002378E-1,5.421402E-2],"split_indices":[82,71,83,9,11,6,71,94,12,0,0,17,71,0,30,0,0,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[2.6057425E2,2.3488815E2,2.5686098E1,2.3276236E2,2.1257992E0,1.1779222E1,1.3906877E1,2.3048819E2,2.2741773E0,1.0993887E0,1.0264106E0,3.9978046E0,7.7814174E0,1.2416894E0,1.2665187E1,1.401582E0,2.2908661E2,1.001185E0,1.2729923E0,2.0727427E0,1.9250618E0,6.7534976E0,1.0279195E0,1.1655454E1,1.0097328E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"25","size_leaf_vector":"1"}},{"base_weights":[-8.424311E-1,-9.6771485E-1,1.992059E-1,-2.8390807E-1,-9.8588663E-1,-4.1488367E-1,7.394092E-1,-2.2192805E-1,2.719834E-1,-2.9784563E-1,-1.4367557E-2,-6.708986E-1,1.6453421E-1,-4.473539E-2,8.539586E-1,9.447457E-2,-2.6331496E-1,2.7234292E-1,4.8889574E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":18,"left_children":[1,3,5,7,9,11,13,-1,-1,-1,-1,15,-1,-1,17,-1,-1,-1,-1],"loss_changes":[2.5967987E1,1.9129944E0,7.6163754E0,3.9121192E0,1.0676117E0,3.0691743E0,1.3570433E0,0E0,0E0,0E0,0E0,2.1323233E0,0E0,0E0,2.558279E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,11,11,14,14],"right_children":[2,4,6,8,10,12,14,-1,-1,-1,-1,16,-1,-1,18,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,6.770428E-1,6.2539085E-4,9.3E2,1.724138E-2,2.8910303E-2,6.455778E-4,-2.2192805E-1,2.719834E-1,-2.9784563E-1,-1.4367557E-2,4.9477736E-3,1.6453421E-1,-4.473539E-2,1.3157895E-2,9.447457E-2,-2.6331496E-1,2.7234292E-1,4.8889574E-2],"split_indices":[82,94,83,96,77,71,71,0,0,0,0,82,0,0,30,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.9651103E2,1.7547644E2,2.1034594E1,4.9728036E0,1.7050365E2,9.952654E0,1.1081941E1,3.8697093E0,1.1030945E0,1.691948E2,1.3088505E0,8.102813E0,1.8498405E0,1.2310735E0,9.850867E0,1.3144957E0,6.7883177E0,8.847575E0,1.003292E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"19","size_leaf_vector":"1"}},{"base_weights":[-8.253476E-1,-9.586496E-1,1.9041257E-1,-9.7272664E-1,8.530065E-3,6.1385494E-1,-5.0353754E-1,-9.857094E-1,-1.8737405E-3,7.9542226E-1,-2.1827433E-2,-7.10251E-1,6.521672E-2,-3.965684E-2,-2.9765743E-1,2.563253E-1,4.8425548E-2,-1.1791352E-1,1.1153847E-1,-2.4166697E-1,-5.70141E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":19,"left_children":[1,3,5,7,-1,9,11,13,-1,15,17,19,-1,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[2.0394325E1,1.8634949E0,5.6427855E0,1.6287003E0,0E0,1.3704581E0,1.2613395E0,5.800705E-1,0E0,2.0415115E-1,6.6892546E-1,1.4472318E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,5,5,6,6,7,7,9,9,10,10,11,11],"right_children":[2,4,6,8,-1,10,12,14,-1,16,18,20,-1,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,1.6064256E-2,3.1578947E-2,1.25E-1,8.530065E-3,3.076923E-2,1.5873017E-2,6.666667E-1,-1.8737405E-3,1.4245015E-2,6.2539085E-4,1.3197587E-3,6.521672E-2,-3.965684E-2,-2.9765743E-1,2.563253E-1,4.8425548E-2,-1.1791352E-1,1.1153847E-1,-2.4166697E-1,-5.70141E-2],"split_indices":[82,71,12,9,0,17,77,94,0,31,83,74,0,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.4827151E2,1.3112033E2,1.7151182E1,1.2929103E2,1.8293113E0,1.0723321E1,6.42786E0,1.2755764E2,1.7333854E0,8.145474E0,2.5778468E0,5.0069966E0,1.4208633E0,1.1226579E0,1.2643498E2,7.133988E0,1.0114866E0,1.3274349E0,1.2504117E0,3.768109E0,1.2388875E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"21","size_leaf_vector":"1"}},{"base_weights":[-8.009705E-1,2.3828216E-1,-9.3569404E-1,7.877079E-1,-3.707608E-1,-9.780338E-1,9.476748E-2,1.133779E-1,3.0225772E-1,-2.4418543E-1,2.859149E-1,-9.8320395E-1,-8.590645E-2,-1.2822017E-1,1.6016793E-1,7.5442605E-2,-2.4468826E-2,-4.4859756E-2,1.7387411E-1,-2.9627365E-1,-8.5810326E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":20,"left_children":[1,3,5,7,9,11,13,15,-1,-1,17,19,-1,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[1.6213837E1,4.9445596E0,4.51268E0,1.0167103E0,2.3497047E0,6.674957E-2,1.3540152E0,1.013401E-1,0E0,0E0,5.561137E-1,1.1138916E-2,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,10,10,11,11],"right_children":[2,4,6,8,10,12,14,16,-1,-1,18,20,-1,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[7.0430106E-1,1.8867925E-2,8.928572E-3,1.0989011E-3,9.0198434E-4,5.7803467E-3,3.22E2,2.8169013E-3,3.0225772E-1,-2.4418543E-1,1.5873017E-2,8.064516E-3,-8.590645E-2,-1.2822017E-1,1.6016793E-1,7.5442605E-2,-2.4468826E-2,-4.4859756E-2,1.7387411E-1,-2.9627365E-1,-8.5810326E-2],"split_indices":[94,19,77,66,82,72,96,0,0,0,71,77,0,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.1321102E2,1.2903695E1,1.0030733E2,6.6296477E0,6.274047E0,9.6397415E1,3.9099085E0,2.0024767E0,4.627171E0,3.6029274E0,2.6711197E0,9.526386E1,1.1335562E0,1.7982707E0,2.1116378E0,1.0023762E0,1.0001005E0,1.273532E0,1.3975877E0,9.425583E1,1.0080272E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"21","size_leaf_vector":"1"}},{"base_weights":[-7.747125E-1,-9.339352E-1,1.7459992E-1,-1.1143348E-1,-9.6584433E-1,-3.6213535E-1,6.53812E-1,2.0536894E-1,-1.9524567E-1,-2.9443905E-1,-1.3795276E-3,-5.914361E-1,1.1862639E-1,-6.6663967E-3,2.4276412E-1,-2.383913E-1,5.621071E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":21,"left_children":[1,3,5,7,9,11,13,-1,-1,-1,-1,15,-1,-1,-1,-1,-1],"loss_changes":[1.3402966E1,1.8652115E0,3.6895077E0,2.1361854E0,1.0799637E0,1.4455557E0,8.004849E-1,0E0,0E0,0E0,0E0,1.0596983E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,11,11],"right_children":[2,4,6,8,10,12,14,-1,-1,-1,-1,16,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,6.770428E-1,6.2539085E-4,1.4778325E-2,1.724138E-2,2.8910303E-2,6.1500614E-4,2.0536894E-1,-1.9524567E-1,-2.9443905E-1,-1.3795276E-3,4.03E2,1.1862639E-1,-6.6663967E-3,2.4276412E-1,-2.383913E-1,5.621071E-2],"split_indices":[82,94,83,19,77,71,76,0,0,0,0,96,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[8.659323E1,7.416942E1,1.2423812E1,2.937727E0,7.12317E1,5.9754252E0,6.4483867E0,1.0778857E0,1.8598411E0,7.0072075E1,1.1596184E0,4.7553415E0,1.2200838E0,1.3654352E0,5.0829515E0,3.7552207E0,1.0001208E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"17","size_leaf_vector":"1"}},{"base_weights":[-7.459213E-1,2.3763952E-1,-9.0469795E-1,-2.739656E-1,8.2163817E-1,-9.6232027E-1,7.4554525E-2,-1.9239828E-1,2.8258023E-1,2.9712912E-1,2.2940338E-2,-2.9436734E-1,-4.6583247E-1,-1.06921315E-1,1.3325705E-1,-1.7645787E-2,1.4217122E-1,1.4460272E-2,-1.991156E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":22,"left_children":[1,3,5,7,9,11,13,-1,15,-1,-1,-1,17,-1,-1,-1,-1,-1,-1],"loss_changes":[1.0755344E1,3.264614E0,3.3626213E0,1.4432462E0,5.532286E-1,6.0554504E-2,8.224527E-1,0E0,2.3352778E-1,0E0,0E0,0E0,4.3142378E-1,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6,8,8,12,12],"right_children":[2,4,6,8,10,12,14,-1,16,-1,-1,-1,18,-1,-1,-1,-1,-1,-1],"split_conditions":[7.0430106E-1,1.0989011E-3,8.928572E-3,1.5873017E-2,1.858736E-2,1.5E-3,3.22E2,-1.9239828E-1,4.237288E-3,2.9712912E-1,2.2940338E-2,-2.9436734E-1,7.246377E-3,-1.06921315E-1,1.3325705E-1,-1.7645787E-2,1.4217122E-1,1.4460272E-2,-1.991156E-1],"split_indices":[94,66,77,77,19,82,96,0,43,0,0,0,82,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[6.6494354E1,9.173195E0,5.7321156E1,5.172642E0,4.000552E0,5.4151974E1,3.1691833E0,3.0241446E0,2.1484976E0,2.9933753E0,1.0071769E0,5.12252E1,2.9267745E0,1.479743E0,1.6894403E0,1.0203482E0,1.1281495E0,1.0237862E0,1.9029882E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"19","size_leaf_vector":"1"}},{"base_weights":[-7.106066E-1,-8.989116E-1,1.565299E-1,-9.364134E-1,6.330638E-3,-3.0186248E-1,5.646868E-1,-2.8939888E-1,-1.9705363E-4,6.0476292E-2,-1.9178835E-1,-1.527409E-2,2.2102472E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0],"id":23,"left_children":[1,3,5,7,-1,9,11,-1,-1,-1,-1,-1,-1],"loss_changes":[8.7369175E0,1.5171852E0,2.0871217E0,1.1022987E0,0E0,1.0592821E0,6.4840615E-1,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,5,5,6,6],"right_children":[2,4,6,8,-1,10,12,-1,-1,-1,-1,-1,-1],"split_conditions":[9.0198434E-4,3.6621094E-4,6.2539085E-4,1.724138E-2,6.330638E-3,3.2967035E-2,6.1500614E-4,-2.8939888E-1,-1.9705363E-4,6.0476292E-2,-1.9178835E-1,-1.527409E-2,2.2102472E-1],"split_indices":[82,85,83,77,0,6,76,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[5.1645065E1,4.2400784E1,9.244282E0,4.0722996E1,1.6777872E0,4.4768505E0,4.7674313E0,3.9499653E1,1.2233434E0,1.9580355E0,2.518815E0,1.1952374E0,3.5721939E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"13","size_leaf_vector":"1"}},{"base_weights":[-6.6624606E-1,2.7486986E-1,-8.625338E-1,-2.527144E-1,7.680695E-1,-9.504251E-1,4.2659E-3,-1.7874642E-1,5.668582E-2,2.8984976E-1,3.713262E-2,-2.891184E-1,-8.263181E-2,-1.1808214E-1,1.2430477E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":24,"left_children":[1,3,5,7,9,11,13,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[7.9568996E0,2.2679904E0,2.6567554E0,8.101632E-1,4.3777227E-1,1.8463135E-2,8.4854895E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6],"right_children":[2,4,6,8,10,12,14,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[7.0430106E-1,6.8259385E-4,8.064516E-3,1.14613185E-2,1.5151516E-2,3.937008E-3,3.22E2,-1.7874642E-1,5.668582E-2,2.8984976E-1,3.713262E-2,-2.891184E-1,-8.263181E-2,-1.1808214E-1,1.2430477E-1],"split_indices":[94,60,77,77,26,72,96,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[4.0789833E1,6.9702277E0,3.3819607E1,3.6033084E0,3.366919E0,3.0618494E1,3.201113E0,1.8314934E0,1.7718151E0,2.193062E0,1.173857E0,2.9607204E1,1.0112883E0,1.6451374E0,1.5559757E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"15","size_leaf_vector":"1"}},{"base_weights":[-6.2111485E-1,-8.940679E-1,5.9063043E-2,4.2276315E-2,-2.845366E-1,-4.8396435E-1,4.23203E-1,2.3267195E-2,-1.9774856E-1,7.4647677E-1,-1.04515396E-1,2.537463E-1,5.159152E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0],"id":25,"left_children":[1,3,5,-1,-1,7,9,-1,-1,11,-1,-1,-1],"loss_changes":[6.245635E0,1.4770775E0,2.2791786E0,0E0,0E0,5.11274E-1,1.959467E0,0E0,0E0,1.4673758E-1,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,5,5,6,6,9,9],"right_children":[2,4,6,-1,-1,8,10,-1,-1,12,-1,-1,-1],"split_conditions":[3.7974683E-3,1.3245033E-2,6.1500614E-4,4.2276315E-2,-2.845366E-1,2.625E-2,1.25E-2,2.3267195E-2,-1.9774856E-1,6.134969E-3,-1.04515396E-1,2.537463E-1,5.159152E-2],"split_indices":[71,12,76,0,0,13,50,0,0,41,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[3.2356354E1,2.2865889E1,9.490465E0,1.0621526E0,2.1803738E1,3.6774175E0,5.813048E0,1.0070518E0,2.6703658E0,4.119596E0,1.6934519E0,3.1096165E0,1.0099794E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"13","size_leaf_vector":"1"}},{"base_weights":[-5.733626E-1,2.8029895E-1,-8.0275047E-1,-1.799578E-1,7.9176515E-1,-9.1266733E-1,-5.998699E-3,-1.5255603E-1,5.2422404E-2,2.8324482E-1,6.7580484E-2,-2.8303793E-1,-8.636703E-2,-1.0039713E-1,1.0091383E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":26,"left_children":[1,3,5,7,9,11,13,-1,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[5.5143137E0,1.6636994E0,1.881711E0,5.802104E-1,6.752157E-2,9.2570305E-2,5.1980543E-1,0E0,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,4,4,5,5,6,6],"right_children":[2,4,6,8,10,12,14,-1,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[7.0430106E-1,1.0989011E-3,8.064516E-3,1.2004802E-3,1.5384615E-2,1.5E-3,3.27E2,-1.5255603E-1,5.2422404E-2,2.8324482E-1,6.7580484E-2,-2.8303793E-1,-8.636703E-2,-1.0039713E-1,1.0091383E-1],"split_indices":[94,66,77,82,22,82,96,0,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[2.6011106E1,5.462097E0,2.054901E1,3.216129E0,2.245968E0,1.7929974E1,2.6190364E0,1.4444505E0,1.7716786E0,1.2445474E0,1.0014209E0,1.6601679E1,1.3282936E0,1.347798E0,1.2712383E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"15","size_leaf_vector":"1"}},{"base_weights":[-5.180815E-1,-8.688337E-1,6.020739E-2,-2.7672592E-1,-5.9777964E-2,-3.2066685E-1,5.6401026E-1,9.747842E-2,-5.538528E-1,2.360502E-1,1.4654251E-2,-1.9949876E-1,-2.4626968E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0],"id":27,"left_children":[1,3,5,-1,-1,7,9,-1,11,-1,-1,-1,-1],"loss_changes":[4.5694313E0,3.158903E-1,1.973643E0,0E0,0E0,1.0769228E0,4.6490312E-1,0E0,1.9430506E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,5,5,6,6,8,8],"right_children":[2,4,6,-1,-1,8,10,-1,12,-1,-1,-1,-1],"split_conditions":[1.9772614E-3,1.076E3,2.1978022E-4,-2.7672592E-1,-5.9777964E-2,1.9950125E-2,4.640371E-3,9.747842E-2,1.3978494E-2,2.360502E-1,1.4654251E-2,-1.9949876E-1,-2.4626968E-2],"split_indices":[71,96,84,0,0,17,59,0,49,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[2.1269802E1,1.2926817E1,8.342984E0,1.1619302E1,1.3075154E0,4.9581428E0,3.3848414E0,1.2112542E0,3.7468884E0,1.9947153E0,1.3901262E0,2.7009673E0,1.0459211E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"13","size_leaf_vector":"1"}},{"base_weights":[-4.6445897E-1,2.8834006E-1,-7.2635216E-1,5.588125E-1,-1.1944E-1,-8.687566E-1,1.6048588E-2,7.7824765E-1,-2.4818249E-2,-2.7253726E-1,-6.764196E-2,-8.4895924E-2,8.966211E-2,6.844921E-2,2.7625397E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":28,"left_children":[1,3,5,7,-1,9,11,13,-1,-1,-1,-1,-1,-1,-1],"loss_changes":[3.9028625E0,1.2531575E0,1.513361E0,6.83537E-1,0E0,9.954643E-2,3.606708E-1,5.450058E-2,0E0,0E0,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,5,5,6,6,7,7],"right_children":[2,4,6,8,-1,10,12,14,-1,-1,-1,-1,-1,-1,-1],"split_conditions":[7.0430106E-1,1.908397E-2,7.968128E-3,2.0689655E-2,-1.1944E-1,1.5E-3,1.3157895E-2,1.0989011E-3,-2.4818249E-2,-2.7253726E-1,-6.764196E-2,-8.4895924E-2,8.966211E-2,6.844921E-2,2.7625397E-1],"split_indices":[94,27,77,45,0,82,49,66,0,0,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.7733812E1,4.5510526E0,1.3182759E1,3.3981416E0,1.1529108E0,1.0918262E1,2.2644978E0,2.373281E0,1.0248605E0,9.895341E0,1.02292E0,1.1004288E0,1.164069E0,1.0238314E0,1.3494496E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"15","size_leaf_vector":"1"}},{"base_weights":[-4.1140348E-1,-6.733429E-1,3.6261898E-1,-8.232698E-1,8.6302415E-2,-6.1668422E-2,2.2108477E-1,-2.6357463E-1,-4.8754588E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0],"id":29,"left_children":[1,3,5,7,-1,-1,-1,-1,-1],"loss_changes":[3.4609306E0,1.9952564E0,1.1429518E0,2.5252676E-1,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3],"right_children":[2,4,6,8,-1,-1,-1,-1,-1],"split_conditions":[1.0683761E-3,2.5720164E-2,6.1500614E-4,8.58E2,8.6302415E-2,-6.1668422E-2,2.2108477E-1,-2.6357463E-1,-4.8754588E-2],"split_indices":[68,71,76,96,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0],"sum_hessian":[1.4865897E1,1.120429E1,3.6616068E0,9.816214E0,1.388077E0,1.6333174E0,2.0282893E0,8.753764E0,1.062449E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"9","size_leaf_vector":"1"}},{"base_weights":[-3.5994E-1,-6.18612E-1,3.5796607E-1,-7.6958114E-1,3.5408925E-2,6.056403E-1,-4.3686207E-2,-5.0175924E-2,-2.4974698E-1,4.1887242E-2,2.3018456E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0],"id":30,"left_children":[1,3,5,7,-1,9,-1,-1,-1,-1,-1],"loss_changes":[2.73725E0,1.2391529E0,6.1476785E-1,1.9051313E-1,0E0,1.2064779E-1,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3,5,5],"right_children":[2,4,6,8,-1,10,-1,-1,-1,-1,-1],"split_conditions":[2.5316456E-4,1.724138E-2,6.451613E-3,1.4563107E-2,3.5408925E-2,2.3148148E-3,-4.3686207E-2,-5.0175924E-2,-2.4974698E-1,4.1887242E-2,2.3018456E-1],"split_indices":[84,77,41,12,0,68,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.254754E1,9.325674E0,3.2218654E0,7.7024083E0,1.6232656E0,2.0238442E0,1.198021E0,1.0743707E0,6.6280375E0,1.0011873E0,1.0226569E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"11","size_leaf_vector":"1"}},{"base_weights":[-3.0134112E-1,-7.3276997E-1,1.4391443E-1,-4.914068E-2,-2.432618E-1,-3.2452276E-1,4.289211E-1,-1.4695077E-1,3.7237366E-3,6.3575584E-1,-4.639526E-2,2.215642E-1,5.7336237E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0,0,0],"id":31,"left_children":[1,3,5,-1,-1,7,9,-1,-1,11,-1,-1,-1],"loss_changes":[2.409783E0,1.4520717E-1,1.038916E0,0E0,0E0,1.7977941E-1,6.560409E-1,0E0,0E0,2.3711324E-2,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,5,5,6,6,9,9],"right_children":[2,4,6,-1,-1,8,10,-1,-1,12,-1,-1,-1],"split_conditions":[1.9772614E-3,3.6585364E-2,6.1500614E-4,-4.914068E-2,-2.432618E-1,1.3333333E-3,1.0178117E-2,-1.4695077E-1,3.7237366E-3,3.012048E-3,-4.639526E-2,2.215642E-1,5.7336237E-2],"split_indices":[71,1,76,0,0,77,50,0,0,41,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[1.0995696E1,5.2566013E0,5.739095E0,1.0083286E0,4.248273E0,2.1184912E0,3.6206038E0,1.1167656E0,1.0017257E0,2.6071374E0,1.0134664E0,1.5806916E0,1.0264459E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"13","size_leaf_vector":"1"}},{"base_weights":[-2.6496154E-1,-5.3641564E-1,3.472272E-1,-6.9079286E-1,7.001203E-2,1.8750632E-1,-2.3652226E-2,-2.3778039E-1,-5.341109E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0],"id":32,"left_children":[1,3,5,7,-1,-1,-1,-1,-1],"loss_changes":[1.9665408E0,1.0899146E0,5.106457E-1,2.1188068E-1,0E0,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,3,3],"right_children":[2,4,6,8,-1,-1,-1,-1,-1],"split_conditions":[1.0683761E-3,2.8910303E-2,4.347826E-3,5.18E2,7.001203E-2,1.8750632E-1,-2.3652226E-2,-2.3778039E-1,-5.341109E-2],"split_indices":[68,71,48,96,0,0,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0],"sum_hessian":[9.712905E0,6.8148623E0,2.8980427E0,5.761953E0,1.0529093E0,1.4716101E0,1.4264327E0,4.3520746E0,1.4098784E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"9","size_leaf_vector":"1"}},{"base_weights":[-2.218989E-1,-2.0327203E-1,1.15790226E-1,-3.066736E-1,3.9067537E-1,8.928087E-3,-1.4938836E-1,5.6368876E-1,-2.6790047E-2,5.1977936E-2,2.15381E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0,0,0],"id":33,"left_children":[1,-1,3,5,7,-1,-1,9,-1,-1,-1],"loss_changes":[1.5645843E0,0E0,8.631706E-1,2.1325856E-1,4.088874E-1,0E0,0E0,7.4974895E-2,0E0,0E0,0E0],"parents":[2147483647,0,0,2,2,3,3,4,4,7,7],"right_children":[2,-1,4,6,8,-1,-1,10,-1,-1,-1],"split_conditions":[6.455778E-4,-2.0327203E-1,6.1500614E-4,6.976744E-1,8.241759E-3,8.928087E-3,-1.4938836E-1,8.223684E-4,-2.6790047E-2,5.1977936E-2,2.15381E-1],"split_indices":[71,0,76,94,41,0,0,65,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0,0,0],"sum_hessian":[8.657937E0,3.2567754E0,5.401162E0,2.0834773E0,3.317685E0,1.0612996E0,1.0221778E0,2.310444E0,1.0072408E0,1.2555864E0,1.0548576E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"11","size_leaf_vector":"1"}},{"base_weights":[-1.869147E-1,3.0696288E-1,-4.5422262E-1,-3.4661844E-2,1.9959246E-1,-6.4937395E-1,5.1225107E-2,-2.1900456E-1,-5.0371926E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0,0,0],"id":34,"left_children":[1,3,5,-1,-1,7,-1,-1,-1],"loss_changes":[1.3085523E0,6.380638E-1,8.6085975E-1,0E0,0E0,6.744671E-2,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2,5,5],"right_children":[2,4,6,-1,-1,8,-1,-1,-1],"split_conditions":[6.88E-1,1.0989011E-3,1.14613185E-2,-3.4661844E-2,1.9959246E-1,1.7699115E-3,5.1225107E-2,-2.1900456E-1,-5.0371926E-2],"split_indices":[94,66,77,0,0,77,0,0,0],"split_type":[0,0,0,0,0,0,0,0,0],"sum_hessian":[7.855825E0,2.7066584E0,5.1491666E0,1.5530868E0,1.1535717E0,3.8941522E0,1.2550144E0,2.8933196E0,1.0008324E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"9","size_leaf_vector":"1"}},{"base_weights":[-1.5496568E-1,-4.116813E-1,3.2708248E-1,-1.8753748E-1,5.222885E-3,-9.54894E-3,1.5714338E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":35,"left_children":[1,3,5,-1,-1,-1,-1],"loss_changes":[1.1437526E0,5.38746E-1,2.5609526E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2],"right_children":[2,4,6,-1,-1,-1,-1],"split_conditions":[2.5316456E-4,9.0198434E-4,6.8E2,-1.8753748E-1,5.222885E-3,-9.54894E-3,1.5714338E-1],"split_indices":[84,82,96,0,0,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[7.1543813E0,4.76353E0,2.3908515E0,2.8760376E0,1.8874921E0,1.1432711E0,1.2475804E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-1.2353737E-1,3.2113704E-1,-3.4724045E-1,1.7205703E-1,-3.075523E-2,-1.8265098E-1,3.1590827E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":36,"left_children":[1,3,5,-1,-1,-1,-1],"loss_changes":[8.781458E-1,3.901511E-1,7.2798806E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2],"right_children":[2,4,6,-1,-1,-1,-1],"split_conditions":[1.1827957E-2,7.1174377E-3,1.14613185E-2,1.7205703E-1,-3.075523E-2,-1.8265098E-1,3.1590827E-2],"split_indices":[26,4,77,0,0,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[6.7067976E0,2.0989594E0,4.607838E0,1.0936687E0,1.0052907E0,2.7010868E0,1.9067513E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-9.718469E-2,-3.5728532E-1,2.9549858E-1,5.205329E-2,-1.628339E-1,1.6412172E-1,-3.78178E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":37,"left_children":[1,3,5,-1,-1,-1,-1],"loss_changes":[8.452004E-1,5.676503E-1,4.3300894E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2],"right_children":[2,4,6,-1,-1,-1,-1],"split_conditions":[2.8089888E-3,2.4752475E-3,3.5971224E-3,5.205329E-2,-1.628339E-1,1.6412172E-1,-3.78178E-2],"split_indices":[76,40,56,0,0,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[6.2414684E0,3.808792E0,2.4326766E0,1.0030739E0,2.8057182E0,1.3370334E0,1.095643E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-7.187456E-2,-3.1720018E-1,3.0519798E-1,-1.6669549E-1,2.7785318E-2,1.3929984E-1,3.3046412E-3],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":38,"left_children":[1,3,5,-1,-1,-1,-1],"loss_changes":[7.301388E-1,5.047127E-1,1.4507744E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2],"right_children":[2,4,6,-1,-1,-1,-1],"split_conditions":[1.0683761E-3,1.2903226E-2,7.29927E-3,-1.6669549E-1,2.7785318E-2,1.3929984E-1,3.3046412E-3],"split_indices":[68,77,32,0,0,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[5.8463984E0,3.6381676E0,2.208231E0,2.07499E0,1.5631775E0,1.0576977E0,1.1505333E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-5.503404E-2,2.5198242E-1,-3.1395373E-1,1.4001074E-1,-3.6932047E-2,3.9690513E-2,-1.5314409E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":39,"left_children":[1,3,5,-1,-1,-1,-1],"loss_changes":[5.9796494E-1,3.4263808E-1,4.1712618E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2],"right_children":[2,4,6,-1,-1,-1,-1],"split_conditions":[1.4814815E-2,8.56531E-3,2.5641026E-2,1.4001074E-1,-3.6932047E-2,3.9690513E-2,-1.5314409E-1],"split_indices":[26,4,11,0,0,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[5.527074E0,2.5409324E0,2.9861414E0,1.4605793E0,1.0803531E0,1.0129108E0,1.9732306E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-4.3461516E-2,-3.5616964E-1,2.2138846E-1,1.2708427E-2,-1.6576333E-1,-3.535281E-2,1.15718514E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":40,"left_children":[1,3,5,-1,-1,-1,-1],"loss_changes":[5.9587455E-1,2.7744415E-1,2.6826596E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2],"right_children":[2,4,6,-1,-1,-1,-1],"split_conditions":[6.1500614E-4,2.232143E-2,5.3619305E-3,1.2708427E-2,-1.6576333E-1,-3.535281E-2,1.15718514E-1],"split_indices":[76,5,52,0,0,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[5.242672E0,2.2460113E0,2.996661E0,1.0002815E0,1.2457298E0,1.0702921E0,1.9263688E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-4.586006E-2,-2.2689705E-1,1.0223336E-1,5.0987456E-2,-4.040471E-1,-1.6554946E-1,-4.8039705E-3],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":41,"left_children":[1,3,-1,-1,5,-1,-1],"loss_changes":[4.9590573E-1,3.9721906E-1,0E0,0E0,1.9342762E-1,0E0,0E0],"parents":[2147483647,0,0,1,1,4,4],"right_children":[2,4,-1,-1,6,-1,-1],"split_conditions":[6.2539085E-4,1.16959065E-2,1.0223336E-1,5.0987456E-2,1.6064256E-2,-1.6554946E-1,-4.8039705E-3],"split_indices":[83,26,0,0,71,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[4.980137E0,3.6733181E0,1.3068186E0,1.1461923E0,2.5271258E0,1.5244215E0,1.0027044E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-3.9123945E-2,-1.2221448E-1,1.4031945E-1,-5.5218644E-2,3.0487335E-1,1.3224149E-1,6.1299703E-3],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":42,"left_children":[1,-1,3,-1,5,-1,-1],"loss_changes":[4.339232E-1,0E0,3.0044305E-1,0E0,1.2296334E-1,0E0,0E0],"parents":[2147483647,0,0,2,2,4,4],"right_children":[2,-1,4,-1,6,-1,-1],"split_conditions":[6.455778E-4,-1.2221448E-1,6.1500614E-4,-5.5218644E-2,4.784689E-3,1.3224149E-1,6.1299703E-3],"split_indices":[71,0,76,0,50,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[4.7014475E0,1.1241634E0,3.5772839E0,1.1640549E0,2.413229E0,1.2609183E0,1.1523107E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-3.56828E-2,-1.9375902E-1,8.9156084E-2,-3.5948864E-1,5.2377164E-2,-1.7054276E-1,1.6284768E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":43,"left_children":[1,3,-1,5,-1,-1,-1],"loss_changes":[3.4779394E-1,3.280003E-1,0E0,3.182507E-1,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,3,3],"right_children":[2,4,-1,6,-1,-1,-1],"split_conditions":[6.2539085E-4,8.58E2,8.9156084E-2,1.724138E-2,5.2377164E-2,-1.7054276E-1,1.6284768E-2],"split_indices":[83,96,0,77,0,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[4.5153546E0,3.3448398E0,1.1705147E0,2.3234966E0,1.0213431E0,1.2953521E0,1.0281446E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-3.149241E-2,2.0384935E-1,-2.4427876E-1,1.0728061E-1,-1.4413183E-2,-1.321485E-1,1.370824E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0,0,0],"id":44,"left_children":[1,3,5,-1,-1,-1,-1],"loss_changes":[3.131877E-1,1.3501759E-1,2.031725E-1,0E0,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1,2,2],"right_children":[2,4,6,-1,-1,-1,-1],"split_conditions":[7.0430106E-1,1.3157895E-2,4.241782E-3,1.0728061E-1,-1.4413183E-2,-1.321485E-1,1.370824E-2],"split_indices":[94,26,77,0,0,0,0],"split_type":[0,0,0,0,0,0,0],"sum_hessian":[4.259679E0,2.0425823E0,2.2170966E0,1.0077852E0,1.0347971E0,1.0127248E0,1.2043719E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"7","size_leaf_vector":"1"}},{"base_weights":[-2.8704628E-2,-2.1953008E-1,6.663014E-2,-1.2215644E-1,2.8919362E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0],"id":45,"left_children":[1,3,-1,-1,-1],"loss_changes":[2.9328993E-1,2.4109451E-1,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1],"right_children":[2,4,-1,-1,-1],"split_conditions":[3.021148E-3,1.2004802E-3,6.663014E-2,-1.2215644E-1,2.8919362E-2],"split_indices":[76,82,0,0,0],"split_type":[0,0,0,0,0],"sum_hessian":[4.109324E0,2.4045312E0,1.704793E0,1.3272777E0,1.0772535E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"5","size_leaf_vector":"1"}},{"base_weights":[-2.7026188E-2,-1.8838882E-1,7.433529E-2,-1.2005394E-1,3.7915256E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0],"id":46,"left_children":[1,3,-1,-1,-1],"loss_changes":[2.677948E-1,2.978893E-1,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1],"right_children":[2,4,-1,-1,-1],"split_conditions":[8.42E2,1.5873017E-2,7.433529E-2,-1.2005394E-1,3.7915256E-2],"split_indices":[96,77,0,0,0],"split_type":[0,0,0,0,0],"sum_hessian":[3.9863408E0,2.7097266E0,1.2766142E0,1.4576426E0,1.252084E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"5","size_leaf_vector":"1"}},{"base_weights":[-2.2192689E-2,-1.9936964E-1,6.3687325E-2,3.0721834E-2,-1.15368135E-1],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0],"id":47,"left_children":[1,3,-1,-1,-1],"loss_changes":[2.4385934E-1,2.2262287E-1,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1],"right_children":[2,4,-1,-1,-1],"split_conditions":[2.5316456E-4,6.849315E-3,6.3687325E-2,3.0721834E-2,-1.15368135E-1],"split_indices":[84,3,0,0,0],"split_type":[0,0,0,0,0],"sum_hessian":[3.8509905E0,2.2788398E0,1.5721506E0,1.0366315E0,1.2422084E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"5","size_leaf_vector":"1"}},{"base_weights":[-2.1202331E-2,-1.6082132E-1,7.519872E-2,-9.6578024E-2,3.3609655E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0],"id":48,"left_children":[1,3,-1,-1,-1],"loss_changes":[2.2038847E-1,2.0062837E-1,0E0,0E0,0E0],"parents":[2147483647,0,0,1,1],"right_children":[2,4,-1,-1,-1],"split_conditions":[6.2539085E-4,1.3280213E-3,7.519872E-2,-9.6578024E-2,3.3609655E-2],"split_indices":[83,65,0,0,0],"split_type":[0,0,0,0,0],"sum_hessian":[3.7441669E0,2.7436087E0,1.0005581E0,1.6119728E0,1.1316359E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"5","size_leaf_vector":"1"}},{"base_weights":[-1.3004641E-2,6.8430446E-2,-1.6603918E-1,-1.03404105E-1,3.2575496E-2],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0,0,0,0,0],"id":49,"left_children":[1,-1,3,-1,-1],"loss_changes":[2.0897469E-1,0E0,2.0498481E-1,0E0,0E0],"parents":[2147483647,0,0,2,2],"right_children":[2,-1,4,-1,-1],"split_conditions":[1.9950125E-2,6.8430446E-2,2.994012E-3,-1.03404105E-1,3.2575496E-2],"split_indices":[17,0,76,0,0],"split_type":[0,0,0,0,0],"sum_hessian":[3.6371877E0,1.2217679E0,2.4154198E0,1.3088945E0,1.1065253E0],"tree_param":{"num_deleted":"0","num_feature":"97","num_nodes":"5","size_leaf_vector":"1"}}]},"name":"gbtree"},"learner_model_param":{"base_score":"1.2343189E-1","boost_from_average":"1","num_class":"0","num_feature":"97","num_target":"1"},"objective":{"name":"binary:logistic","reg_loss_param":{"scale_pos_weight":"1"}}},"version":[2,1,1]} -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel" 5 | ] 6 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | with open("README.md", "r", encoding="utf-8") as fh: 4 | long_description = fh.read() 5 | 6 | setuptools.setup( 7 | name="obfuscation-detection", 8 | version="1.0.0", 9 | author="Wilson Tang", 10 | author_email="wilson.tang06@gmail.com", 11 | description="Python module for obfuscation classification in command line executions", 12 | long_description=long_description, 13 | long_description_content_type="text/markdown", 14 | url="https://github.com/adobe/obfuscation-detection", 15 | package_data={ 16 | "obfuscation_detection": ["models/od-cmdexe-xgb-model.json"], 17 | }, 18 | project_urls={ 19 | "Bug Tracker": "https://github.com/adobe/obfuscation-detection/issues", 20 | }, 21 | classifiers=[ 22 | "Programming Language :: Python :: 3.0", 23 | "License :: OSI Approved :: Apache Software License", 24 | "Operating System :: OS Independent", 25 | ], 26 | packages=setuptools.find_packages(), 27 | install_requires = ['xgboost', 'scikit-learn', 'numpy'], 28 | python_requires=">=3.10", 29 | include_package_data=True, 30 | ) --------------------------------------------------------------------------------