Compare commits

..

No commits in common. 'dev' and 'master' have entirely different histories.
dev ... master

  1. 18
      angular.json
  2. 2
      extra-webpack.config.js
  3. 2
      package-lock.json
  4. 6
      package.json
  5. 2
      src/app/app-routing.module.ts
  6. 2
      src/app/app.component.ts
  7. 59
      src/app/routes/config/layout/manage/manage.component.html
  8. 2
      src/app/routes/config/layout/manage/manage.component.styl
  9. 1034
      src/app/routes/config/layout/manage/manage.component.ts
  10. 4
      src/app/routes/config/layout/manage/manage.module.ts
  11. 38
      src/app/routes/config/layout/manage/path/path.component.html
  12. 279
      src/app/routes/config/layout/manage/path/path.component.ts
  13. 18
      src/app/routes/config/layout/manage/process/process.component.html
  14. 28
      src/app/routes/config/layout/manage/process/process.component.spec.ts
  15. 0
      src/app/routes/config/layout/manage/process/process.component.styl
  16. 88
      src/app/routes/config/layout/manage/process/process.component.ts
  17. 33
      src/app/routes/config/layout/manage/utils/utils.ts
  18. 286
      src/app/routes/config/service/https/notice.service.ts
  19. 2
      src/environments/environment.prod.ts
  20. 2
      src/environments/environment.ts

@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"uebaMetricsAnalysis": {
"notice": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
@ -21,7 +21,7 @@
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"outputPath": "dist/uebaMetricsAnalysis",
"outputPath": "dist/notice",
"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": "uebaMetricsAnalysis:build"
"browserTarget": "notice:build"
},
"configurations": {
"production": {
"browserTarget": "uebaMetricsAnalysis:build:production"
"browserTarget": "notice:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "uebaMetricsAnalysis:build"
"browserTarget": "notice:build"
}
},
"test": {
@ -127,7 +127,7 @@
}
}
},
"uebaMetricsAnalysis-e2e": {
"notice-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
@ -136,11 +136,11 @@
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "uebaMetricsAnalysis:serve"
"devServerTarget": "notice:serve"
},
"configurations": {
"production": {
"devServerTarget": "uebaMetricsAnalysis:serve:production"
"devServerTarget": "notice:serve:production"
}
}
},
@ -156,5 +156,5 @@
}
}
},
"defaultProject": "uebaMetricsAnalysis"
"defaultProject": "notice"
}

@ -7,7 +7,7 @@ module.exports = (angularWebpackConfig, options) => {
output: {
library: `${name}-[name]`,
libraryTarget: 'umd',
publicPath: process.env.NODE_ENV == 'prod' ? '/WebApi/uebaMetricsAnalysis/static/dist/' : 'http://localhost:4203/'
publicPath: process.env.NODE_ENV == 'prod' ? '/WebApi/notice/static/dist/' : 'http://localhost:4203/'
},

2
package-lock.json generated

@ -1,5 +1,5 @@
{
"name": "uebaMetricsAnalysis",
"name": "notice",
"version": "0.0.0",
"lockfileVersion": 1,
"requires": true,

@ -1,10 +1,10 @@
{
"name": "uebaMetricsAnalysis",
"name": "notice",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"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",
"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",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"

@ -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__ ? '/uebaMetricsAnalysis' : '/' },
{ provide: APP_BASE_HREF, useValue: (window as any).__POWERED_BY_QIANKUN__ ? '/notice' : '/' },
]
})
export class AppRoutingModule { }

@ -28,7 +28,7 @@ export class AppComponent implements OnInit {
if (!this.prefixRouter) {
this.prefixRouter = await this.configService.translatePrefix();
}
const appName = '/uebaMetricsAnalysis';
const appName = '/notice';
const prefix = this.configService.getUrlPrefix(this.prefixRouter, appName);
document.title = prefix ? prefix : '绿盟智能安全运营平台';
}

