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
c2613581
Commit
c2613581
authored
Jan 19, 2020
by
Mr6
Committed by
Medicean
Jan 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhancement: Module) request 增加垃圾数据填充功能 (thx: @yzddmr6)
支持 form-data 和 multipart 模式
parent
a273062b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
3 deletions
+67
-3
request.js
modules/request.js
+50
-2
base.js
source/core/base.js
+2
-0
en.js
source/language/en.js
+1
-0
zh.js
source/language/zh.js
+1
-0
zh_hk.js
source/language/zh_hk.js
+1
-0
zh_tw.js
source/language/zh_tw.js
+1
-0
form.js
source/modules/shellmanager/list/form.js
+11
-1
No files found.
modules/request.js
View file @
c2613581
...
...
@@ -118,7 +118,7 @@ class Request {
_request
.
set
(
_
,
opts
.
headers
[
_
]);
}
// 自定义body
cons
t
_postData
=
Object
.
assign
({},
opts
.
body
,
opts
.
data
);
le
t
_postData
=
Object
.
assign
({},
opts
.
body
,
opts
.
data
);
if
(
opts
[
'useChunk'
]
==
1
)
{
logger
.
debug
(
"request with Chunked"
);
let
_postarr
=
[];
...
...
@@ -199,6 +199,13 @@ class Request {
}
}
}
else
{
if
(
opts
[
'addMassData'
]
==
1
){
for
(
let
i
=
0
;
i
<
randomInt
(
num_min
,
num_max
);
i
++
)
{
//将混淆流量放入到payload数组中
_postData
[
randomString
(
randomInt
(
varname_min
,
varname_max
))]
=
randomString
(
randomInt
(
data_min
,
data_max
));
}
_postData
=
randomDict
(
_postData
);
//logger.debug(_postData);
}
_request
.
send
=
old_send
;
for
(
var
key
in
_postData
)
{
if
(
_postData
.
hasOwnProperty
(
key
))
{
...
...
@@ -208,6 +215,8 @@ class Request {
_postarr
.
push
(
`
${
key
}
=
${
_tmp
}
`
);
}
}
//console.log(_postarr);
//logger.debug(_postarr);
_postarr
=
_postarr
.
join
(
'&'
);
}
_request
...
...
@@ -292,7 +301,7 @@ class Request {
_request
.
set
(
_
,
opts
.
headers
[
_
]);
}
// 自定义body
cons
t
_postData
=
Object
.
assign
({},
opts
.
body
,
opts
.
data
);
le
t
_postData
=
Object
.
assign
({},
opts
.
body
,
opts
.
data
);
if
(
opts
[
'useChunk'
]
==
1
)
{
logger
.
debug
(
"request with Chunked"
);
let
_postarr
=
[];
...
...
@@ -346,6 +355,13 @@ class Request {
_request
.
send
=
_request
.
field
;
_postarr
=
_postData
;
}
else
{
if
(
opts
[
'addMassData'
]
==
1
){
for
(
let
i
=
0
;
i
<
randomInt
(
num_min
,
num_max
);
i
++
)
{
//将混淆流量放入到payload数组中
_postData
[
randomString
(
randomInt
(
varname_min
,
varname_max
))]
=
randomString
(
randomInt
(
data_min
,
data_max
));
}
_postData
=
randomDict
(
_postData
);
//logger.debug(_postData);
}
_request
.
send
=
old_send
;
for
(
var
key
in
_postData
)
{
if
(
_postData
.
hasOwnProperty
(
key
))
{
...
...
@@ -573,5 +589,37 @@ class AntRead extends Readable {
}
}
}
let
varname_min
=
5
;
//变量名最小长度
let
varname_max
=
15
;
// 变量名最大长度
let
data_min
=
200
;
// 变量值最小长度
let
data_max
=
250
;
// 变量值最大长度
let
num_min
=
150
;
// 变量最小个数
let
num_max
=
250
;
// 变量最大个数
function
randomString
(
length
)
{
// 生成随机字符串
//let chars='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
let
chars
=
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
;
let
result
=
''
;
for
(
let
i
=
length
;
i
>
0
;
--
i
)
result
+=
chars
[
Math
.
floor
(
Math
.
random
()
*
chars
.
length
)];
return
result
;
}
function
randomInt
(
min
,
max
)
{
//生成指定范围内的随机数
return
parseInt
(
Math
.
random
()
*
(
max
-
min
+
1
)
+
min
,
10
);
}
function
randomDict
(
dic
){
let
tmparray
=
[]
for
(
let
i
in
dic
){
tmparray
.
push
(
i
)
}
tmparray
=
tmparray
.
sort
((
a
,
b
)
=>
{
return
Math
.
random
()
>
0.5
?
-
1
:
1
;
})
let
finaldata
=
{}
tmparray
.
forEach
(
i
=>
{
finaldata
[
i
]
=
dic
[
i
]
});
return
finaldata
}
module
.
exports
=
Request
;
\ No newline at end of file
source/core/base.js
View file @
c2613581
...
...
@@ -330,6 +330,7 @@ class Base {
chunkStepMin
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'chunk-step-byte-min'
]
||
2
,
chunkStepMax
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'chunk-step-byte-max'
]
||
3
,
useMultipart
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'use-multipart'
]
===
1
,
addMassData
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'add-MassData'
]
===
1
,
useRandomVariable
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'use-random-variable'
]
===
1
,
timeout
:
parseInt
((
this
.
__opts__
[
'otherConf'
]
||
{})[
'request-timeout'
]),
headers
:
(
this
.
__opts__
[
'httpConf'
]
||
{})[
'headers'
]
||
{},
...
...
@@ -382,6 +383,7 @@ class Base {
chunkStepMin
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'chunk-step-byte-min'
]
||
2
,
chunkStepMax
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'chunk-step-byte-max'
]
||
3
,
useMultipart
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'use-multipart'
]
===
1
,
addMassData
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'add-MassData'
]
===
1
,
useRandomVariable
:
(
this
.
__opts__
[
'otherConf'
]
||
{})[
'use-random-variable'
]
===
1
,
timeout
:
parseInt
((
this
.
__opts__
[
'otherConf'
]
||
{})[
'request-timeout'
]),
headers
:
(
this
.
__opts__
[
'httpConf'
]
||
{})[
'headers'
]
||
{},
...
...
source/language/en.js
View file @
c2613581
...
...
@@ -176,6 +176,7 @@ module.exports = {
otherConf
:
{
nohttps
:
'Ignore HTTPS certificate'
,
usemultipart
:
'Use Multipart send payload'
,
addMassData
:
'Add garbage data in payload'
,
userandomvariable
:
'Use random English word variables'
,
chunk
:
{
title
:
'Chunked Transfer (Experimentally)'
,
...
...
source/language/zh.js
View file @
c2613581
...
...
@@ -179,6 +179,7 @@ module.exports = {
nohttps
:
'忽略HTTPS证书'
,
usemultipart
:
'使用 Multipart 发包'
,
userandomvariable
:
'使用随机英文单词变量'
,
addMassData
:
'增加垃圾数据'
,
chunk
:
{
title
:
'分块传输(实验性功能)'
,
usechunk
:
'开启分块传输发包'
,
...
...
source/language/zh_hk.js
View file @
c2613581
...
...
@@ -177,6 +177,7 @@ module.exports = {
otherConf
:
{
nohttps
:
'忽略HTTPS證書'
,
usemultipart
:
'使用 Multipart 發包'
,
addMassData
:
'增加垃圾數據'
,
userandomvariable
:
'使用隨機英文單詞變量'
,
chunk
:
{
title
:
'分塊傳輸(實驗性功能)'
,
...
...
source/language/zh_tw.js
View file @
c2613581
...
...
@@ -177,6 +177,7 @@ module.exports = {
otherConf
:
{
nohttps
:
'忽略HTTPS證書'
,
usemultipart
:
'使用 Multipart 發包'
,
addMassData
:
'增加垃圾數據'
,
userandomvariable
:
'使用隨機英文單詞變量'
,
chunk
:
{
title
:
'分塊傳輸(實驗性功能)'
,
...
...
source/modules/shellmanager/list/form.js
View file @
c2613581
...
...
@@ -466,6 +466,7 @@ class Form {
const
opt
=
Object
.
assign
({},
{
'ignore-https'
:
0
,
'use-multipart'
:
0
,
'add-MassData'
:
0
,
'use-random-variable'
:
0
,
'use-chunk'
:
0
,
'chunk-step-byte-min'
:
2
,
...
...
@@ -500,12 +501,17 @@ class Form {
name
:
'use-random-variable'
,
label
:
LANG
[
'list'
][
'otherConf'
][
'userandomvariable'
],
checked
:
opt
[
'use-random-variable'
]
===
1
},
{
type
:
"checkbox"
,
name
:
'add-MassData'
,
label
:
LANG
[
'list'
][
'otherConf'
][
'addMassData'
],
checked
:
opt
[
'add-MassData'
]
===
1
},
{
type
:
"checkbox"
,
name
:
'use-multipart'
,
label
:
LANG
[
'list'
][
'otherConf'
][
'usemultipart'
],
checked
:
opt
[
'use-multipart'
]
===
1
},
{
},{
type
:
'fieldset'
,
offsetLeft
:
0
,
label
:
LANG
[
'list'
][
'otherConf'
][
'chunk'
][
'title'
],
...
...
@@ -771,6 +777,10 @@ class Form {
if
(
state
==
true
&&
form
.
isItemChecked
(
'use-multipart'
))
{
form
.
uncheckItem
(
'use-multipart'
);
}
// case 'add-MassData':
// if (state == true && form.isItemChecked('add-MassData')) {
// form.uncheckItem('add-MassData');
// }
if
(
state
==
true
)
{
layer
.
open
({
title
:
LANG_T
[
'info'
],
...
...
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