finish readme

This commit is contained in:
yyc12345 2020-08-22 16:15:04 +08:00
parent 8cfd7d99d4
commit 134a7c470b
2 changed files with 61 additions and 38 deletions

View File

@ -13,11 +13,11 @@ The project consist of two parts:
1. SuperScriptMaterializer - Custom Virtools Interface Plugin that allows you to export all scripts/schematics into a SQLite database file 1. SuperScriptMaterializer - Custom Virtools Interface Plugin that allows you to export all scripts/schematics into a SQLite database file
2. SuperScriptViewer - a python parser that creates a web page based on the exported databases to view the schematic in Behavior Graph mode similar to how Virtools Dev displays. 2. SuperScriptViewer - a python parser that creates a web page based on the exported databases to view the schematic in Behavior Graph mode similar to how Virtools Dev displays.
The purpose of the project is to allow users to have a backup graph of their scripts from Virtools while providing support for analyzing `--Script Hidden--` scripts by decoding the bytecode of `.NMS` virtools files from `.CMO` and `.VMO`. The purpose of the project is to allow users to have a backup graph of their scripts from Virtools while providing support for analyzing `--Script Hidden--` scripts by generating relation among each script component.
The inspiration came from: The inspiration came from:
- [BearKidsTeam/Script-Materializer](https://github.com/BearKidsTeam/Script-Materializer) - Allows exporting specific scripts into a JSON file - [BearKidsTeam/Script-Materializer](https://github.com/BearKidsTeam/Script-Materializer) - Allows exporting specific scripts into a JSON file
- [BearKidsTeam/VirtoolsScriptDeobfuscation](https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation) - A custom interface plugin that loads `.CMO` files with hidden scripts and makes them visible and editable. - [BearKidsTeam/VirtoolsScriptDeobfuscation](https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation) - A custom interface plugin that loads Virtools files with hidden scripts and makes them visible and editable.
**NOTE:** **NOTE:**
@ -27,11 +27,50 @@ The inspiration came from:
## Requirements ## Requirements
- Virtools Dev 5.0 with SDK (May work for others, Virtools 4 has been tested and can be compiled and run without any modification) ### Use
- Virtools Dev 5.0
- Python 3.0 with Flask module - Python 3.0 with Flask module
- Common browsers (except Safari) - Common browsers (except Safari)
### Compile
For compile or debug this project, follwing tools also are necessary.
- Virtools Dev 5.0 SDK (May work for others, Virtools 4 has been tested and can be compiled and run without any modification)
- Visual Studio 2015 with at least v140 toolset - Visual Studio 2015 with at least v140 toolset
## Usage
### Exporting Scripts from Virtools
1. Make Sure Virtools Dev is closed.
2. Copy compiled SuperScriptMaterializer.dll into Virtools's InterfacePlugins folder. Copy `sqlite3.dll` you downloaded into Virtool's base folder (where `devr.exe` exist). If you use the packaged file on the Release page, just decompress it directly in the root directory of Virtools and allow folder merging and file overwriting.
3. Open Virtools and load a Virtools document of your choice.
4. Go to the menu bar and click `Super Script Materializer` and `Export all script`. Name it `export.db` and save it into `SuperScriptViewer` folder
5. Go to the menu bar and click `Super Script Materializer` and `Export environment`. Name it `env.db` and save it into `SuperScriptViewer` folder
### Viewing Exported Databases
1. Run the viewer by `python3 SuperScriptViewer.py`
2. It will generate a unique decorated database (`decorated.db`) used for viewing based on `export.db` and `env.db`
3. Once generated, a webpage will be hosted (default 127.0.0.1:5000) to view all graphs.
There is advanced command line switches if needed for the SuperScriptViewer
- `-i filename.db` specify an input file to be used as `export.db`
- `-e filename.db` specify an input file to be used as `env.db`
- `-o filename.db` specify an output file to generate `decorated.db`. If it already exists, it will used that instead of generating a new one.
- `-c encoding_name` specify database encoding. The list of supported encodings can be viewed [here](https://docs.python.org/3/library/codecs.html#standard-encodings)
- `-f` forces the output database to be regenerated (useful if you are unsure if decorated.db matches what export.db and env.db used)
- `-d` enable debugging mode. Directly raise exceptions instead of outputting to the console after capture, which is convenient for debugging
A document instructing you how to use the SuperScriptViewer is built into the SuperScriptViewer and can be viewed from the Help page.
## Troubleshooting
- If `SuperScriptViewer.py` displays `TEXT` type decoding error, you will need to use switch `-c` to whatever encoding system your OS uses since Virtools uses multi-byte encoding and depends on your system's locale. It should be noted that the specified encoding is not the current code page of your computer, but the code page of the author who made this Virtools document.
- If Virtools or SuperScriptViewer show an error window or message, please create an issues page noting what Virtools version you have, a link to your file you used to export and the error message.
## Build ## Build
1. Download repository. 1. Download repository.
@ -50,36 +89,6 @@ The inspiration came from:
- Linker -> Debugging -> Generate Program Database File - Linker -> Debugging -> Generate Program Database File
8. Clean and Build as Release 8. Clean and Build as Release
## Usage
### Exporting Scripts from Virtools
1. Make Sure Virtools Dev is closed.
2. Copy compiled SuperScriptMaterializer.dll into Virtools's InterfacePlugins folder. Copy `sqlite3.dll` you downloaded into Virtool's base folder (where `devr.exe` exist). If you use the packaged file on the Release page, just decompress it directly in the root directory of Virtools and allow folder merging and file overwriting.
3. Open Virtools and load a `.CMO` of your choice.
4. Go to the menu bar and click `Super Script Materializer` and `Export all script`. Name it `export.db` and save it into `SuperScriptViewer` folder
5. Go to the menu bar and click `Super Script Materializer` and `Export environment`. Name it `env.db` and save it into `SuperScriptViewer` folder
### Viewing Exported Databases
1. Run the viewer by `python3 SuperScriptViewer.py`
2. It will generate a unique decorated database (`decorated.db`) used for viewing based on `export.db` and `env.db`
3. Once generated, a webpage will be hosted (default 127.0.0.1:5000) to view all graphs.
There is advanced command line switches if needed for the SuperScriptViewer
- `-i filename.db` specify an input file to be used as `export.db`
- `-e filename.db` specify an input file to be used as `env.db`
- `-o filename.db` specify an output file to generate `decorated.db`. If it already exists, it will used that instead of generating a new one.
- `-c encoding_name` specify database encoding. The list of supported encodings can be viewed [here](https://docs.python.org/3/library/codecs.html#standard-encodings)
- `-f` forces the output database to be regenerated (useful if you are unsure if decorated.db matches what export.db and env.db used)
A document instructing you how to use the SuperScriptViewer is built into the SuperScriptViewer and can be viewed from the Help page.
## Troubleshooting
- If `SuperScriptViewer.py` displays `TEXT` type decoding error, you will need to use switch `-c` to whatever encoding system your OS uses since Virtools uses multi-byte encoding and depends on your system's locale. It should be noted that the specified encoding is not the current code page of your computer, but the code page of the author who made this Virtools document.
- If Virtools or SuperScriptViewer show an error window or message, please create an issues page noting what Virtools version you have, a link to your file you used to export and the error message.
## Development plan ## Development plan
In subsequent versions, the following features will be gradually added: In subsequent versions, the following features will be gradually added:

View File

@ -10,15 +10,31 @@
超级Virtools脚本物化器机翻确信 超级Virtools脚本物化器机翻确信
本项目分为2个部分`SuperScriptMaterializer`是一个C++工程将生成一个Virtools界面插件用于导出初步数据`SuperScriptViewer`是一个Python工程将解析导出的数据然后使用Flask提供一个本地Web界面进行脚本查看。
将Virtools文档中的所有脚本导出成一个SQLite数据库文件然后经过Python进行排布处理最后提供一个本地Web前端查看脚本。这同样适用于`Script Hidden`的Virtools脚本也适用于其中含有不可展开的`Behavior Graph`的脚本。 将Virtools文档中的所有脚本导出成一个SQLite数据库文件然后经过Python进行排布处理最后提供一个本地Web前端查看脚本。这同样适用于`Script Hidden`的Virtools脚本也适用于其中含有不可展开的`Behavior Graph`的脚本。
物化器不能完全恢复脚本的原有排布无论原有排布是否存在物化器都将重新自动生成脚本中的各个元素的位置。某些结构的关系可能会改变例如Export parameter亦或者是与Virtools中的呈现不同但是逻辑思路将不会改变。同时物化器不能将已经生成的结构回写成Virtools可接受的格式因此物化器只能提供无视脚本隐藏的分析功能。 物化器不能完全恢复脚本的原有排布无论原有排布是否存在物化器都将重新自动生成脚本中的各个元素的位置。某些结构的关系可能会改变例如Export parameter亦或者是与Virtools中的呈现不同但是逻辑思路将不会改变。同时物化器不能将已经生成的结构回写成Virtools可接受的格式因此物化器只能提供无视脚本隐藏的分析功能。
本工程代码源于另两个工程:[BearKidsTeam/Script-Materializer](https://github.com/BearKidsTeam/Script-Materializer)该工程用于将指定脚本导出为JSON文档和[BearKidsTeam/VirtoolsScriptDeobfuscation](https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation)该工程能够在Virtools 3.5中提供内置的隐藏脚本解析功能将解析结果解析为可以被Virtools识别的格式 本工程代码源于另两个工程:[BearKidsTeam/Script-Materializer](https://github.com/BearKidsTeam/Script-Materializer)该工程用于将指定脚本导出为JSON文档和[BearKidsTeam/VirtoolsScriptDeobfuscation](https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation)该工程能够在Virtools 3.5中提供内置的隐藏脚本解析功能将解析结果解析为可以被Virtools识别的格式
本项目分为2个部分`SuperScriptMaterializer`是一个C++工程将生成一个Virtools界面插件用于导出初步数据`SuperScriptViewer`是一个Python工程将解析导出的数据然后使用Flask提供一个本地Web界面进行脚本查看。 **注意事项**
当前最新的commit并不一定可以稳定使用请访问Release界面获取可以稳定使用的版本。且本程序的开发周期很长如果您使用了第一个正式版之前的版本那么您需要重新构建所有数据因为之前的版本与正式版本不兼容。 * 当前最新的commit并不一定可以稳定使用请访问Release界面获取可以稳定使用的版本。
* 如果您更换了使用的版本(包括第一个稳定版本之前的版本),则需要重新构建所有数据,因为各个版本之间的数据可能彼此不兼容。
### 使用
- Virtools Dev 5.0
- 至少Python 3.0且需要安装Flask库
- 常见浏览器除了Safari
### 编译
为了编译或者调试这个项目,以下工具也是必须的。
- Virtools Dev 5.0 SDK在其他版本上或许也能工作已测试Virtools 4可以无修改编译并运行
- Visual Studio 2015至少VC++ v140的工具集
## 使用方法 ## 使用方法
@ -35,6 +51,7 @@
- `-e`:指定输入的`env.db`,环境数据库 - `-e`:指定输入的`env.db`,环境数据库
- `-c`:指定数据库编码,可用的编码表可以在[这里](https://docs.python.org/3/library/codecs.html#standard-encodings)查看 - `-c`:指定数据库编码,可用的编码表可以在[这里](https://docs.python.org/3/library/codecs.html#standard-encodings)查看
- `-f`:无参数,用于强制重新生成输出数据库,无论输出数据库是否存在 - `-f`:无参数,用于强制重新生成输出数据库,无论输出数据库是否存在
- `-d`:无参数,启用调试模式,直接抛出异常,而不是捕获后在控制台输出,方便调试
以上选项在基本使用中应该不会用到,因此按上述规则直接放置好文件直接运行即可。 以上选项在基本使用中应该不会用到,因此按上述规则直接放置好文件直接运行即可。
@ -42,11 +59,8 @@
### 使用注意 ### 使用注意
- 您需要先安装Virtools 5, Python和任意一种浏览器才能使用本工程。Python需要先安装`Flask`库。浏览器建议使用Chrome或Firefox本程序不支持Safari浏览器。
- 导出插件目前只支持Virtools 5但Virtools 4已经过测试可以无修改编译运行。
- 导出插件选择完文件后弹出错误或者Python交互界面弹出错误请附带您引起bug的文件以及错误窗口的内容提交bug - 导出插件选择完文件后弹出错误或者Python交互界面弹出错误请附带您引起bug的文件以及错误窗口的内容提交bug
- 如果Python交互界面提示数据库`TEXT`类型解码失败,或者解析的字符出现乱码,那么可能您需要手动使用`-c`开关指定数据库文本解码方式。因为Virtools使用多字节编码依赖于当前操作系统的代码页`SuperScriptMaterializer`做了特殊获取以保证大多数计算机可以直接运行但仍然不能排除一些特殊情况。需要注意的是指定的编码不是你计算机当前的代码页而是制作这个Virtools文档的作者的计算机的代码页。 - 如果Python交互界面提示数据库`TEXT`类型解码失败,或者解析的字符出现乱码,那么可能您需要手动使用`-c`开关指定数据库文本解码方式。因为Virtools使用多字节编码依赖于当前操作系统的代码页`SuperScriptMaterializer`做了特殊获取以保证大多数计算机可以直接运行但仍然不能排除一些特殊情况。需要注意的是指定的编码不是你计算机当前的代码页而是制作这个Virtools文档的作者的计算机的代码页。
- 如果您使用本工程的Release页面中提供的已编译好的Virtools界面插件您需要放入的`sqlite3.dll`版本应为`sqlite-dll-win32-x86-3310100`
## 编译 ## 编译