@ -1,5 +1,4 @@
<div class="container">
<!-- <h1>统计分析</h1> -->
<div class="seach">
<div class="form-item">
<div class="form-label">时间选择:</div>
@ -8,7 +7,7 @@
<div class="form-item" >
<div class="form-label">统计维度:</div>
<nz-select [(ngModel)]="dimension">
<nz-select (ngModelChange)="selectValChange()" [(ngModel)]="dimension">
<nz-option nzValue="1" nzLabel="IP"></nz-option>
<nz-option nzValue="2" nzLabel="账号"></nz-option>
<nz-option nzValue="3" nzLabel="接口" ></nz-option>
@ -21,10 +20,9 @@
</div>
</div>
<div class="table-container" style="margin-top: 50px;height:100vh;">
<div style="display: flex;justify-content: right;"><button nz-button [hidden]="exportIsVisable" (click)="exportExcel()">导出</button></div>
<nz-table *ngIf="tableisShow === '1'" #basicTable [nzData]="listOfData">
<div style="margin-top: 50px;">
<nz-table *ngIf="dimension === '1'" #basicTable [nzData]="listOfData">
<thead>
<tr>
<th>归属单位</th>
@ -45,18 +43,18 @@
"ip_reat": 0.3,
"ip_avg": 0.43,
"trend": 0.3 -->
<td><a (click)="showModel({type: 1, key: data.company})">{{data.company}}</a></td>
<td>{{ data.company }}</td>
<td>{{ data.req_frequency }}</td>
<td>{{ data.frequency_rate| percent: '1.1-2' }}</td>
<td>{{ data.frequency_rate }}</td>
<td>{{ data.ip_count }}</td>
<td>{{ data.ip_rate| percent: '1.1-2' }}</td>
<td>{{ data.ip_avg| number: '1.2-2' }}</td>
<td>{{ data.trend| percent: '1.1-2' }}</td>
<td>{{ data.ip_reat }}</td>
<td>{{ data.ip_avg }}</td>
<td>{{ data.trend }}</td>
</tr>
</tbody>
</nz-table>
<nz-table *ngIf="tableisShow === '2'" #basicTable [nzData]="listOfData">
<nz-table *ngIf="dimension === '2'" #basicTable [nzData]="listOfData">
<thead>
<tr>
<th>归属单位</th>
@ -77,18 +75,18 @@
"account_reat": 0.3,
"account_avg": 0.43,
"trend": 0.3 -->
<td><a (click)="showModel({type: 2, key: data.company})">{{data.company}}</a></td>
<td>{{ data.company }}</td>
<td>{{ data.req_frequency }}</td>
<td>{{ data.frequency_rate| percent: '1.1-2' }}</td>
<td>{{ data.frequency_rate }}</td>
<td>{{ data.account_count }}</td>
<td>{{ data.account_rate| percent: '1.1-2' }}</td>
<td>{{ data.account_avg| number: '1.2-2' }}</td>
<td>{{ data.trend| percent: '1.1-2' }}</td>
<td>{{ data.account_reat }}</td>
<td>{{ data.account_avg }}</td>
<td>{{ data.trend }}</td>
</tr>
</tbody>
</nz-table>
<nz-table *ngIf="tableisShow === '3'" #basicTable [nzData]="listOfData">
<nz-table *ngIf="dimension === '3'" #basicTable [nzData]="listOfData">
<thead>
<tr>
<th>接口地址</th>
@ -105,16 +103,15 @@
"frequency_rate": 0.160727824109174,
"frequency_avg": 0,
"trend": 0.07 -->
<td><a (click)="showModel({type: 3, key: data.interface_addr})">{{ data.interface_addr }}</a></td>
<td>{{ data.interface_addr }}</td>
<td>{{ data.req_frequency }}</td>
<td>{{ data.frequency_rate | percent: '1.1-2' }}</td>
<td>{{ data.frequency_avg| number: '1.2-2' }}</td>
<td>{{ data.trend| percent: '1.1-2' }}</td>
<td>{{ data.frequency_avg }}</td>
<td>{{ data.trend }}</td>
</tr>
</tbody>
</nz-table>
<nz-table *ngIf="tableisShow === '4'" #basicTable [nzData]="listOfData">
<nz-table *ngIf="dimension === '4'" #basicTable [nzData]="listOfData">
<thead>
<tr>
<th>菜单名称</th>
@ -131,22 +128,18 @@
"frequency_rate": 0.263449367088608,
"frequency_avg": 111,
"trend": 0.09 -->
<td><a (click)="showModel({type: 4, key: data.menu_name})">{{ data.menu_name }}</a></td>
<td>{{ data.menu_name }}</td>
<td>{{ data.req_frequency }}</td>
<td>{{ data.frequency_rate| percent: '1.1-2' }}</td>
<td>{{ data.frequency_avg| number: '1.2-2'}}</td>
<td>{{ data.trend| percent: '1.1-2' }}</td>
<td>{{ data.frequency_avg }}</td>
<td>{{ data.trend }}</td>
</tr>
</tbody>
</nz-table>
</div>
<app-process [visible]="submitLoading" (onCancel)="cancelSearch()">
</app-process>
<nz-modal [(nzVisible)]="isVisible" nzWidth="80%" nzTitle="明细" (nzOnCancel)="isVisible = false" [nzFooter]="null">
<app-path [detail_data]="detail_data"></app-path>
</nz-modal>
<app-path></app-path>
</nz-modal>
</div>

