84 lines
2.3 KiB
JavaScript
84 lines
2.3 KiB
JavaScript
let axios_config = require("./config")
|
||
import {ZeroCodeAxios} from "@/request/request"
|
||
|
||
const components = {}
|
||
|
||
const data = function () {
|
||
return {
|
||
scan_form: {
|
||
url: "",
|
||
cookie: "",
|
||
getCurrentDb: true,
|
||
getCurrentUser: true,
|
||
getDbs: true,
|
||
getTables: true,
|
||
getColumns: true
|
||
},
|
||
info_show: ""
|
||
}
|
||
}
|
||
|
||
function mounted() {
|
||
|
||
}
|
||
|
||
const methods = {
|
||
get_config_data(config_data) {
|
||
let new_data = config_data
|
||
new_data = this.format_data(config_data)
|
||
return new_data
|
||
},
|
||
format_data(dict) {
|
||
if (typeof dict == "string") {
|
||
dict = eval(dict)
|
||
} else {
|
||
for (const key in dict) {
|
||
let value = dict[key]
|
||
if (typeof value == "object") {
|
||
this.format_data(value)
|
||
} else {
|
||
if (typeof value == 'number') {
|
||
dict[key] = value
|
||
} else {
|
||
if (value.includes("this.")) {
|
||
if (dict.hasOwnProperty(key)) {
|
||
dict[key] = eval(value)
|
||
}
|
||
} else {
|
||
if (value.includes(".")) {
|
||
if (dict.hasOwnProperty(key)) {
|
||
dict[key] = eval(value)
|
||
}
|
||
} else {
|
||
dict[key] = value
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return dict
|
||
},
|
||
submit_sqlmap() {
|
||
const {url, method, data: originalData, then} = axios_config.submit_sqlmap.axios;
|
||
const data = JSON.parse(JSON.stringify(originalData));
|
||
let new_data = this.get_config_data(data)
|
||
// 发起请求
|
||
ZeroCodeAxios({
|
||
method,
|
||
url,
|
||
data: new_data,
|
||
}).then(res => {
|
||
// 执行回调函数(then回调)
|
||
eval(then)
|
||
this.info_show = JSON.stringify(this.info_show)
|
||
})
|
||
}
|
||
}
|
||
|
||
export default {
|
||
data: data,
|
||
methods: methods,
|
||
mounted: mounted,
|
||
components: components,
|
||
} |