dev #2

Open
tangwy wants to merge 10 commits from dev into 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. 53
      src/app/routes/config/layout/manage/manage.component.html
  8. 1020
      src/app/routes/config/layout/manage/manage.component.ts
  9. 4
      src/app/routes/config/layout/manage/manage.module.ts
  10. 32
      src/app/routes/config/layout/manage/path/path.component.html
  11. 279
      src/app/routes/config/layout/manage/path/path.component.ts
  12. 18
      src/app/routes/config/layout/manage/process/process.component.html
  13. 28
      src/app/routes/config/layout/manage/process/process.component.spec.ts
  14. 0
      src/app/routes/config/layout/manage/process/process.component.styl
  15. 88
      src/app/routes/config/layout/manage/process/process.component.ts
  16. 33
      src/app/routes/config/layout/manage/utils/utils.ts
  17. 286
      src/app/routes/config/service/https/notice.service.ts
  18. 2
      src/environments/environment.prod.ts
  19. 2
      src/environments/environment.ts

@ -3,7 +3,7 @@
"version": 1, "version": 1,
"newProjectRoot": "projects", "newProjectRoot": "projects",
"projects": { "projects": {
"notice": { "uebaMetricsAnalysis": {
"root": "", "root": "",
"sourceRoot": "src", "sourceRoot": "src",
"projectType": "application", "projectType": "application",
@ -21,7 +21,7 @@
"build": { "build": {
"builder": "@angular-builders/custom-webpack:browser", "builder": "@angular-builders/custom-webpack:browser",
"options": { "options": {
"outputPath": "dist/notice", "outputPath": "dist/uebaMetricsAnalysis",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
@ -82,18 +82,18 @@
"serve": { "serve": {
"builder": "@angular-builders/dev-server:generic", "builder": "@angular-builders/dev-server:generic",
"options": { "options": {
"browserTarget": "notice:build" "browserTarget": "uebaMetricsAnalysis:build"
}, },
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "notice:build:production" "browserTarget": "uebaMetricsAnalysis:build:production"
} }
} }
}, },
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n", "builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"browserTarget": "notice:build" "browserTarget": "uebaMetricsAnalysis:build"
} }
}, },
"test": { "test": {
@ -127,7 +127,7 @@
} }
} }
}, },
"notice-e2e": { "uebaMetricsAnalysis-e2e": {
"root": "e2e/", "root": "e2e/",
"projectType": "application", "projectType": "application",
"prefix": "", "prefix": "",
@ -136,11 +136,11 @@
"builder": "@angular-devkit/build-angular:protractor", "builder": "@angular-devkit/build-angular:protractor",
"options": { "options": {
"protractorConfig": "e2e/protractor.conf.js", "protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "notice:serve" "devServerTarget": "uebaMetricsAnalysis:serve"
}, },
"configurations": { "configurations": {
"production": { "production": {
"devServerTarget": "notice:serve:production" "devServerTarget": "uebaMetricsAnalysis:serve:production"
} }
} }
}, },
@ -156,5 +156,5 @@
} }
} }
}, },
"defaultProject": "notice" "defaultProject": "uebaMetricsAnalysis"
} }

@ -7,7 +7,7 @@ module.exports = (angularWebpackConfig, options) => {
output: { output: {
library: `${name}-[name]`, library: `${name}-[name]`,
libraryTarget: 'umd', 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/'
}, },

2
package-lock.json generated

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

@ -1,10 +1,10 @@
{ {
"name": "notice", "name": "uebaMetricsAnalysis",
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve notice --host 0.0.0.0 --disable-host-check --port 4203 --open --proxy-config proxy.conf.js", "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 notice --aot --output-path dist/ --deploy-url /WebApi/notice/static/dist/ --base-href /WebApi/notice/static/dist/ --prod", "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", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e" "e2e": "ng e2e"

@ -13,7 +13,7 @@ const routes: Routes = [
imports: [RouterModule.forRoot(routes, { useHash: true })], imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule], exports: [RouterModule],
providers: [ 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 { } export class AppRoutingModule { }

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

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

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

@ -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 { NzMessageService } from 'ng-zorro-antd';
import { NoticeService } from '../../../service/https/notice.service'; 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({ @Component({
selector: 'app-path', selector: 'app-path',
templateUrl: './path.component.html', templateUrl: './path.component.html',
styleUrls: ['./path.component.styl'] 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; data;
viewType = 0; 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( constructor(
private noticeService: NoticeService, private noticeService: NoticeService,
public message: NzMessageService, public message: NzMessageService,
) {} ) {}
ngOnInit() { 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"}]}' // 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) { // if (this.detail_data == null) {
// this.datas = JSON.parse(jsonStr); // this.detail_data = JSON.parse(jsonStr);
// } // }
this.parseData(this.datas);
}
parseData(datas: any) { if (this.rules === undefined) {
for (const dataKey in datas) { this.noticeService.getDefaultRule().subscribe(
if (datas.hasOwnProperty(dataKey)) { resp => {
if (dataKey === 'type') { if (resp.code === 200) {
this.viewType = datas[dataKey]; this.rules = resp.data;
} else { } else {
this.data = datas[dataKey]; this.message.error(resp.msg);
}
},
error => {
this.message.error('服务器错误');
}
);
}
}
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) { 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) { 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) { 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;
// }
// }
} }

@ -0,0 +1,18 @@
<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>

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

@ -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);
}
}

@ -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<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,17 +25,297 @@ export class NoticeService {
} }
swicthBtn(params: any) { 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); return this.httpService.put(url, {}, params);
} }
getQueryRange() { 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'; const url = '/isoc/api/v1/isoc_sys_config/get_query_range';
return this.httpService.get(url,{}); return this.httpService.get(url,{});
} }
getUebaResult(params:any) { getUebaResult(params:any) {
const url = '/UebaMetricsAnalysis/ueba_metrics/get_summary_data_list'; const url = '/uebaMetricsAnalysis/ueba_metrics/get_summary_data_list/';
return this.httpService.get(url, params,30000); 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);
} }
} }

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

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

Loading…
Cancel
Save