File diff suppressed because it is too large Load Diff

@ -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,ProcessComponent]
declarations: [PathComponent, ManageComponent]
})
export class ManageModule {}

@ -2,14 +2,12 @@
<!-- <div>cdfddffff</div> -->
<div >
<div style="display: flex;justify-content: right;"><button nz-button (click)="exportExcel()">导出</button></div>
<div>
<nz-table *ngIf="viewType === 1" #basicTable [nzData]="data" [nzPageSize]="10" nzShowSizeChanger [nzPageSize]="10" [nzPageSizeOptions]="[10, 20, 50, 100]">
<thead>
<tr>
<th>访问源IP</th>
<th>访问频次</th>
<th>白/灰名单状态</th>
<th nzRight>操作</th>
</tr>
</thead>
@ -17,11 +15,10 @@
<tr *ngFor="let data of basicTable.data">
<td>{{ data.req_ip }}</td>
<td><a (click)="clickFrequency(data)">{{ data.req_frequency }}</a></td>
<td>{{ (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)?"灰名单":"无" }}</td>
<td nzRight>
<a *ngIf="!data.is_in_white_list" (click)="clickWihteList(data)">白名单</a>
<nz-divider *ngIf="!data.is_in_white_list && !data.is_in_grey_list" nzType="vertical"></nz-divider>
<a *ngIf="!data.is_in_grey_list" (click)="clickGreyList(data)">灰名单</a>
<a (click)="clickWihteList(data)">白名单</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="clickGreyList(data)">灰名单</a>
</td>
</tr>
</tbody>
@ -33,7 +30,6 @@
<th>账号</th>
<th>访问频次</th>
<th>工号</th>
<th>白/灰名单状态</th>
<th nzRight>操作</th>
</tr>
</thead>
@ -43,10 +39,10 @@
<td><a (click)="clickFrequency(data)">{{ data.req_frequency }}</a></td>
<td>{{ data.req_jobnum }}</td>
<td nzRight>
<a *ngIf="!data.is_in_white_list" (click)="clickWihteList(data)">白名单</a>
<nz-divider *ngIf="!data.is_in_white_list && !data.is_in_grey_list" nzType="vertical"></nz-divider>
<a *ngIf="!data.is_in_grey_list" (click)="clickGreyList(data)">灰名单</a>
</td>
<a (click)="clickWihteList(data)">白名单</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="clickGreyList(data)">灰名单</a>
</td>
</tr>
</tbody>
</nz-table>
@ -58,7 +54,6 @@
<th>访问IP</th>
<th>访问账号</th>
<th>访问频次</th>
<th>白/灰名单状态</th>
<th>工号</th>
<th nzRight>操作</th>
</tr>
@ -71,10 +66,10 @@
<td><a (click)="clickFrequency(data)">{{ data.req_frequency }}</a></td>
<td>{{ data.req_jobnum }}</td>
<td nzRight>
<a *ngIf="!data.is_in_white_list" (click)="clickWihteList(data)">白名单</a>
<nz-divider *ngIf="!data.is_in_white_list && !data.is_in_grey_list" nzType="vertical"></nz-divider>
<a *ngIf="!data.is_in_grey_list" (click)="clickGreyList(data)">灰名单</a>
</td>
<a (click)="clickWihteList(data)">白名单</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="clickGreyList(data)">灰名单</a>
</td>
</tr>
</tbody>
</nz-table>
@ -86,7 +81,6 @@
<th>访问IP</th>
<th>访问账号</th>
<th>访问频次</th>
<th>白/灰名单状态</th>
<th>工号</th>
<th nzRight>操作</th>
</tr>
@ -99,10 +93,10 @@
<td><a (click)="clickFrequency(data)">{{ data.req_frequency }}</a></td>
<td>{{ data.req_jobnum }}</td>
<td nzRight>
<a *ngIf="!data.is_in_white_list" (click)="clickWihteList(data)">白名单</a>
<nz-divider *ngIf="!data.is_in_white_list && !data.is_in_grey_list" nzType="vertical"></nz-divider>
<a *ngIf="!data.is_in_grey_list" (click)="clickGreyList(data)">灰名单</a>
</td>
<a (click)="clickWihteList(data)">白名单</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="clickGreyList(data)">灰名单</a>
</td>
</tr>
</tbody>
</nz-table>

