diff --git a/public/index.html b/public/index.html index dff0c6d..758f8e0 100644 --- a/public/index.html +++ b/public/index.html @@ -4,11 +4,11 @@ - 靶场管理 + DNS diff --git a/src/views/menuSurrogateInformation/index.vue b/src/views/menuSurrogateInformation/index.vue index 0cebd20..ad628ea 100644 --- a/src/views/menuSurrogateInformation/index.vue +++ b/src/views/menuSurrogateInformation/index.vue @@ -1,32 +1,40 @@ @@ -375,19 +176,85 @@ import { highlight, languages } from 'prismjs/components/prism-core'; import 'prismjs/components/prism-clike'; import 'prismjs/components/prism-javascript'; - // import 'prismjs/themes/prism-solarizedlight.css'; // 代码的其他样式风格 - // import 'prismjs/themes/prism-coy.css'; - // import 'prismjs/themes/prism-tomorrow.css'; import 'prismjs/themes/prism.css'; // 如果想代码换个样式风格,把这个注释了,上面的三个放开一个 + import Header from './module/Header.vue' + export default { name: "imageMange", // props:['fTag','fInput','fFrom','FIsConfigQuery'], // components:{ // router // }, - components: { PrismEditor }, + components: { PrismEditor ,Header}, data(){ return{ + infoTable: [ + { + id: 1, + title: "用户ID", + value: 1, + }, + { + id: 2, + title: "微信昵称", + value:2, + }, + { + id: 3, + title: "会员名称", + value:3, + } + ], + info:[], + powerValue:'', + stateValue:'', + freeValue:'', + powerFilter:[ + { + value:'全部', + label:'全部' + }, + { + value:'渗透', + label:'渗透' + }, + { + value:'状态感知', + label:'状态感知' + }, + { + value:'参数感知', + label:'参数感知' + }, + ], + stateFilter:[ + { + value:'全部', + label:'全部' + }, + { + value:'在线', + label:'在线' + }, + { + value:'离线', + label:'离线' + }, + ], + freeFilter:[ + { + value:'全部', + label:'全部' + }, + { + value:'空闲', + label:'空闲' + }, + { + value:'执行中', + label:'执行中' + }, + ], file:'', image_id:0, addImage:{ @@ -427,7 +294,6 @@ code: '/**\n* JS判断两个数组是否相等\n* @param {Array} arr1\n* @param {Array} arr2\n* @returns {boolean} 返回true 或 false\n*/\nfunction arrayEqual(arr1, arr2) {\n if (arr1 === arr2) return true;\n if (arr1.length != arr2.length) return false;\n for (var i = 0; i < arr1.length; ++i) {\n if (arr1[i] !== arr2[i]) return false;\n }\n return true;\n}', infoType:"", tag:"基本配置", - tagStep:1, tableData:[], total:0, multipleSelection: [], @@ -449,19 +315,6 @@ radioOwnership2: '1', radioUpdateImage: '2', radioHowToCreate: '1', - options: [{ - value: '', - label: '全部镜像' - }, { - value: 'system', - label: '系统' - }, { - value: 'buildin', - label: '内置' - }, { - value: 'define', - label: '自定义' - }], delTimer: null, counter: 0 @@ -472,7 +325,8 @@ watch: { }, created() { - this.getImages() + // this.getImages() + this.query(); }, destroyed() { // if (this.pendingTimer) { @@ -486,6 +340,50 @@ this.counter = 0 }, methods:{ + formatIPs(row, column, cellValue) { + // let formattedIPs = cellValue.join(',\n'); + // return formattedIPs; + // 使用 map 方法处理每个 IP 地址,然后连接成带有换行符的字符串 + let formattedIPs = cellValue.map(ip => ip).join(',\n'); + + return formattedIPs; + + }, + query(){ + let data={ + "page":this.page, + "per_page":this.size, + "atype":this.powerValue==='参数感知'?'csgz':(this.powerValue==='状态感知'?'ztgz':(this.powerValue==='渗透'?'gjst':'all')), + "status":this.stateValue==='在线'?1:(this.stateValue==='离线'?0:2), + "idle":this.freeValue==='空闲'?1:(this.stateValue==='执行中'?0:2) + } + this.$axios.get(this.$http.api.agentQueryList,data).then(res=>{ + if(res.code===200){ + this.tableData=res.agent_data + this.total=res.total + } + }).catch(err=>{ + console.log(err) + }) + + + }, + agentdel(val){ + let data={ + "id":val.toString(), + } + this.$axios.post(this.$http.api.agentDel,data).then(res=>{ + if(res.code===200){ + this.$message.success(res.msg) + }else { + this.$message.error(res.msg) + } + }).catch(err=>{ + console.log(err) + }) + + + }, onFileChange(event) { this.file = event.target.files[0]; }, @@ -502,9 +400,6 @@ }, thereToOne(val){ - console.log("RRRRRRRRRRRRRRRRRRRRRRRRR") - console.log(val) - console.log("RRRRRRRRRRRRRRRRRRRRRRRRR") if(val==='tar'){ this.dockerOrTar='tar' }else { @@ -525,30 +420,14 @@ CustomizationImageFales(){ this.newlyPztj=false; document.querySelector('.mask').style.display = 'none' - this.image_id=0 - this.addImage=this.barkImageParmer - }, - customizationImage(val){ - this.tagStep=1; - this.tag="基本配置" - if(val!=null){ - this.image_id=val.id - this.addImage=val - this.infoImage(this.image_id); - this.thereToOne(val.define_image[0].establish_mode) - } - this.newlyPztj=true; - document.querySelector('.mask').style.display = 'block' - }, - getLabel(boolValue) { - return boolValue ? true: false; + // this.image_id=0 + // this.addImage=this.barkImageParmer }, buildImage(val){ let data={ "image_id":val, } this.$axios.get(this.$http.api.asyncBuildImage,data).then(res=>{ - console.log('getImages======',res) if(res.code===200){ this.CustomizationImageFales() @@ -578,7 +457,6 @@ "image_id":val, } this.$axios.get(this.$http.api.infoImage,data).then(res=>{ - console.log('getImages======',res) if(res.code===200){ this.addImage.git_account=res.result.pipeline.git_account; this.addImage.git_password=res.result.pipeline.git_password; @@ -598,7 +476,6 @@ "image_id":val, } this.$axios.delete(this.$http.api.delImage,data).then(res=>{ - console.log('getImages======',res) if(res.code===200){ this.image_id=0 this.getImages() @@ -630,7 +507,6 @@ // } }; this.$axios.put(this.$http.api.asyncUpdateImage, formData ,config).then(res=>{ - console.log('getImages======',res) if(res.code===200){ this.CustomizationImageFales() @@ -707,59 +583,37 @@ }) }, - updateAndQuery(){ - this.page=1; - this.getImages() - }, handleSizeChange(val) { console.log(`每页 ${val} 条`); this.size=val - this.getImages() + this.query() }, handleCurrentChange(val) { console.log(`当前页: ${val}`); this.page=val - this.getImages() + this.query() }, getImages(){ let data={ - // "image_name":"da", - "image_type":this.selectImageStateValue, - "image_name":this.queryByImageName, - "image_state":this.selectImageStateValue, - "page":this.page, - "size":this.size + } - this.$axios.get(this.$http.api.getImages,data).then(res=>{ + this.$axios.get(this.$http.api.agentQueryList,data).then(res=>{ console.log('getImages======',res) - if(res.code===200){ - this.tableData=res.result.items - this.total=res.result.total - } + // if(res.code===200){ + this.tableData=res.agent_data + this.total=100 + // } }).catch(err=>{ console.log(err) }) }, - selectImageState(){ - this.page=1 - console.log(this.selectImageStateValue) - this.getImages() - }, - NobuildingImage(){ - console.log("无需重新构建") - }, highlighter(code) { return highlight(code, languages.js) }, - getInfo(info){ + getInfo(val){ + this.info=val + this.newlyPztj=true document.querySelector('.mask').style.display = 'block' - this.addImage=info; - if(info.define_image[0].establish_mode==='tar'){ - this.infoType='tar' - }else if(info.define_image[0].establish_mode==='git' - || info.define_image[0].establish_mode==='code'){ - this.infoType='docker' - } }, updateTag(val){ this.tag=val @@ -768,19 +622,15 @@ this.multipleSelection = val; }, handleRemove(file, fileList) { - console.log("111111111") console.log(file, fileList); }, handlePreview(file) { - console.log("2222222222222") console.log(file); }, handleExceed(files, fileList) { - console.log("3333333333333") this.$notify.warning(`当前限制选择 1个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); }, beforeRemove(file, fileList) { - console.log("444444444444") return this.$confirm(`确定移除 ${ file.name }?`); }, // 获取任务进度 @@ -825,12 +675,42 @@ diff --git a/src/views/menuSysManagement/module/Header.vue b/src/views/menuSysManagement/module/Header.vue deleted file mode 100644 index 6f2014d..0000000 --- a/src/views/menuSysManagement/module/Header.vue +++ /dev/null @@ -1,89 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/menuTaskManagement/index.vue b/src/views/menuTaskManagement/index.vue index 4a67808..99fde51 100644 --- a/src/views/menuTaskManagement/index.vue +++ b/src/views/menuTaskManagement/index.vue @@ -4,6 +4,9 @@
+
+ 至少需要一个代理才能创建任务,每个代理同时只执行一项任务 +
+ prop="id" + label="任务编号" + width="280"/> + + @@ -56,7 +66,7 @@ background :current-page="page" :page-sizes="[10, 20, 30, 40]" - :page-size="10" + :page-size="20" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @@ -83,7 +93,7 @@ export default { data(){ return{ page: 1, - size: 10, + size: 20, total: 0, isAdd: false, loading: false, @@ -97,25 +107,22 @@ export default { }, watch: {}, created() { - this.getPermissionDict() this.init() }, methods:{ init(params={}) { - // this.tableData = getTargetsResponse?.result?.items - // this.total = getTargetsResponse?.result?.total - // TODO: 暂时注释接口 const reqParams = { - page: this.page, - size: this.size, + "page": this.page, + "per_page": this.size, ...params } this.loading = true - this.$axios.get(this.$http.api.getRoleList, reqParams).then(res => { - if (res.code == 200 || res.code == "OK") { - this.total = res?.result?.total - this.tableData = res?.result?.items + this.$axios.get(this.$http.api.taskList, reqParams).then(res => { + // if (res.code == 200 || res.code == "OK") { + // this.total = res?.data?.total + this.total = 100 + this.tableData = res?.data this.tableData.map(item => { item.permissions.map(permi => { this.$set(permi, 'delLoading', false) @@ -123,7 +130,7 @@ export default { }) return item }) - } + // } }).catch(err => { console.log(err) }).finally(() => { @@ -136,7 +143,7 @@ export default { // 打开添加角色dialog addRole() { this.isAdd = true - this.$refs.userForm.title = '新增角色' + // this.$refs.userForm.title = '新增角色' document.querySelector('.mask').style.display = 'block' this.$refs.userForm.visible = true }, @@ -160,18 +167,18 @@ export default { }) }, // 删除 - del(row) { - this.$confirm('此操作将永久删除该角色, 是否继续?', '确认删除', { - confirmButtonText: '确认删除', - cancelButtonText: '取消', - type: 'info' - }).then(() => { - this.delUser(row) - }).catch(() => { - this.$notify({ - type: 'info', - message: '已取消删除' - }) + del(id) { + let data={ + "id":id, + } + this.$axios.post(this.$http.api.taskDel,data).then(res=>{ + if(res.code===200){ + this.$message.success(res.msg) + }else { + this.$message.error(res.msg) + } + }).catch(err=>{ + console.log(err) }) }, delUser(row) { @@ -192,16 +199,9 @@ export default { row.delLoading = false }) }, - // 修改 - edit(row) { - this.isAdd = false - this.$refs.userForm.title = '修改权限' - this.$refs.userForm.role_id = row.id - this.$refs.userForm.form.role_name = row.role_name - this.$refs.userForm.form.permissions = row.permissions.map(permission => permission.id) - this.getPermissionDict() - document.querySelector('.mask').style.display = 'block' - this.$refs.userForm.visible = true + // 详情 + taskInfo(val) { + this.$router.push({ path: 'menuTaskInfo', query: { row: val } }); }, // 获取权限字典 getPermissionDict() { @@ -241,6 +241,110 @@ export default {