diff --git a/angular.json b/angular.json
index 0e5f196..d739638 100644
--- a/angular.json
+++ b/angular.json
@@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
- "notice": {
+ "uebaMetricsAnalysis": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
@@ -21,7 +21,7 @@
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
- "outputPath": "dist/notice",
+ "outputPath": "dist/uebaMetricsAnalysis",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
@@ -82,18 +82,18 @@
"serve": {
"builder": "@angular-builders/dev-server:generic",
"options": {
- "browserTarget": "notice:build"
+ "browserTarget": "uebaMetricsAnalysis:build"
},
"configurations": {
"production": {
- "browserTarget": "notice:build:production"
+ "browserTarget": "uebaMetricsAnalysis:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
- "browserTarget": "notice:build"
+ "browserTarget": "uebaMetricsAnalysis:build"
}
},
"test": {
@@ -127,7 +127,7 @@
}
}
},
- "notice-e2e": {
+ "uebaMetricsAnalysis-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
@@ -136,11 +136,11 @@
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
- "devServerTarget": "notice:serve"
+ "devServerTarget": "uebaMetricsAnalysis:serve"
},
"configurations": {
"production": {
- "devServerTarget": "notice:serve:production"
+ "devServerTarget": "uebaMetricsAnalysis:serve:production"
}
}
},
@@ -156,5 +156,5 @@
}
}
},
- "defaultProject": "notice"
+ "defaultProject": "uebaMetricsAnalysis"
}
\ No newline at end of file
diff --git a/extra-webpack.config.js b/extra-webpack.config.js
index b2b457b..a404e62 100644
--- a/extra-webpack.config.js
+++ b/extra-webpack.config.js
@@ -7,7 +7,7 @@ module.exports = (angularWebpackConfig, options) => {
output: {
library: `${name}-[name]`,
libraryTarget: 'umd',
- publicPath: process.env.NODE_ENV == 'prod' ? '/WebApi/notice/static/dist/' : 'http://localhost:4203/'
+ publicPath: process.env.NODE_ENV == 'prod' ? '/WebApi/uebaMetricsAnalysis/static/dist/' : 'http://localhost:4203/'
},
diff --git a/package-lock.json b/package-lock.json
index 1fb66dc..4ce0ffe 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "notice",
+ "name": "uebaMetricsAnalysis",
"version": "0.0.0",
"lockfileVersion": 1,
"requires": true,
diff --git a/package.json b/package.json
index c24716f..c77f533 100644
--- a/package.json
+++ b/package.json
@@ -1,10 +1,10 @@
{
- "name": "notice",
+ "name": "uebaMetricsAnalysis",
"version": "0.0.0",
"scripts": {
"ng": "ng",
- "start": "ng serve notice --host 0.0.0.0 --disable-host-check --port 4203 --open --proxy-config proxy.conf.js",
- "build": "set NODE_ENV=prod&& ng build notice --aot --output-path dist/ --deploy-url /WebApi/notice/static/dist/ --base-href /WebApi/notice/static/dist/ --prod",
+ "start": "ng serve uebaMetricsAnalysis --host 0.0.0.0 --disable-host-check --port 4203 --open --proxy-config proxy.conf.js",
+ "build": "set NODE_ENV=prod&& ng build uebaMetricsAnalysis --aot --output-path dist/ --deploy-url /WebApi/uebaMetricsAnalysis/static/dist/ --base-href /WebApi/uebaMetricsAnalysis/static/dist/ --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index fc9c1d4..03b3233 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -13,7 +13,7 @@ const routes: Routes = [
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule],
providers: [
- { provide: APP_BASE_HREF, useValue: (window as any).__POWERED_BY_QIANKUN__ ? '/notice' : '/' },
+ { provide: APP_BASE_HREF, useValue: (window as any).__POWERED_BY_QIANKUN__ ? '/uebaMetricsAnalysis' : '/' },
]
})
export class AppRoutingModule { }
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index d8841e9..abf4eab 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -28,7 +28,7 @@ export class AppComponent implements OnInit {
if (!this.prefixRouter) {
this.prefixRouter = await this.configService.translatePrefix();
}
- const appName = '/notice';
+ const appName = '/uebaMetricsAnalysis';
const prefix = this.configService.getUrlPrefix(this.prefixRouter, appName);
document.title = prefix ? prefix : '绿盟智能安全运营平台';
}
diff --git a/src/app/routes/config/layout/manage/manage.component.html b/src/app/routes/config/layout/manage/manage.component.html
index 4285227..2fb79ae 100644
--- a/src/app/routes/config/layout/manage/manage.component.html
+++ b/src/app/routes/config/layout/manage/manage.component.html
@@ -1,4 +1,5 @@
+
-
-
-
+
+
+
+
归属单位 |
@@ -43,18 +45,18 @@
"ip_reat": 0.3,
"ip_avg": 0.43,
"trend": 0.3 -->
- {{ data.company }} |
+ {{data.company}} |
{{ data.req_frequency }} |
- {{ data.frequency_rate }} |
+ {{ data.frequency_rate| percent: '1.1-2' }} |
{{ data.ip_count }} |
- {{ data.ip_reat }} |
- {{ data.ip_avg }} |
- {{ data.trend }} |
+ {{ data.ip_rate| percent: '1.1-2' }} |
+ {{ data.ip_avg| number: '1.2-2' }} |
+ {{ data.trend| percent: '1.1-2' }} |
-
+
归属单位 |
@@ -75,18 +77,18 @@
"account_reat": 0.3,
"account_avg": 0.43,
"trend": 0.3 -->
- {{ data.company }} |
+ {{data.company}} |
{{ data.req_frequency }} |
- {{ data.frequency_rate }} |
+ {{ data.frequency_rate| percent: '1.1-2' }} |
{{ data.account_count }} |
- {{ data.account_reat }} |
- {{ data.account_avg }} |
- {{ data.trend }} |
+ {{ data.account_rate| percent: '1.1-2' }} |
+ {{ data.account_avg| number: '1.2-2' }} |
+ {{ data.trend| percent: '1.1-2' }} |
-
+
接口地址 |
@@ -103,15 +105,16 @@
"frequency_rate": 0.160727824109174,
"frequency_avg": 0,
"trend": 0.07 -->
- {{ data.interface_addr }} |
+ {{ data.interface_addr }} |
{{ data.req_frequency }} |
- {{ data.frequency_avg }} |
- {{ data.trend }} |
+ {{ data.frequency_rate | percent: '1.1-2' }} |
+ {{ data.frequency_avg| number: '1.2-2' }} |
+ {{ data.trend| percent: '1.1-2' }} |
-
+
菜单名称 |
@@ -128,18 +131,22 @@
"frequency_rate": 0.263449367088608,
"frequency_avg": 111,
"trend": 0.09 -->
- {{ data.menu_name }} |
+ {{ data.menu_name }} |
{{ data.req_frequency }} |
- {{ data.frequency_avg }} |
- {{ data.trend }} |
+ {{ data.frequency_rate| percent: '1.1-2' }} |
+ {{ data.frequency_avg| number: '1.2-2'}} |
+ {{ data.trend| percent: '1.1-2' }} |
+
+
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/app/routes/config/layout/manage/manage.component.styl b/src/app/routes/config/layout/manage/manage.component.styl
index a68a1f5..ab1c4c7 100644
--- a/src/app/routes/config/layout/manage/manage.component.styl
+++ b/src/app/routes/config/layout/manage/manage.component.styl
@@ -32,4 +32,4 @@
.ant-select{
width 100px
}
-}
\ No newline at end of file
+}
diff --git a/src/app/routes/config/layout/manage/manage.component.ts b/src/app/routes/config/layout/manage/manage.component.ts
index 60839ca..a2feeaf 100644
--- a/src/app/routes/config/layout/manage/manage.component.ts
+++ b/src/app/routes/config/layout/manage/manage.component.ts
@@ -1,88 +1,1028 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit,Injectable } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { NoticeService } from '../../service/https/notice.service';
import { CacheService } from '../../service/cache/cache.service';
+import { PathComponent } from './path/path.component';
+import { ProcessComponent } from './process/process.component';
+import { Subscription } from 'rxjs';
+import { exportAsExcelFile, convertKeys } from './utils/utils';
+// data mapping
+// IP
+const ipKeyMaps = {
+ 'company': '归属单位',
+ 'req_frequency': '访问频次',
+ 'frequency_rate': '频次占比',
+ 'ip_count': 'IP计数',
+ 'ip_rate': 'IP占比',
+ 'ip_avg': 'IP均值',
+ 'trend': '访问趋势',
+};
+const accountKeyMaps = {
+ 'company': '归属单位',
+ 'req_frequency': '访问频次',
+ 'frequency_rate': '频次占比',
+ 'account_count': 'IP计数',
+ 'account_rate': 'IP占比',
+ 'account_avg': 'IP均值',
+ 'trend': '访问趋势',
+};
+const interfaceKeyMaps = {
+ 'interface_addr': '接口地址',
+ 'req_frequency': '访问频次',
+ 'frequency_rate': '频次占比',
+ 'frequency_avg': '频次均值',
+ 'trend': '访问趋势',
+};
+
+const menuKeyMaps = {
+ 'menu_name': '菜单名称',
+ 'req_frequency': '访问频次',
+ 'frequency_rate': '频次占比',
+ 'frequency_avg': '频次均值',
+ 'trend': '访问趋势',
+};
@Component({
selector: 'app-manage',
templateUrl: './manage.component.html',
styleUrls: ['./manage.component.styl']
})
+
+@Injectable({
+ providedIn: 'root'
+ })
+
export class ManageComponent implements OnInit {
+ summary_detal_data :any;
+ tableisShow :any;
dateFormat = 'yyyy/MM/dd HH:mm:ss'
+ submitLoading = false;
+ logLoading = false;
dateRange = []
listOfData = []
iphead = []
dimension = '1'
isVisible = false
+ detail_data : any;
+ destroySubscriptions: Subscription[] = [];
+ exportIsVisable = true;
constructor(
private noticeService: NoticeService,
public message: NzMessageService,
public cache: CacheService
) { }
- onSubmit(){
- this.isVisible = true
- console.log(123)
+ private getAnalysisResult(startDate,endDate,queryDates){ // 获取es的查询最大日期范围
+ this.noticeService.getQueryRange().subscribe(resp => {
+ console.log("resp.retcode"+resp.retcode);
+ if (resp.retcode === 200) {
+ console.log(resp.data.query_range);
+ if (queryDates >resp.data.query_range ){
+ alert('查询范围不能超过'+resp.data.query_range+'天');
+ return;
+ }else{
+ this.submitLoading = true;
+ this.noticeService.getUebaResult({"type":this.dimension,"startDate":startDate,"endDate":endDate}).subscribe(resp => {
+ this.listOfData = [];
+ if (resp.code === 200) {
+ this.summary_detal_data = resp
+ switch(this.dimension.toString()){
+ case "1":
+ this.listOfData = resp.data.summary.ip;
+ break;
+ case "2":
+ this.listOfData = resp.data.summary.account;
+ break;
+ case "3":
+ this.listOfData = resp.data.summary.interface;
+ break;
+ case "4":
+ this.listOfData = resp.data.summary.menu;
+ break;
+ }
+ }
+ this.tableisShow = this.dimension;
+ this.submitLoading = false;
+ if(this.tableisShow!=undefined){
+ this.exportIsVisable = false;
+ }
+ },
+ error => {
+ this.message.error('服务器错误');
+ this.submitLoading = false;
+ })
+ // this.tableisShow = this.dimension;
+ //this.submitLoading = false;
+ }
+ }else{
+ return undefined;
+ }
+ },
+ error => {
+ this.message.error('服务器错误');
+ })
+ }
+
- console.log(this.dimension)
- console.log("Selected Date Range: ", this.dateRange);
+
+ private querySubmit(){
+ var startDate :any;
+ var endDate :any;
if (this.dateRange.length === 2) {
- const startDate = this.dateRange[0];
- const endDate = this.dateRange[1];
- console.log(startDate);
-
- alert(`Selected Date Range: ${startDate.toLocaleDateString()} - ${endDate.toLocaleDateString()}`);
-
+ startDate = this.dateRange[0];
+ endDate = this.dateRange[1];
} else {
- alert('Please select a date range.');
+ alert('请选择查询范围');
+ return;
}
- this.noticeService.getQueryRange().subscribe(resp => {
- if (resp.status === 200) {
- console.log(resp.data);
- } else {
- this.message.error(resp.msg);
- }
- },
- error => {
- this.message.error('服务器错误');
- })
+ let timeDiff = Math.abs(endDate.getTime() - startDate.getTime());
+ let diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
+
+ this.getAnalysisResult(startDate,endDate,diffDays)
+ }
+ onSubmit(){
+ this.querySubmit();
}
ngOnInit() {
const now = new Date();
const oneWeekAgo = new Date();
oneWeekAgo.setDate(now.getDate() - 7);
-
this.dateRange = [oneWeekAgo, now];
+ //this.onSubmit()
}
- getMenuItem(e) {
- console.log(e.el.dataset.id);
- // this.key = e.el.dataset.id;
+
+ exportExcel(){
+ var keysMap :any;
+ var fileName = "";
+ switch(this.dimension){
+ case "1":
+ keysMap= ipKeyMaps;
+ fileName="ip维度"
+ break;
+ case "2":
+ keysMap= accountKeyMaps;
+ fileName="账号维度"
+ break;
+ case "3":
+ keysMap= interfaceKeyMaps;
+ fileName="接口维度"
+ break;
+ case "4":
+ keysMap= menuKeyMaps;
+ fileName="菜单维度"
+ break;
+ }
+ console.log(JSON.stringify(keysMap));
+ var data =convertKeys(this.listOfData,keysMap)
+ exportAsExcelFile(data,fileName);
+ }
+
+ showModel(data){
+ var tmpdata :any;
+ if(this.summary_detal_data != undefined){
+ switch(data.type){
+ case 1:
+ tmpdata=this.summary_detal_data.data.detail.ip[data.key];
+ break;
+ case 2 :
+ tmpdata=this.summary_detal_data.data.detail.account[data.key];
+ break;
+ case 3 :
+ tmpdata=this.summary_detal_data.data.detail.interface[data.key];
+ break;
+ case 4 :
+ tmpdata=this.summary_detal_data.data.detail.menu[data.key];
+ break;
+ }
+ var diagData = {
+ "type": data.type,
+ "startTime": Math.floor(this.dateRange[0].getTime() / 1000),
+ "endTime": Math.floor(this.dateRange[1].getTime() / 1000),
+ [data.key]: tmpdata
+ }
+
+ this.detail_data = diagData;
+ console.log(JSON.stringify(this.detail_data));
+ this.isVisible=true;
+ }
}
- selectValChange(){
- console.log("xxxx"+this.dimension)
-
- this.noticeService.getUebaResult(this.dimension).subscribe(resp => {
- if (resp.status === 200) {
- switch(this.dimension.toString()){
- case "1":
- this.listOfData = resp["summary"]["ip"];
- case "2":
- this.listOfData = resp["summary"]["account"];
- case "3":
- this.listOfData = resp["summary"]["interface"];
- case "4":
- this.listOfData = resp["summary"]["menu"];
+ cancelSearch(): void {
+ this.submitLoading = false;
+ this.logLoading = false;
+
+ this.destroySubscriptions.forEach(subscription => {
+ if (subscription) {
+ subscription.unsubscribe();
}
- } else {
- this.message.error(resp.msg);
+ });
+}
+
+mockData={
+ "message": "success",
+ "code": 0,
+ "data": {
+ "detail": {
+ "interface": {
+ "http://190.89.233.2:8909/getUser": [
+ {
+ "req_ip": "192.156.3.12",
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "req_jobnum": 54411,
+ "req_frequency": 23,
+ "req_account": "zhangq"
+ },
+ {
+ "req_ip": "192.156.3.12",
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "req_jobnum": 54412,
+ "req_frequency": 24,
+ "req_account": "huqx"
+ },
+ {
+ "req_ip": "192.156.3.13",
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "req_jobnum": 54413,
+ "req_frequency": 25,
+ "req_account": "zhangsf"
+ },
+ {
+ "req_ip": "192.156.3.14",
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "req_jobnum": 54414,
+ "req_frequency": 26,
+ "req_account": "zhaoj"
+ },
+ {
+ "req_ip": "192.156.3.15",
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "req_jobnum": 54415,
+ "req_frequency": 27,
+ "req_account": "sangdq"
+ },
+ {
+ "req_ip": "192.156.3.16",
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "req_jobnum": 54416,
+ "req_frequency": 28,
+ "req_account": "hujt"
+ },
+ {
+ "req_ip": "192.156.3.17",
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "req_jobnum": 43325,
+ "req_frequency": 29,
+ "req_account": "zhangs"
+ },
+ {
+ "req_ip": "192.156.3.18",
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "req_jobnum": 43326,
+ "req_frequency": 30,
+ "req_account": "lin"
+ }
+ ],
+ "http://190.89.233.2:8909/update/sysconfig": [
+ {
+ "req_ip": "192.106.3.35",
+ "interface_addr": "http://190.89.233.2:8909/update/sysconfig",
+ "req_jobnum": 54415,
+ "req_frequency": 34,
+ "req_account": "zhangsf"
+ },
+ {
+ "req_ip": "192.106.3.36",
+ "interface_addr": "http://190.89.233.2:8909/update/sysconfig",
+ "req_jobnum": 54416,
+ "req_frequency": 23,
+ "req_account": "zhaoj"
+ },
+ {
+ "req_ip": "192.106.3.37",
+ "interface_addr": "http://190.89.233.2:8909/update/sysconfig",
+ "req_jobnum": 43325,
+ "req_frequency": 78,
+ "req_account": "sangdq"
+ },
+ {
+ "req_ip": "192.146.3.38",
+ "interface_addr": "http://190.89.233.2:8910/update/sysconfig",
+ "req_jobnum": 43326,
+ "req_frequency": 79,
+ "req_account": "hujt"
+ },
+ {
+ "req_ip": "192.146.3.39",
+ "interface_addr": "http://190.89.233.2:8911/update/sysconfig",
+ "req_jobnum": 43327,
+ "req_frequency": 80,
+ "req_account": "zhangs"
+ },
+ {
+ "req_ip": "192.146.3.40",
+ "interface_addr": "http://190.89.233.2:8912/update/sysconfig",
+ "req_jobnum": 43328,
+ "req_frequency": 81,
+ "req_account": "lin"
+ },
+ {
+ "req_ip": "192.146.3.41",
+ "interface_addr": "http://190.89.233.2:8913/update/sysconfig",
+ "req_jobnum": 65341,
+ "req_frequency": 82,
+ "req_account": "liuhr"
+ },
+ {
+ "req_ip": "192.146.3.42",
+ "interface_addr": "http://190.89.233.2:8914/update/sysconfig",
+ "req_jobnum": 65342,
+ "req_frequency": 83,
+ "req_account": "sunxq01"
+ },
+ {
+ "req_ip": "192.146.3.43",
+ "interface_addr": "http://190.89.233.2:8915/update/sysconfig",
+ "req_jobnum": 65343,
+ "req_frequency": 84,
+ "req_account": "xiaod01"
+ },
+ {
+ "req_ip": "192.146.3.44",
+ "interface_addr": "http://190.89.233.2:8916/update/sysconfig",
+ "req_jobnum": 98761,
+ "req_frequency": 85,
+ "req_account": "qingsx"
+ },
+ {
+ "req_ip": "192.146.3.45",
+ "interface_addr": "http://190.89.233.2:8917/update/sysconfig",
+ "req_jobnum": 98761,
+ "req_frequency": 86,
+ "req_account": "guobg"
+ },
+ {
+ "req_ip": "192.146.3.46",
+ "interface_addr": "http://190.89.233.2:8918/update/sysconfig",
+ "req_jobnum": 98761,
+ "req_frequency": 87,
+ "req_account": "zhangq"
+ }
+ ],
+ "http://190.89.233.2:8909/getpublicconfig": [
+ {
+ "req_ip": "192.156.3.12",
+ "interface_addr": "http://190.89.233.2:8909/getpublicconfig",
+ "req_jobnum": 43327,
+ "req_frequency": 43,
+ "req_account": "liuhr"
+ },
+ {
+ "req_ip": "192.156.3.12",
+ "interface_addr": "http://190.89.233.2:8909/getpublicconfig",
+ "req_jobnum": 43328,
+ "req_frequency": 44,
+ "req_account": "sunxq01"
+ },
+ {
+ "req_ip": "192.156.3.18",
+ "interface_addr": "http://190.89.233.2:8909/getpublicconfig",
+ "req_jobnum": 65341,
+ "req_frequency": 45,
+ "req_account": "shicl"
+ },
+ {
+ "req_ip": "192.106.3.33",
+ "interface_addr": "http://190.89.233.2:8909/getpublicconfig",
+ "req_jobnum": 65342,
+ "req_frequency": 46,
+ "req_account": "gongxs"
+ },
+ {
+ "req_ip": "192.106.3.34",
+ "interface_addr": "http://190.89.233.2:8909/getpublicconfig",
+ "req_jobnum": 65343,
+ "req_frequency": 47,
+ "req_account": "sunzs"
+ }
+ ]
+ },
+ "ip": {
+ "省公司": [
+ {
+ "req_ip": "192.146.3.38",
+ "req_frequency": 123
+ },
+ {
+ "req_ip": "192.146.3.39",
+ "req_frequency": 124
+ },
+ {
+ "req_ip": "192.146.3.40",
+ "req_frequency": 125
+ },
+ {
+ "req_ip": "192.146.3.41",
+ "req_frequency": 126
+ },
+ {
+ "req_ip": "192.146.3.42",
+ "req_frequency": 127
+ },
+ {
+ "req_ip": "192.146.3.43",
+ "req_frequency": 128
+ },
+ {
+ "req_ip": "192.146.3.44",
+ "req_frequency": 129
+ },
+ {
+ "req_ip": "192.146.3.45",
+ "req_frequency": 130
+ },
+ {
+ "req_ip": "192.146.3.46",
+ "req_frequency": 131
+ },
+ {
+ "req_ip": "192.146.3.47",
+ "req_frequency": 132
+ }
+ ],
+ "孝感分公司": [
+ {
+ "req_ip": "192.126.3.24",
+ "req_frequency": 54
+ },
+ {
+ "req_ip": "192.126.3.25",
+ "req_frequency": 55
+ },
+ {
+ "req_ip": "192.126.3.26",
+ "req_frequency": 56
+ },
+ {
+ "req_ip": "192.126.3.27",
+ "req_frequency": 57
+ },
+ {
+ "req_ip": "192.126.3.28",
+ "req_frequency": 58
+ },
+ {
+ "req_ip": "192.126.3.29",
+ "req_frequency": 59
+ },
+ {
+ "req_ip": "192.106.3.30",
+ "req_frequency": 60
+ }
+ ],
+ "黄冈分公司": [
+ {
+ "req_ip": "192.106.3.30",
+ "req_frequency": 51
+ },
+ {
+ "req_ip": "192.106.3.31",
+ "req_frequency": 52
+ },
+ {
+ "req_ip": "192.106.3.32",
+ "req_frequency": 53
+ },
+ {
+ "req_ip": "192.106.3.33",
+ "req_frequency": 54
+ },
+ {
+ "req_ip": "192.106.3.34",
+ "req_frequency": 55
+ },
+ {
+ "req_ip": "192.106.3.35",
+ "req_frequency": 56
+ },
+ {
+ "req_ip": "192.106.3.36",
+ "req_frequency": 57
+ },
+ {
+ "req_ip": "192.106.3.37",
+ "req_frequency": 58
+ },
+ {
+ "req_ip": "192.106.3.38",
+ "req_frequency": 59
+ }
+ ],
+ "随州分公司": [
+ {
+ "req_ip": "192.116.3.24",
+ "req_frequency": 44
+ },
+ {
+ "req_ip": "192.116.3.25",
+ "req_frequency": 45
+ },
+ {
+ "req_ip": "192.116.3.26",
+ "req_frequency": 46
+ },
+ {
+ "req_ip": "192.116.3.27",
+ "req_frequency": 47
+ },
+ {
+ "req_ip": "192.116.3.28",
+ "req_frequency": 48
+ },
+ {
+ "req_ip": "192.116.3.29",
+ "req_frequency": 49
+ },
+ {
+ "req_ip": "192.116.3.30",
+ "req_frequency": 50
+ }
+ ],
+ "宜昌分公司": [
+ {
+ "req_ip": "192.156.3.11",
+ "req_frequency": 22
+ },
+ {
+ "req_ip": "192.156.3.12",
+ "req_frequency": 12
+ },
+ {
+ "req_ip": "192.156.3.19",
+ "req_frequency": 78
+ },
+ {
+ "req_ip": "192.156.3.20",
+ "req_frequency": 79
+ },
+ {
+ "req_ip": "192.156.3.21",
+ "req_frequency": 80
+ },
+ {
+ "req_ip": "192.156.3.22",
+ "req_frequency": 81
+ },
+ {
+ "req_ip": "192.156.3.23",
+ "req_frequency": 82
+ },
+ {
+ "req_ip": "192.156.3.24",
+ "req_frequency": 83
+ }
+ ]
+ },
+ "account": {
+ "省公司": [
+ {
+ "req_jobnum": 98761,
+ "req_frequency": 37,
+ "req_account": "maoxt"
+ },
+ {
+ "req_jobnum": 98761,
+ "req_frequency": 29,
+ "req_account": "xiaod01"
+ },
+ {
+ "req_jobnum": 98761,
+ "req_frequency": 71,
+ "req_account": "qingsx"
+ },
+ {
+ "req_jobnum": 98761,
+ "req_frequency": 79,
+ "req_account": "guobg"
+ }
+ ],
+ "孝感分公司": [
+ {
+ "req_jobnum": 43325,
+ "req_frequency": 98,
+ "req_account": "zhangs"
+ },
+ {
+ "req_jobnum": 43326,
+ "req_frequency": 43,
+ "req_account": "lin"
+ },
+ {
+ "req_jobnum": 43327,
+ "req_frequency": 33,
+ "req_account": "liuhr"
+ },
+ {
+ "req_jobnum": 43328,
+ "req_frequency": 51,
+ "req_account": "sunxq01"
+ }
+ ],
+ "黄冈分公司": [
+ {
+ "req_jobnum": 65341,
+ "req_frequency": 47,
+ "req_account": "shicl"
+ },
+ {
+ "req_jobnum": 65342,
+ "req_frequency": 65,
+ "req_account": "gongxs"
+ },
+ {
+ "req_jobnum": 65343,
+ "req_frequency": 54,
+ "req_account": "sunzs"
+ }
+ ],
+ "随州分公司": [
+ {
+ "req_jobnum": 54415,
+ "req_frequency": 36,
+ "req_account": "sangdq"
+ },
+ {
+ "req_jobnum": 54416,
+ "req_frequency": 37,
+ "req_account": "hujt"
+ }
+ ],
+ "宜昌分公司": [
+ {
+ "req_jobnum": 54412,
+ "req_frequency": 33,
+ "req_account": "huqx"
+ },
+ {
+ "req_jobnum": 54413,
+ "req_frequency": 34,
+ "req_account": "zhangsf"
+ },
+ {
+ "req_jobnum": 54414,
+ "req_frequency": 35,
+ "req_account": "zhaoj"
+ }
+ ]
+ },
+ "menu": {
+ "菜单1": [
+ {
+ "menu_name": "菜单1",
+ "req_ip": "192.106.3.32",
+ "req_jobnum": "43326",
+ "req_frequency": 53,
+ "req_account": "lin"
+ },
+ {
+ "menu_name": "菜单1",
+ "req_ip": "192.106.3.33",
+ "req_jobnum": "43327",
+ "req_frequency": 54,
+ "req_account": "liuhr"
+ },
+ {
+ "menu_name": "菜单1",
+ "req_ip": "192.106.3.34",
+ "req_jobnum": "43328",
+ "req_frequency": 55,
+ "req_account": "sunxq01"
+ },
+ {
+ "menu_name": "菜单1",
+ "req_ip": "192.106.3.35",
+ "req_jobnum": "65341",
+ "req_frequency": 56,
+ "req_account": "shicl"
+ },
+ {
+ "menu_name": "菜单1",
+ "req_ip": "192.106.3.36",
+ "req_jobnum": "65342",
+ "req_frequency": 57,
+ "req_account": "gongxs"
+ },
+ {
+ "menu_name": "菜单1",
+ "req_ip": "192.106.3.37",
+ "req_jobnum": "65343",
+ "req_frequency": 58,
+ "req_account": "sunzs"
+ }
+ ],
+ "菜单2": [
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.12",
+ "req_jobnum": "54411",
+ "req_frequency": 31,
+ "req_account": "zhangq"
+ },
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.12",
+ "req_jobnum": "54412",
+ "req_frequency": 32,
+ "req_account": "huqx"
+ },
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.13",
+ "req_jobnum": "54413",
+ "req_frequency": 33,
+ "req_account": "zhangsf"
+ },
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.14",
+ "req_jobnum": "54414",
+ "req_frequency": 34,
+ "req_account": "zhaoj"
+ },
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.15",
+ "req_jobnum": "54415",
+ "req_frequency": 35,
+ "req_account": "sangdq"
+ },
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.16",
+ "req_jobnum": "54416",
+ "req_frequency": 36,
+ "req_account": "hujt"
+ },
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.17",
+ "req_jobnum": "43325",
+ "req_frequency": 37,
+ "req_account": "zhangs"
+ },
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.18",
+ "req_jobnum": "43326",
+ "req_frequency": 38,
+ "req_account": "lin"
+ },
+ {
+ "menu_name": "菜单2",
+ "req_ip": "192.156.3.12",
+ "req_jobnum": "43327",
+ "req_frequency": 39,
+ "req_account": "liuhr"
+ }
+ ],
+ "菜单3": [
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.106.3.33",
+ "req_jobnum": "65342",
+ "req_frequency": 51,
+ "req_account": "gongxs"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.106.3.34",
+ "req_jobnum": "65343",
+ "req_frequency": 52,
+ "req_account": "sunzs"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.106.3.35",
+ "req_jobnum": "54415",
+ "req_frequency": 53,
+ "req_account": "zhangsf"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.106.3.36",
+ "req_jobnum": "54416",
+ "req_frequency": 54,
+ "req_account": "zhaoj"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.106.3.37",
+ "req_jobnum": "43325",
+ "req_frequency": 55,
+ "req_account": "sangdq"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.146.3.38",
+ "req_jobnum": "43326",
+ "req_frequency": 56,
+ "req_account": "hujt"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.146.3.39",
+ "req_jobnum": "43327",
+ "req_frequency": 57,
+ "req_account": "zhangs"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.146.3.40",
+ "req_jobnum": "43328",
+ "req_frequency": 58,
+ "req_account": "lin"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.146.3.41",
+ "req_jobnum": "65341",
+ "req_frequency": 59,
+ "req_account": "liuhr"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.146.3.42",
+ "req_jobnum": "65342",
+ "req_frequency": 60,
+ "req_account": "sunxq01"
+ },
+ {
+ "menu_name": "菜单3",
+ "req_ip": "192.146.3.43",
+ "req_jobnum": "65343",
+ "req_frequency": 61,
+ "req_account": "xiaod01"
+ }
+ ]
+ }
+ },
+ "summary": {
+ "interface": [
+ {
+ "trend": 0.07,
+ "frequency_avg": 0,
+ "interface_addr": "http://190.89.233.2:8909/getUser",
+ "frequency_rate": 0.160727824109174,
+ "req_frequency": 212
+ },
+ {
+ "trend": 0.02,
+ "frequency_avg": 0,
+ "interface_addr": "http://190.89.233.2:8909/getpublicconfig",
+ "frequency_rate": 0.170583775587566,
+ "req_frequency": 225
+ },
+ {
+ "trend": -0.09,
+ "frequency_avg": 0,
+ "interface_addr": "http://190.89.233.2:8909/update/sysconfig",
+ "frequency_rate": 0.66868840030326,
+ "req_frequency": 882
+ }
+ ],
+ "ip": [
+ {
+ "trend": 0.09,
+ "company": "宜昌分公司",
+ "ip_rate": 0.195121951219512,
+ "ip_count": 8,
+ "ip_avg": 2.14344941956882,
+ "req_frequency": 517,
+ "frequency_rate": 17.1475953565506
+ },
+ {
+ "trend": 0.1,
+ "company": "随州分公司",
+ "ip_rate": 0.170731707317073,
+ "ip_count": 7,
+ "ip_avg": 1.55887230514096,
+ "req_frequency": 329,
+ "frequency_rate": 10.9121061359867
+ },
+ {
+ "trend": -0.07,
+ "company": "孝感分公司",
+ "ip_rate": 0.170731707317073,
+ "ip_count": 7,
+ "ip_avg": 1.89054726368159,
+ "req_frequency": 399,
+ "frequency_rate": 13.2338308457711
+ },
+ {
+ "trend": -0.02,
+ "company": "黄冈分公司",
+ "ip_rate": 0.219512195121951,
+ "ip_count": 9,
+ "ip_avg": 1.82421227197347,
+ "req_frequency": 495,
+ "frequency_rate": 16.4179104477612
+ },
+ {
+ "trend": 0.1,
+ "company": "省公司",
+ "ip_rate": 0.24390243902439,
+ "ip_count": 10,
+ "ip_avg": 4.22885572139304,
+ "req_frequency": 1275,
+ "frequency_rate": 42.2885572139304
+ }
+ ],
+ "account": [
+ {
+ "account_rate": 0.242424242424242,
+ "account_avg": 2.46323529411765,
+ "trend": 0.09,
+ "company": "宜昌分公司",
+ "req_frequency": 134,
+ "account_count": 8,
+ "frequency_rate": 19.7058823529412
+ },
+ {
+ "account_rate": 0.212121212121212,
+ "account_avg": 1.53361344537815,
+ "trend": 0.1,
+ "company": "随州分公司",
+ "req_frequency": 73,
+ "account_count": 7,
+ "frequency_rate": 10.7352941176471
+ },
+ {
+ "account_rate": 0.212121212121212,
+ "account_avg": 4.72689075630252,
+ "trend": -0.07,
+ "company": "孝感分公司",
+ "req_frequency": 225,
+ "account_count": 7,
+ "frequency_rate": 33.0882352941176
+ },
+ {
+ "account_rate": 0.272727272727273,
+ "account_avg": 2.71241830065359,
+ "trend": -0.02,
+ "company": "黄冈分公司",
+ "req_frequency": 166,
+ "account_count": 9,
+ "frequency_rate": 24.4117647058824
+ },
+ {
+ "account_rate": 0.303030303030303,
+ "account_avg": 3.17647058823529,
+ "trend": 0.1,
+ "company": "省公司",
+ "req_frequency": 216,
+ "account_count": 10,
+ "frequency_rate": 31.7647058823529
+ }
+ ],
+ "menu": [
+ {
+ "menu_name": "菜单1",
+ "trend": 0.09,
+ "frequency_avg": 111,
+ "frequency_rate": 0.263449367088608,
+ "req_frequency": 333
+ },
+ {
+ "menu_name": "菜单2",
+ "trend": -0.01,
+ "frequency_avg": 105,
+ "frequency_rate": 0.249208860759494,
+ "req_frequency": 315
+ },
+ {
+ "menu_name": "菜单3",
+ "trend": 0.02,
+ "frequency_avg": 205.333333333333,
+ "frequency_rate": 0.487341772151899,
+ "req_frequency": 616
+ }
+ ]
}
- },
- error => {
- this.message.error('服务器错误');
- })
}
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/src/app/routes/config/layout/manage/manage.module.ts b/src/app/routes/config/layout/manage/manage.module.ts
index 5d736b7..31179db 100644
--- a/src/app/routes/config/layout/manage/manage.module.ts
+++ b/src/app/routes/config/layout/manage/manage.module.ts
@@ -4,13 +4,13 @@ import { CommonModule } from '@angular/common';
import { ManageComponent } from './manage.component';
import { SharedModule } from 'src/app/common-ui';
import { PathComponent } from './path/path.component';
-
+import { ProcessComponent } from './process/process.component';
@NgModule({
imports: [
CommonModule,
SharedModule
],
- declarations: [PathComponent, ManageComponent]
+ declarations: [PathComponent, ManageComponent,ProcessComponent]
})
export class ManageModule {}
diff --git a/src/app/routes/config/layout/manage/path/path.component.html b/src/app/routes/config/layout/manage/path/path.component.html
index e7b50a2..84e20d9 100644
--- a/src/app/routes/config/layout/manage/path/path.component.html
+++ b/src/app/routes/config/layout/manage/path/path.component.html
@@ -2,12 +2,14 @@
-
+
+
访问源IP |
访问频次 |
+ 白/灰名单状态 |
操作 |
@@ -15,10 +17,11 @@
{{ data.req_ip }} |
{{ data.req_frequency }} |
+ {{ (data.is_in_white_list===0 && data.is_in_grey_list===0)? "无":data.is_in_white_list===1?"白名单":(data.is_in_white_list===0 && data.is_in_grey_list===1)?"灰名单":"无" }} |
- 白名单
-
- 灰名单
+ 白名单
+
+ 灰名单
|
@@ -30,6 +33,7 @@
账号 |
访问频次 |
工号 |
+ 白/灰名单状态 |
操作 |
@@ -39,10 +43,10 @@
{{ data.req_frequency }} |
{{ data.req_jobnum }} |
- 白名单
-
- 灰名单
- |
+ 白名单
+
+ 灰名单
+
@@ -54,6 +58,7 @@
访问IP |
访问账号 |
访问频次 |
+ 白/灰名单状态 |
工号 |
操作 |
@@ -66,10 +71,10 @@
{{ data.req_frequency }} |
{{ data.req_jobnum }} |
- 白名单
-
- 灰名单
- |
+ 白名单
+
+ 灰名单
+
@@ -81,6 +86,7 @@
访问IP |
访问账号 |
访问频次 |
+ 白/灰名单状态 |
工号 |
操作 |
@@ -93,10 +99,10 @@
{{ data.req_frequency }} |
{{ data.req_jobnum }} |
- 白名单
-
- 灰名单
- |
+ 白名单
+
+ 灰名单
+
diff --git a/src/app/routes/config/layout/manage/path/path.component.ts b/src/app/routes/config/layout/manage/path/path.component.ts
index 86cc095..d462732 100644
--- a/src/app/routes/config/layout/manage/path/path.component.ts
+++ b/src/app/routes/config/layout/manage/path/path.component.ts
@@ -1,52 +1,297 @@
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, OnChanges, SimpleChanges, Output } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { NoticeService } from '../../../service/https/notice.service';
+import { exportAsExcelFile, convertKeys } from '../utils/utils';
+
+// data mapping
+// IP
+const ipKeyMaps = {
+ 'req_ip': '访问源IP',
+'req_frequency': '访问频次'
+};
+
+const accountKeyMaps = {
+'req_account': '账号',
+'req_frequency': '访问频次',
+ 'req_jobnum': '工号'
+};
+
+const interfaceKeyMaps = {
+'interface_addr': '接口地址',
+ 'req_ip': '访问IP',
+'req_account': '访问账号',
+'req_frequency': '访问频次' ,
+'req_jobnum': '工号'
+};
+
+const menuKeyMaps = {
+ 'menu_name': '菜单名称',
+'req_ip': '访问IP',
+'req_account': '访问账号',
+'req_frequency': '访问频次' ,
+'req_jobnum': '工号'
+};
@Component({
selector: 'app-path',
templateUrl: './path.component.html',
styleUrls: ['./path.component.styl']
})
-export class PathComponent implements OnInit {
- @Input() datas: any;
+
+export class PathComponent implements OnInit, OnChanges {
+ @Input() detail_data: any;
+ // @Output() detailDataChange = new EventEmitter();
data;
viewType = 0;
-
+ whiteListParam = {};
+ greyListParam = {};
+ rules;
+ queryLogUrl = "/WebApi/isoc/static/base/#/route/threat-state/log/action?"
+ // /WebApi/isoc/static/base/#/route/threat-state/log/action?startTime=1717396269&endTime=1717403469&sip=zhang3
+ startTime;
+ endTime;
constructor(
private noticeService: NoticeService,
public message: NzMessageService,
+
) {}
ngOnInit() {
// const jsonStr = '{"type":3,"http://190.89.233.2:8909/getpublicconfig":[{"req_ip":"192.156.3.12","interface_addr":"http://190.89.233.2:8909/getpublicconfig","req_jobnum":43327,"req_frequency":43,"req_account":"liuhr"},{"req_ip":"192.156.3.12","interface_addr":"http://190.89.233.2:8909/getpublicconfig","req_jobnum":43328,"req_frequency":44,"req_account":"sunxq01"},{"req_ip":"192.156.3.18","interface_addr":"http://190.89.233.2:8909/getpublicconfig","req_jobnum":65341,"req_frequency":45,"req_account":"shicl"},{"req_ip":"192.106.3.33","interface_addr":"http://190.89.233.2:8909/getpublicconfig","req_jobnum":65342,"req_frequency":46,"req_account":"gongxs"},{"req_ip":"192.106.3.34","interface_addr":"http://190.89.233.2:8909/getpublicconfig","req_jobnum":65343,"req_frequency":47,"req_account":"sunzs"}]}'
- // if (this.datas == null) {
- // this.datas = JSON.parse(jsonStr);
+ // if (this.detail_data == null) {
+ // this.detail_data = JSON.parse(jsonStr);
// }
- this.parseData(this.datas);
+
+ if (this.rules === undefined) {
+ this.noticeService.getDefaultRule().subscribe(
+ resp => {
+ if (resp.code === 200) {
+ this.rules = resp.data;
+ } else {
+ this.message.error(resp.msg);
+ }
+ },
+ error => {
+ this.message.error('服务器错误');
+ }
+ );
+ }
}
- parseData(datas: any) {
- for (const dataKey in datas) {
- if (datas.hasOwnProperty(dataKey)) {
- if (dataKey === 'type') {
- this.viewType = datas[dataKey];
- } else {
- this.data = datas[dataKey];
+ ngOnChanges(changes: SimpleChanges) {
+ if ('detail_data' in changes) {
+ this.parseData();
+ // 在这里处理接收到的数据
+ }
+ }
+
+ parseData() {
+ for (const dataKey in this.detail_data) {
+ if (this.detail_data.hasOwnProperty(dataKey)) {
+
+ switch (dataKey) {
+ case 'type':
+ this.viewType = this.detail_data[dataKey];
+ break;
+ case 'startTime':
+ this.startTime = this.detail_data[dataKey];
+ break;
+ case 'endTime':
+ this.endTime = this.detail_data[dataKey];
+ break;
+ default:
+ this.data = this.detail_data[dataKey];
+ this.data.forEach(item => {
+ item['is_in_white_list'] = 0;
+ item['is_in_grey_list'] = 0;
+ });
}
}
}
}
clickWihteList(data) {
- alert("点击白名单");
+ let index = -1;
+ // this.message.success('添加白名单成功!');
+ // this.data[index]['is_in_white_list'] = 1;
+ this.whiteListParam['range'] = ["ueba"];
+ this.whiteListParam['des'] = "";
+ this.whiteListParam['is_enable'] = 1;
+ switch(this.viewType) {
+ case 1:
+ this.whiteListParam['fields'] = ["sip"];
+ this.whiteListParam['name'] = data.req_ip + '-' + this.getCurrentTime();
+ this.whiteListParam['content'] = {"sip": data.req_ip};
+ this.whiteListParam['alert_rule_id'] = this.rules["white_list"]["ip"];
+ index = this.data.findIndex(item => item.req_ip === data.req_ip);
+ break;
+ case 2:
+ this.whiteListParam['fields'] = ["url"];
+ this.whiteListParam['name'] = data.interface_addr + '-' + this.getCurrentTime();
+ this.whiteListParam['content'] = {"url": data.interface_addr};
+ this.whiteListParam['alert_rule_id'] = this.rules["white_list"]["interface"];
+ index = this.data.findIndex(item => item.interface_addr === data.interface_addr);
+ break;
+ case 3:
+ break;
+ case 4:
+ break;
+ }
+ this.noticeService.addWhitelist(this.whiteListParam).subscribe(
+ resp => {
+ if (resp.code === 200) {
+ this.message.success('添加白名单成功!');
+ this.data[index]['is_in_white_list'] = 1;
+ } else {
+ this.message.error(resp.msg);
+ }
+ },
+ error => {
+ this.message.error('服务器错误');
+ }
+ );
+ var log_params = {
+ "action":"add wihte list",
+ "params":this.whiteListParam
+ }
+
+ this.noticeService.writeAuditlog(log_params).subscribe(resp => {
+ if (resp.code !== 200) {
+ this.message.error("审计日志记录失败");
+ }
+ },
+ error => {
+ this.message.error('服务器错误');
+ });
}
clickGreyList(data) {
- alert("点击灰名单");
+ let index = -1;
+ // this.message.success('添加灰名单成功!');
+ // this.data[index]['is_in_grey_list'] = 1;
+ this.greyListParam['des'] = "";
+ this.greyListParam['is_enable'] = 1;
+ switch(this.viewType) {
+ case 1:
+ this.greyListParam['fields'] = ["sip"];
+ this.greyListParam['name'] = data.req_ip + '-' + this.getCurrentTime();
+ this.greyListParam['content'] = {"sip": data.req_ip};
+ this.greyListParam['alert_rule_id'] = this.rules["grey_list"]["ip"];
+ index = this.data.findIndex(item => item.req_ip === data.req_ip);
+ break;
+ case 2:
+ this.greyListParam['fields'] = ["url"];
+ this.greyListParam['name'] = data.interface_addr + '-' + this.getCurrentTime();
+ this.greyListParam['content'] = {"url": data.interface_addr};
+ this.greyListParam['alert_rule_id'] = this.rules["grey_list"]["interface"];
+ index = this.data.findIndex(item => item.interface_addr === data.interface_addr);
+ break;
+ case 3:
+ break;
+ case 4:
+ break;
+ }
+ this.greyListParam["type"]=0;
+ this.noticeService.addGreyList(this.greyListParam).subscribe(
+ resp => {
+ if (resp.code === 200) {
+ this.message.success('添加灰名单成功!');
+ this.data[index]['is_in_grey_list'] = 1;
+ } else {
+ this.message.error(resp.msg);
+ }
+ },
+ error => {
+ this.message.error('服务器错误');
+ }
+ );
+
+ var log_params = {
+ "action":"add greyList",
+ "params":this.greyListParam
+ }
+
+ this.noticeService.writeAuditlog(log_params).subscribe(resp => {
+ if (resp.code!== 200) {
+ this.message.error("审计日志记录失败");
+ }
+ },
+ error => {
+ this.message.error('服务器错误');
+ });
}
clickFrequency(data) {
- alert("点击超链接");
+ if(this.detail_data!=undefined){
+ var params = "startTime="+this.detail_data.startTime+"&endTime="+this.detail_data.endTime;
+ switch(this.detail_data.type) {
+ case 1:
+ params += "&sip="+data.req_ip;
+ break;
+ case 2:
+ params += "&sip="+data.req_account;
+ break;
+ case 3:
+ params += "&sip="+data.interface_addr;
+ break;
+ case 4:
+ params += "&sip="+data.menu_name;
+ break;
+ }
+
+ window.open(this.queryLogUrl+params, '_blank');
+ }
}
+ // 在组件类中
+ getCurrentTime(): string {
+ const now = new Date();
+ const year = now.getFullYear();
+ const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
+ const day = String(now.getDate()).padStart(2, '0');
+ const hours = String(now.getHours()).padStart(2, '0');
+ const minutes = String(now.getMinutes()).padStart(2, '0');
+ const seconds = String(now.getSeconds()).padStart(2, '0');
+
+ return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
+ }
+ exportExcel(){
+ var keysMap :any;
+ var fileName = "";
+ switch(this.viewType){
+ case 1:
+ keysMap= ipKeyMaps;
+ fileName="ip维度"
+ break;
+ case 2:
+ keysMap= accountKeyMaps;
+ fileName="账号维度"
+ break;
+ case 3:
+ keysMap= interfaceKeyMaps;
+ fileName="接口维度"
+ break;
+ case 4:
+ keysMap= menuKeyMaps;
+ fileName="菜单维度"
+ break;
+ }
+ console.log(JSON.stringify(keysMap));
+ var data =convertKeys(this.data,keysMap)
+ exportAsExcelFile(data,fileName);
+ }
+
+
+ // async getval(){
+ // const [ewAssetDetailsRes, assetTypeRes] = await Promise.all([
+ // this.noticeService.getUebaResult(this.di),
+ // this.noticeService.getQueryRange(this.di)
+ // ]);
+
+ // if(ewAssetDetailsRes && assetTypeRes){
+ // this.ewAssetDetails = ewAssetDetailsRes.data;
+ // this.assetType = assetTypeRes.data;
+ // }
+ // }
+
}
diff --git a/src/app/routes/config/layout/manage/process/process.component.html b/src/app/routes/config/layout/manage/process/process.component.html
new file mode 100644
index 0000000..7e6bde0
--- /dev/null
+++ b/src/app/routes/config/layout/manage/process/process.component.html
@@ -0,0 +1,18 @@
+
+
+ 查询进度
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/routes/config/layout/manage/process/process.component.spec.ts b/src/app/routes/config/layout/manage/process/process.component.spec.ts
new file mode 100644
index 0000000..558cf4a
--- /dev/null
+++ b/src/app/routes/config/layout/manage/process/process.component.spec.ts
@@ -0,0 +1,28 @@
+/* tslint:disable:no-unused-variable */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+import { PathComponent } from './process.component';
+
+describe('PathComponent', () => {
+ let component: PathComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ PathComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PathComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/routes/config/layout/manage/process/process.component.styl b/src/app/routes/config/layout/manage/process/process.component.styl
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/routes/config/layout/manage/process/process.component.ts b/src/app/routes/config/layout/manage/process/process.component.ts
new file mode 100644
index 0000000..80c640f
--- /dev/null
+++ b/src/app/routes/config/layout/manage/process/process.component.ts
@@ -0,0 +1,88 @@
+import {
+ ChangeDetectionStrategy,
+ ChangeDetectorRef,
+ Component,
+ EventEmitter,
+ Input,
+ OnChanges,
+ Output,
+ SimpleChanges
+} from '@angular/core';
+
+@Component({
+ selector: 'app-process',
+ templateUrl: './process.component.html',
+ styleUrls: ['./process.component.styl'],
+ changeDetection: ChangeDetectionStrategy.OnPush
+})
+// @ts-ignore
+export class ProcessComponent implements OnChanges {
+ // @ts-ignore
+ @Input() visible = false;
+ // @ts-ignore
+ // tslint:disable-next-line:no-output-on-prefix
+ @Output() onCancel = new EventEmitter();
+
+ open = false;
+ process = 0;
+ intervalId = -1;
+
+ constructor(
+ private cdr: ChangeDetectorRef
+ ) {}
+
+ ngOnChanges(changes: SimpleChanges): void {
+ const visible = changes['visible'];
+
+ if (visible.currentValue !== null) {
+ if (visible.currentValue) {
+ this.start();
+ }
+ }
+ }
+
+ random() {
+ const acc = Math.ceil(Math.random() * 10);
+ const added = this.process + acc;
+ this.process = added >= 99 ? 99 : added;
+ }
+
+ start() {
+ this.open = true;
+ this.process = 0;
+ clearTimeout(this.intervalId);
+ this.ticker();
+ }
+
+ ticker() {
+ this.intervalId = setTimeout(() => {
+ if (this.visible) {
+ this.random();
+ this.ticker();
+ } else {
+ this.process = 100;
+ this.autoClose();
+ }
+ this.cdr.markForCheck();
+ }, 1000);
+ }
+
+ cancel() {
+ this.open = false;
+ clearTimeout(this.intervalId);
+ this.onCancel.emit();
+ }
+
+ autoClose() {
+ clearTimeout(this.intervalId);
+ setTimeout(() => {
+ this.open = false;
+ this.cdr.markForCheck();
+ }, 300);
+ }
+
+ justClose() {
+ this.open = false;
+ clearTimeout(this.intervalId);
+ }
+}
\ No newline at end of file
diff --git a/src/app/routes/config/layout/manage/utils/utils.ts b/src/app/routes/config/layout/manage/utils/utils.ts
new file mode 100644
index 0000000..a7caaa6
--- /dev/null
+++ b/src/app/routes/config/layout/manage/utils/utils.ts
@@ -0,0 +1,33 @@
+import * as XLSX from 'xlsx';
+import { saveAs } from 'file-saver';
+
+const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
+const EXCEL_EXTENSION = '.xlsx';
+export function exportAsExcelFile(json: any[], excelFileName: string): void {
+ const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
+ const workbook: XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] };
+ const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
+ saveAsExcelFile(excelBuffer, excelFileName);
+}
+
+export function saveAsExcelFile(buffer: any, fileName: string): void {
+const data: Blob = new Blob([buffer], {
+ type: EXCEL_TYPE
+});
+saveAs(data, fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION);
+}
+
+export function convertKeys(excelData: Raw[], keysMap: Record): Target[] {
+ return excelData.map(excelItem => {
+ const reorderedItem: any = {};
+
+ // 按照keysMap中定义的顺序重建对象
+ Object.entries(keysMap).forEach(([originalKey, newKey]) => {
+ if (excelItem.hasOwnProperty(originalKey)) {
+ reorderedItem[newKey] = excelItem[originalKey];
+ }
+ });
+
+ return reorderedItem;
+ });
+ }
\ No newline at end of file
diff --git a/src/app/routes/config/service/https/notice.service.ts b/src/app/routes/config/service/https/notice.service.ts
index c30a987..f3571e5 100644
--- a/src/app/routes/config/service/https/notice.service.ts
+++ b/src/app/routes/config/service/https/notice.service.ts
@@ -25,17 +25,297 @@ export class NoticeService {
}
swicthBtn(params: any) {
- const url = '/notice/inner/v1/plugin/plugin_update_status';
+ const url = '/notice/inner/v1/plugin/plugin_update_status/';
return this.httpService.put(url, {}, params);
}
getQueryRange() {
+ //{"msg": "\u67e5\u8be2\u6210\u529f", "data": {"query_range": 50, "queryable_day": {"incident": 14, "log": 7}}, "retcode": 200}
const url = '/isoc/api/v1/isoc_sys_config/get_query_range';
return this.httpService.get(url,{});
}
getUebaResult(params:any) {
- const url = '/UebaMetricsAnalysis/ueba_metrics/get_summary_data_list';
- return this.httpService.get(url, params,30000);
+ const url = '/uebaMetricsAnalysis/ueba_metrics/get_summary_data_list/';
+ return this.httpService.get(url, params);
+ }
+
+ // 引擎接口
+ // 获取已有的白名单
+ whiteListQuery(params){
+ // {
+ // "message": "success",
+ // "code": 200,
+ // "data": {
+ // "total": 3,
+ // "data": [
+ // {
+ // "white_content": {
+ // "sip": "128.3.212.3"
+ // },
+ // "update_time": 1717731552,
+ // "alert_rule_id": [
+ // 400000
+ // ],
+ // "name": "test2",
+ // "white_rule": {
+ // "url": [
+ // "http://baid.com"
+ // ],
+ // "sip": {
+ // "ip_range_list": [],
+ // "single_ip_list": [
+ // "128.3.212.3"
+ // ]
+ // }
+ // },
+ // "des": "\u63cf\u8ff0\u4fe1\u606f",
+ // "event_rule_id": [],
+ // "range": [
+ // "ueba"
+ // ],
+ // "is_enable": 1,
+ // "create_time": 1717731479,
+ // "is_gray": 0,
+ // "id": 5
+ // },
+ // {
+ // "white_content": {
+ // "url": "http://baid.com",
+ // "sip": "128.3.212.3"
+ // },
+ // "update_time": 1717730831,
+ // "alert_rule_id": [
+ // 400000
+ // ],
+ // "name": "test2",
+ // "white_rule": {
+ // "url": [
+ // "http://baid.com"
+ // ],
+ // "sip": {
+ // "ip_range_list": [],
+ // "single_ip_list": [
+ // "128.3.212.3"
+ // ]
+ // }
+ // },
+ // "des": "\u63cf\u8ff0\u4fe1\u606f",
+ // "event_rule_id": [],
+ // "range": [
+ // "ueba"
+ // ],
+ // "is_enable": 1,
+ // "create_time": 1717730546,
+ // "is_gray": 0,
+ // "id": 2
+ // },
+ // {
+ // "white_content": {
+ // "dport": "123",
+ // "sip": "0.0.0.0",
+ // "dip": "0.0.0.0",
+ // "sport": "111"
+ // },
+ // "update_time": 1717399034,
+ // "alert_rule_id": [],
+ // "name": "test",
+ // "white_rule": {
+ // "dport": [
+ // 123
+ // ],
+ // "sip": {
+ // "ip_range_list": [],
+ // "single_ip_list": [
+ // "0.0.0.0"
+ // ]
+ // },
+ // "dip": {
+ // "ip_range_list": [],
+ // "single_ip_list": [
+ // "0.0.0.0"
+ // ]
+ // },
+ // "sport": [
+ // 111
+ // ]
+ // },
+ // "des": "",
+ // "event_rule_id": [
+ // 490002
+ // ],
+ // "range": [
+ // "cep"
+ // ],
+ // "is_enable": 1,
+ // "create_time": 1713409218,
+ // "is_gray": 0,
+ // "id": 1
+ // }
+ // ]
+ // }
+ // }
+ //pageIndex,pageSize
+ //const url = '/ditingEngine/diting/global/whitelist_query/?pageIndex=1&pageSize=10000';
+ const url = '/ditingEngine/diting/global/whitelist_query';
+ return this.httpService.get(url, params);
+ }
+
+ // 获取已有的灰名单
+ greyListQyery(param){
+ // {
+ // "message": "\u8c1b\u542c\u5f15\u64ce-\u540d\u5355\u67e5\u8be2\u6210\u529f",
+ // "code": 200,
+ // "data": {
+ // "total": 1,
+ // "data": [
+ // {
+ // "white_content": {
+ // "url": "http://baid.com",
+ // "sip": "187.23.23.4"
+ // },
+ // "update_time": 1717730747,
+ // "alert_rule_id": [
+ // 400000
+ // ],
+ // "name": "\u7070\u540d\u5355-\u540d\u79f0",
+ // "des": "\u7070\u540d\u5355-\u63cf\u8ff0",
+ // "range": "ueba",
+ // "is_enable": 1,
+ // "create_time": 1717730747,
+ // "is_gray": 1,
+ // "id": 3
+ // }
+ // ]
+ // }
+ // }
+ // const url = 'https://10.65.74.3/ditingEngine/ueba/engine_name_list/query/?pageIndex=1&pageSize=10&type=0';
+ const url = '/ditingEngine/ueba/engine_name_list/query';
+ return this.httpService.get(url,param);
+ }
+
+ // 添加白名单
+ addWhitelist(params){
+ // {
+ // "range": [
+ // "ueba"
+ // ],
+ // "fields": [
+ // "sip",
+ // ],
+ // "name": "test2",//ip+加入时间
+ // "des": "",
+ // "is_enable": 1,
+ // "content": {
+ // "sip": "128.3.212.3",
+ // },
+ // "alert_rule_id": [
+ // 400000,
+ // 400000
+ // ]
+ // }
+
+ // response
+ //{"message": "The whitelist is added", "code": 200, "data": {"id": 6}}
+ const url = '/ditingEngine/diting/global/whitelist_add/';
+ return this.httpService.post(url,{}, params);
+ }
+
+ // 添加灰名单
+ addGreyList(params){
+ // {
+ // "fields": [
+ // "sip",
+ // "url"
+ // ],
+ // "name": "灰名单-名称",//ip+加入时间
+ // "alert_rule_id": [
+ // 400000
+ // ],
+ // "des": "灰名单-描述",
+ // "is_enable": 1,
+ // "content": {
+ // "sip": "187.23.23.4",
+ // "url": "http://baid.com"
+ // },
+ // "type": 0
+ // }
+
+ //response:
+ // {
+ // "message": "谛听引擎-添加灰名单成功",
+ // "code": 200,
+ // "data": null
+ // }
+ const url = '/ditingEngine/ueba/engine_name_list/add/';
+ return this.httpService.post(url,{}, params);
+ }
+
+ // 添加白名单灰名单默认类型
+ getDefaultRule(){
+ // {
+ // "message": "success",
+ // "code": 200,
+ // "data": {
+ // "white_list": {
+ // "ip": [
+ // 400000,
+ // 400001
+ // ],
+ // "account": [
+ // 400000,
+ // 400001
+ // ],
+ // "interface": [
+ // 400000,
+ // 400001
+ // ],
+ // "menu": [
+ // 400000,
+ // 400001
+ // ]
+ // },
+ // "grey_list": {
+ // "ip": [
+ // 400000,
+ // 400001
+ // ],
+ // "account": [
+ // 400000,
+ // 400001
+ // ],
+ // "interface": [
+ // 400000,
+ // 400001
+ // ],
+ // "menu": [
+ // 400000,
+ // 400001
+ // ]
+ // }
+ // }
+ // }
+ const url = '/uebaMetricsAnalysis/ueba_metrics/get_default_rule/';
+ return this.httpService.get(url);
+ }
+
+ // 写审计日志
+ writeAuditlog(param){
+ // {
+ // "action":"add whitelist",
+ // "params":{
+ // "name":"xx",
+ // "adg":21
+ // }
+ // }
+
+ // response:
+ // {
+ // "message": "success",
+ // "code": 200,
+ // "data": "ok"
+ // }
+ const url = '/uebaMetricsAnalysis/ueba_metrics/write_audit_log/';
+ return this.httpService.post(url,{},param);
}
}
diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts
index 5122b4d..2254fe9 100644
--- a/src/environments/environment.prod.ts
+++ b/src/environments/environment.prod.ts
@@ -1,5 +1,5 @@
export const environment = {
production: true,
- productionUrls: '/WebApi/notice/static/dist/',
+ productionUrls: '/WebApi/uebaMetricsAnalysis/static/dist/',
hashPrefx: ''
};
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 613a9a8..d0a51af 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -5,7 +5,7 @@
export const environment = {
production: false,
productionUrls: '',
- hashPrefx: '/WebApi/notice/static/dist/'
+ hashPrefx: '/WebApi/uebaMetricsAnalysis/static/dist/'
};
/*