@ -1,297 +1,52 @@
import { Component, Input, OnInit, OnChanges, SimpleChanges, Output } from '@angular/core';
import { Component, Input, OnInit } 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, OnChanges {
@Input() detail_data: any;
// @Output() detailDataChange = new EventEmitter();
export class PathComponent implements OnInit {
@Input() datas: any;
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.detail_data == null) {
// this.detail_data = JSON.parse(jsonStr);
// if (this.datas == null) {
// this.datas = JSON.parse(jsonStr);
// }
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('服务器错误');
}
);
}
}
ngOnChanges(changes: SimpleChanges) {
if ('detail_data' in changes) {
this.parseData();
// 在这里处理接收到的数据
}
this.parseData(this.datas);
}
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;
});
parseData(datas: any) {
for (const dataKey in datas) {
if (datas.hasOwnProperty(dataKey)) {
if (dataKey === 'type') {
this.viewType = datas[dataKey];
} else {
this.data = datas[dataKey];
}
}
}
}
clickWihteList(data) {
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('服务器错误');
});
alert("点击白名单");
}
clickGreyList(data) {
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('服务器错误');
});
alert("点击灰名单");
}
clickFrequency(data) {
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');
}
alert("点击超链接");
}
// 在组件类中
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;
// }
// }
}

@ -1,18 +0,0 @@
<nz-modal [(nzVisible)]="open"
[nzMaskClosable]="false"
[nzKeyboard]="false"
(nzOnCancel)="justClose()"
[nzFooter]="footer"
nzTitle="搜索进度">
<nz-row>
<nz-col nzSpan="4">查询进度</nz-col>
<nz-col nzSpan="20">
<nz-progress [nzPercent]="process">
</nz-progress>
</nz-col>
</nz-row>
</nz-modal>
<ng-template #footer>
<button nz-button (click)="cancel()">取消查询</button>
</ng-template>

@ -1,28 +0,0 @@
/* 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<PathComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PathComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PathComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -1,88 +0,0 @@
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);
}
}

@ -1,33 +0,0 @@
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<Raw = any, Target = any>(excelData: Raw[], keysMap: Record<string, string>): 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;
});
}

@ -25,297 +25,17 @@ 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);
}
// 引擎接口
// 获取已有的白名单
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);
const url = '/UebaMetricsAnalysis/ueba_metrics/get_summary_data_list';
return this.httpService.get(url, params,30000);
}
}

@ -1,5 +1,5 @@
export const environment = {
production: true,
productionUrls: '/WebApi/uebaMetricsAnalysis/static/dist/',
productionUrls: '/WebApi/notice/static/dist/',
hashPrefx: ''
};

@ -5,7 +5,7 @@
export const environment = {
production: false,
productionUrls: '',
hashPrefx: '/WebApi/uebaMetricsAnalysis/static/dist/'
hashPrefx: '/WebApi/notice/static/dist/'
};
/*

Loading…
Cancel
Save