Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
107a4e27
Commit
107a4e27
authored
Aug 07, 2018
by
Medicean
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'antoor/v2.0-beta' into v2.0-beta
parents
e711fcba
e470e551
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
204 additions
and
7 deletions
+204
-7
menubar.js
modules/menubar.js
+7
-1
app.entry.js
source/app.entry.js
+34
-0
index.js
source/core/asp/index.js
+2
-1
index.js
source/core/aspx/index.js
+1
-1
index.js
source/core/custom/index.js
+1
-1
index.js
source/core/php/index.js
+1
-1
en.js
source/language/en.js
+9
-0
zh.js
source/language/zh.js
+9
-0
load.entry.js
source/load.entry.js
+12
-0
encoders.js
source/modules/settings/encoders.js
+124
-0
index.js
source/modules/settings/index.js
+4
-2
No files found.
modules/menubar.js
View file @
107a4e27
...
@@ -61,6 +61,12 @@ class Menubar {
...
@@ -61,6 +61,12 @@ class Menubar {
click
:
event
.
sender
.
send
.
bind
(
event
.
sender
,
'menubar'
,
'settings-display'
)
click
:
event
.
sender
.
send
.
bind
(
event
.
sender
,
'menubar'
,
'settings-display'
)
},
{
},
{
type
:
'separator'
type
:
'separator'
},
{
label
:
LANG
[
'main'
][
'encoders'
],
accelerator
:
'Shift+CmdOrCtrl+E'
,
click
:
event
.
sender
.
send
.
bind
(
event
.
sender
,
'menubar'
,
'settings-encoders'
)
},
{
type
:
'separator'
},
{
},
{
label
:
LANG
[
'main'
][
'settings'
],
label
:
LANG
[
'main'
][
'settings'
],
accelerator
:
'Shift+CmdOrCtrl+S'
,
accelerator
:
'Shift+CmdOrCtrl+S'
,
...
...
source/app.entry.js
View file @
107a4e27
...
@@ -40,6 +40,11 @@ const antSword = window.antSword = {
...
@@ -40,6 +40,11 @@ const antSword = window.antSword = {
* @type {Array}
* @type {Array}
*/
*/
logs
:
[],
logs
:
[],
/**
* 核心模块
* @type {Object}
*/
encoders
:
{},
/**
/**
* 核心模块
* 核心模块
* @type {Object}
* @type {Object}
...
@@ -68,6 +73,8 @@ const antSword = window.antSword = {
...
@@ -68,6 +73,8 @@ const antSword = window.antSword = {
if
(
!
value
)
{
if
(
!
value
)
{
return
localStorage
.
getItem
(
key
)
||
def
;
return
localStorage
.
getItem
(
key
)
||
def
;
};
};
if
(
typeof
(
x
)
===
"object"
)
value
=
JSON
.
stringify
(
value
);
// 设置
// 设置
localStorage
.
setItem
(
key
,
value
);
localStorage
.
setItem
(
key
,
value
);
},
},
...
@@ -117,6 +124,33 @@ antSword['core'] = require('./core/');
...
@@ -117,6 +124,33 @@ antSword['core'] = require('./core/');
// 加载语言模板
// 加载语言模板
antSword
[
'language'
]
=
require
(
'./language/'
);
antSword
[
'language'
]
=
require
(
'./language/'
);
// 加载编码
antSword
[
'encoders'
]
=
(
function
(){
var
encoders
=
{
asp
:[],
aspx
:[],
php
:[],
custom
:[]};
// custom
let
es
=
fs
.
readdirSync
(
path
.
join
(
process
.
env
.
AS_WORKDIR
,
'antData/encoder'
));
if
(
es
){
es
.
map
((
_
)
=>
{
let
farr
=
_
.
split
(
"#"
);
encoders
[
farr
[
0
]].
push
(
farr
[
1
].
slice
(
0
,
-
3
));
});
}
// default
[
'asp'
,
'aspx'
,
'php'
,
'custom'
].
map
((
t
)
=>
{
antSword
[
"core"
][
t
].
prototype
.
encoders
.
map
((
e
)
=>
{
encoders
[
t
].
push
(
e
);
});
encoders
[
t
]
=
encoders
[
t
].
unique
();
});
// fs.readdirSync(path.join(process.env.AS_WORKDIR,'encoder'),(err,f) => {
// if(err || !f) return ;
// console.debug(f);
// let farr = f.split("#");
// encoders[farr[0]].push(farr[1]);
// });
return
encoders
;
})();
// 加载代理
// 加载代理
const
aproxy
=
{
const
aproxy
=
{
mode
:
antSword
[
'storage'
](
'aproxymode'
,
false
,
'noproxy'
),
mode
:
antSword
[
'storage'
](
'aproxymode'
,
false
,
'noproxy'
),
...
...
source/core/asp/index.js
View file @
107a4e27
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
const
Base
=
require
(
'../base'
);
const
Base
=
require
(
'../base'
);
class
ASP
extends
Base
{
class
ASP
extends
Base
{
constructor
(
opts
)
{
constructor
(
opts
)
{
super
(
opts
);
super
(
opts
);
// 解析模板
// 解析模板
...
@@ -33,7 +34,7 @@ class ASP extends Base {
...
@@ -33,7 +34,7 @@ class ASP extends Base {
* @return {array} 编码器列表
* @return {array} 编码器列表
*/
*/
get
encoders
()
{
get
encoders
()
{
return
[
'xxxxdog'
];
return
localStorage
.
getItem
(
'encoders_asp'
).
split
(
','
)
||
[
'xxxxdog'
];
}
}
/**
/**
...
...
source/core/aspx/index.js
View file @
107a4e27
...
@@ -37,7 +37,7 @@ class ASPX extends Base {
...
@@ -37,7 +37,7 @@ class ASPX extends Base {
* @return {array} 编码器列表
* @return {array} 编码器列表
*/
*/
get
encoders
()
{
get
encoders
()
{
return
[
'base64'
,
'hex'
];
return
localStorage
.
getItem
(
'encoders_aspx'
).
split
(
','
)
||
[
'base64'
,
'hex'
];
}
}
/**
/**
...
...
source/core/custom/index.js
View file @
107a4e27
...
@@ -30,7 +30,7 @@ class CUSTOM extends Base {
...
@@ -30,7 +30,7 @@ class CUSTOM extends Base {
* @return {array} 编码器列表
* @return {array} 编码器列表
*/
*/
get
encoders
()
{
get
encoders
()
{
return
[
'base64'
,
'hex'
];
return
localStorage
.
getItem
(
'encoders_custom'
).
split
(
','
)
||
[
'base64'
,
'hex'
];
}
}
/**
/**
...
...
source/core/php/index.js
View file @
107a4e27
...
@@ -35,7 +35,7 @@ class PHP extends Base {
...
@@ -35,7 +35,7 @@ class PHP extends Base {
* @return {array} 编码器列表
* @return {array} 编码器列表
*/
*/
get
encoders
()
{
get
encoders
()
{
return
[
'chr'
,
'chr16
'
,
'base64'
];
return
localStorage
.
getItem
(
'encoders_php'
).
split
(
','
)
||
[
'chr
'
,
'base64'
];
}
}
/**
/**
...
...
source/language/en.js
View file @
107a4e27
...
@@ -15,6 +15,7 @@ module.exports = {
...
@@ -15,6 +15,7 @@ module.exports = {
pluginStore
:
'Plugin Store'
,
pluginStore
:
'Plugin Store'
,
settings
:
'System setting'
,
settings
:
'System setting'
,
language
:
'Language setting'
,
language
:
'Language setting'
,
encoders
:
'Encoders manager'
,
aproxy
:
'Proxy setting'
,
aproxy
:
'Proxy setting'
,
display
:
'Display setting'
,
display
:
'Display setting'
,
update
:
'Check update'
,
update
:
'Check update'
,
...
@@ -455,6 +456,14 @@ module.exports = {
...
@@ -455,6 +456,14 @@ module.exports = {
success
:
'Update success! Please manually restart the application later!'
success
:
'Update success! Please manually restart the application later!'
}
}
},
},
encoders
:{
title
:
'Encoder Manager'
,
form
:{
shelltype
:
'Shell Type'
,
encoderslist
:
'Encoder Lists'
},
success
:
'Loaded Encoder Successfully'
},
aproxy
:
{
aproxy
:
{
title
:
'Proxy setting'
,
title
:
'Proxy setting'
,
toolbar
:
{
toolbar
:
{
...
...
source/language/zh.js
View file @
107a4e27
...
@@ -16,6 +16,7 @@ module.exports = {
...
@@ -16,6 +16,7 @@ module.exports = {
pluginStore
:
'插件市场'
,
pluginStore
:
'插件市场'
,
settings
:
'系统设置'
,
settings
:
'系统设置'
,
language
:
'语言设置'
,
language
:
'语言设置'
,
encoders
:
'编码设置'
,
aproxy
:
'代理设置'
,
aproxy
:
'代理设置'
,
display
:
'显示设置'
,
display
:
'显示设置'
,
update
:
'检查更新'
,
update
:
'检查更新'
,
...
@@ -456,6 +457,14 @@ module.exports = {
...
@@ -456,6 +457,14 @@ module.exports = {
success
:
'更新成功!请稍后手动重启应用!'
success
:
'更新成功!请稍后手动重启应用!'
}
}
},
},
encoders
:{
title
:
'编码管理'
,
form
:{
shelltype
:
'脚本类型'
,
encoderslist
:
'编码器列表'
},
success
:
'编码器加载成功'
},
aproxy
:
{
aproxy
:
{
title
:
'代理设置'
,
title
:
'代理设置'
,
toolbar
:
{
toolbar
:
{
...
...
source/load.entry.js
View file @
107a4e27
...
@@ -43,6 +43,18 @@ window.addEventListener('load', () => {
...
@@ -43,6 +43,18 @@ window.addEventListener('load', () => {
return
format
;
return
format
;
}
}
Array
.
prototype
.
unique
=
function
(){
var
res
=
[];
var
json
=
{};
for
(
var
i
=
0
;
i
<
this
.
length
;
i
++
){
if
(
!
json
[
this
[
i
]]){
res
.
push
(
this
[
i
]);
json
[
this
[
i
]]
=
1
;
}
}
return
res
;
}
/**
/**
* 加载JS函数
* 加载JS函数
...
...
source/modules/settings/encoders.js
0 → 100644
View file @
107a4e27
/**
* 中国蚁剑::编码器管理
* 创建:2017-05-30
* 更新:2017-05-30
* 作者:Virink <virink@outlook.com>
*
* 瞎折腾好了。。。
* 编辑保存什么的功能我就不弄了
* 累觉不爱。。。。。。。。
*/
const
LANG
=
antSword
[
'language'
][
'settings'
][
'encoders'
];
const
LANG_T
=
antSword
[
'language'
][
'toastr'
];
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
class
Encoders
{
constructor
(
sidebar
)
{
var
_me
=
this
;
this
.
encoders
=
{
asp
:[],
aspx
:[],
php
:[],
custom
:[]};
this
.
getEncoders
();
sidebar
.
addItem
({
id
:
'encoders'
,
text
:
`<i class="fa fa-file-code-o"></i>
${
LANG
[
'title'
]}
`
});
this
.
cell
=
sidebar
.
cells
(
'encoders'
);
// 并没有什么卵用的工具栏
const
toolbar
=
this
.
cell
.
attachToolbar
();
toolbar
.
loadStruct
([
{
type
:
'button'
,
text
:
`
${
LANG
[
'title'
]}
`
,
icon
:
'eye'
}
]);
let
layout
=
this
.
cell
.
attachLayout
(
'2E'
);
this
.
a
=
layout
.
cells
(
'a'
);
this
.
b
=
layout
.
cells
(
'b'
);
this
.
a
.
hideHeader
();
this
.
b
.
hideHeader
();
this
.
a
.
setHeight
(
80
);
this
.
_createFrom
({});
this
.
editor
=
this
.
b
.
attachEditor
([{
name
:
'editor'
,
type
:
'editor'
,
inputLeft
:
0
,
inputTop
:
0
,
inputHeight
:
this
.
b
.
getHeight
(),
inputWidth
:
this
.
b
.
getWidth
(),
position
:
'absolute'
}]);
}
_createFrom
(
arg
){
var
_me
=
this
;
const
opt
=
Object
.
assign
({},
{
type
:
'asp'
,
encoder
:
[]
},
arg
);
const
form
=
this
.
a
.
attachForm
([
{
type
:
'block'
,
list
:
[
{
type
:
'combo'
,
label
:
`
${
LANG
[
'form'
][
'shelltype'
]}
`
,
width
:
100
,
name
:
'encodertype'
,
readonly
:
true
,
options
:
this
.
_parseEncodes
(
opt
.
type
)
}
]}
],
true
);
form
.
enableLiveValidation
(
true
);
form
.
attachEvent
(
"onChange"
,
function
(
name
,
value
){
if
(
name
==
"encoder"
&&
value
!=
'virink'
)
{
let
_
=
form
.
getFormData
();
_me
.
_readEncoderSource
(
_
.
encodertype
,
value
);
}
});
return
form
;
}
_readEncoderSource
(
_path
,
name
){
let
codes
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
`../../core/
${
_path
}
/encoder/
${
name
}
.js`
));
if
(
codes
){
let
c
=
[];
codes
.
toString
().
split
(
"
\n
"
).
map
((
_
)
=>
{
c
.
push
(
`<div>
${
_
}
</div>`
);
});
this
.
editor
.
setContent
(
c
.
toString
().
replace
(
/,/ig
,
""
));
}
}
_parseEncodes
(
_st
){
let
ret
=
[];
for
(
let
t
in
this
.
encoders
){
let
es
=
this
.
encoders
[
t
];
ret
.
push
({
text
:
t
.
toUpperCase
(),
selected
:
t
===
_st
,
value
:
t
,
list
:
((
t
)
=>
{
let
s
=
[{
text
:
'Welcome'
,
value
:
'virink'
}];
es
.
map
((
e
)
=>
{
s
.
push
({
text
:
e
,
value
:
e
});
});
let
_
=
[{
type
:
'combo'
,
label
:
`
${
LANG
[
'form'
][
'encoderslist'
]}
`
,
width
:
200
,
name
:
'encoder'
,
readonly
:
true
,
options
:
s
}];
return
_
;
})(
t
)
});
}
return
ret
;
}
getEncoders
(){
var
_me
=
this
;
[
'asp'
,
'aspx'
,
'php'
,
'custom'
].
map
((
t
)
=>
{
let
me
=
fs
.
readdirSync
(
path
.
join
(
__dirname
,
`../../core/
${
t
}
/encoder`
));
me
.
map
((
_
)
=>
{
if
(
_
!=
'.DS_Store'
)
_me
.
encoders
[
t
].
push
(
_
.
replace
(
/
\.
js/ig
,
''
));
});
localStorage
.
setItem
(
`encoders_
${
t
}
`
,
_me
.
encoders
[
t
]);
});
toastr
.
success
(
`
${
LANG
[
'success'
]}
`
,
LANG_T
[
'success'
]);
}
}
module
.
exports
=
Encoders
;
source/modules/settings/index.js
View file @
107a4e27
...
@@ -11,12 +11,13 @@ const About = require('./about');
...
@@ -11,12 +11,13 @@ const About = require('./about');
const
Language
=
require
(
'./language'
);
const
Language
=
require
(
'./language'
);
const
AProxy
=
require
(
'./aproxy'
);
const
AProxy
=
require
(
'./aproxy'
);
const
Display
=
require
(
'./display'
);
const
Display
=
require
(
'./display'
);
const
Encoders
=
require
(
'./encoders'
);
class
Settings
{
class
Settings
{
constructor
()
{
constructor
()
{
antSword
[
'menubar'
].
reg
(
'settings'
,
this
.
open
.
bind
(
this
));
antSword
[
'menubar'
].
reg
(
'settings'
,
this
.
open
.
bind
(
this
));
[
'about'
,
'update'
,
'language'
,
'aproxy'
,
'display
'
].
map
((
_
)
=>
{
[
'about'
,
'update'
,
'language'
,
'aproxy'
,
'display'
,
'encoders
'
].
map
((
_
)
=>
{
antSword
[
'menubar'
].
reg
(
`settings-
${
_
}
`
,
this
.
setActive
.
bind
(
this
,
_
));
antSword
[
'menubar'
].
reg
(
`settings-
${
_
}
`
,
this
.
setActive
.
bind
(
this
,
_
));
});
});
return
this
;
return
this
;
...
@@ -44,7 +45,8 @@ class Settings {
...
@@ -44,7 +45,8 @@ class Settings {
// this.update = new Update(sidebar);
// this.update = new Update(sidebar);
this
.
aproxy
=
new
AProxy
(
sidebar
);
this
.
aproxy
=
new
AProxy
(
sidebar
);
this
.
display
=
new
Display
(
sidebar
);
this
.
display
=
new
Display
(
sidebar
);
// Encoders
this
.
encoders
=
new
Encoders
(
sidebar
);
this
.
cell
=
cell
;
this
.
cell
=
cell
;
this
.
sidebar
=
sidebar
;
this
.
sidebar
=
sidebar
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment