Compare commits

..

2 Commits

  1. 4
      src/app/routes/config/layout/manage/manage.component.html
  2. 128
      src/app/routes/config/layout/manage/manage.component.ts
  3. 30
      src/app/routes/config/layout/manage/path/path.component.ts
  4. 9
      src/app/routes/config/service/https/notice.service.ts

@ -22,7 +22,7 @@
</div> </div>
<div class="table-container" style="margin-top: 50px;height:100vh;"> <div class="table-container" style="margin-top: 50px;height:100vh;">
<div style="display: flex;justify-content: right;"><button nz-button (click)="exportExcel()">导出</button></div> <div style="display: flex;justify-content: right;"><button nz-button [hidden]="exportIsVisable" (click)="exportExcel()">导出</button></div>
<nz-table *ngIf="tableisShow === '1'" #basicTable [nzData]="listOfData"> <nz-table *ngIf="tableisShow === '1'" #basicTable [nzData]="listOfData">
<thead> <thead>
@ -131,7 +131,7 @@
"frequency_rate": 0.263449367088608, "frequency_rate": 0.263449367088608,
"frequency_avg": 111, "frequency_avg": 111,
"trend": 0.09 --> "trend": 0.09 -->
<td><a (click)="showModel({type: 3, key: data.menu_name})">{{ data.menu_name }}</a></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_rate| percent: '1.1-2' }}</td> <td>{{ data.frequency_rate| percent: '1.1-2' }}</td>
<td>{{ data.frequency_avg| number: '1.2-2'}}</td> <td>{{ data.frequency_avg| number: '1.2-2'}}</td>

@ -71,7 +71,7 @@ export class ManageComponent implements OnInit {
isVisible = false isVisible = false
detail_data : any; detail_data : any;
destroySubscriptions: Subscription[] = []; destroySubscriptions: Subscription[] = [];
exportIsVisable = true;
constructor( constructor(
private noticeService: NoticeService, private noticeService: NoticeService,
public message: NzMessageService, public message: NzMessageService,
@ -91,91 +91,83 @@ export class ManageComponent implements OnInit {
saveAs(data, fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION); saveAs(data, fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION);
} }
onSubmit(){ private getAnalysisResult(startDate,endDate,queryDates){ // 获取es的查询最大日期范围
// 日期校验 this.noticeService.getQueryRange().subscribe(resp => {
this.submitLoading = true; console.log("resp.retcode"+resp.retcode);
this.tableisShow = this.dimension; if (resp.retcode === 200) {
if (this.dateRange.length === 2) { console.log(resp.data.query_range);
const startDate = this.dateRange[0]; if (queryDates >resp.data.query_range ){
const endDate = this.dateRange[1]; alert('查询范围不能超过'+resp.data.query_range+'天');
console.log(startDate); return;
//alert(`Selected Date Range: ${startDate.toLocaleDateString()} - ${endDate.toLocaleDateString()}`);
}else{ }else{
alert('Please select a date range.'); this.submitLoading = true;
} this.noticeService.getUebaResult({"type":this.dimension,"startDate":startDate,"endDate":endDate}).subscribe(resp => {
// 获取es的查询最大日期范围 if (resp.code === 200) {
// this.noticeService.getQueryRange().subscribe(resp => { this.summary_detal_data = resp
// if (resp.status === 200) {
// console.log(resp.data);
// } else {
// this.message.error(resp.msg);
// }
// },
// error => {
// this.message.error('服务器错误');
// })
// 获取es数据 暂时mock数据
this.summary_detal_data = this.mockData
this.listOfData=[]
if (this.summary_detal_data.code === 0) {
switch(this.dimension.toString()){ switch(this.dimension.toString()){
case "1": case "1":
this.listOfData = this.summary_detal_data.data.summary.ip; this.listOfData = resp.data.summary.ip;
console.log("1"+this.dimension.toString())
break; break;
case "2": case "2":
this.listOfData = this.summary_detal_data.data.summary.account; this.listOfData = resp.data.summary.account;
console.log("2"+this.dimension.toString())
break; break;
case "3": case "3":
this.listOfData = this.summary_detal_data.data.summary.interface; this.listOfData = resp.data.summary.interface;
console.log("3"+this.dimension.toString())
break; break;
case "4": case "4":
this.listOfData = this.summary_detal_data.data.summary.menu; this.listOfData = resp.data.summary.menu;
console.log("4"+this.dimension.toString())
break; 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{ }else{
this.message.error("error"); return undefined;
} }
},
error => {
this.message.error('服务器错误');
})
}
// this.listOfData = resp.data.summary.ip;
// this.noticeService.getUebaResult({"type":eventVal}).subscribe(resp => { private querySubmit(){
// if (resp.code === 200) { var startDate :any;
// switch(this.dimension.toString()){ var endDate :any;
// case "1": if (this.dateRange.length === 2) {
// this.listOfData = resp.summary.ip; startDate = this.dateRange[0];
// case "2": endDate = this.dateRange[1];
// this.listOfData = resp.summary.account; } else {
// case "3": alert('请选择查询范围');
// this.listOfData = resp.summary.interface; return;
// case "4": }
// this.listOfData = resp.summary.menu;
// } let timeDiff = Math.abs(endDate.getTime() - startDate.getTime());
// } else { let diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
// this.message.error(resp.msg);
// } this.getAnalysisResult(startDate,endDate,diffDays)
// }, }
// error => { onSubmit(){
// this.message.error('服务器错误'); this.querySubmit();
// })
} }
ngOnInit() { ngOnInit() {
const now = new Date(); const now = new Date();
const oneWeekAgo = new Date(); const oneWeekAgo = new Date();
oneWeekAgo.setDate(now.getDate() - 7); oneWeekAgo.setDate(now.getDate() - 7);
this.dateRange = [oneWeekAgo, now]; this.dateRange = [oneWeekAgo, now];
//this.onSubmit()
this.onSubmit()
}
getMenuItem(e) {
console.log(e.el.dataset.id);
// this.key = e.el.dataset.id;
} }
exportExcel(){ exportExcel(){
@ -206,6 +198,7 @@ export class ManageComponent implements OnInit {
showModel(data){ showModel(data){
var tmpdata :any; var tmpdata :any;
if(this.summary_detal_data != undefined){
switch(data.type){ switch(data.type){
case 1: case 1:
tmpdata=this.summary_detal_data.data.detail.ip[data.key]; tmpdata=this.summary_detal_data.data.detail.ip[data.key];
@ -222,6 +215,8 @@ export class ManageComponent implements OnInit {
} }
var diagData = { var diagData = {
"type": data.type, "type": data.type,
"startTime": Math.floor(this.dateRange[0].getTime() / 1000),
"endTime": Math.floor(this.dateRange[1].getTime() / 1000),
[data.key]: tmpdata [data.key]: tmpdata
} }
@ -229,6 +224,7 @@ export class ManageComponent implements OnInit {
console.log(JSON.stringify(this.detail_data)); console.log(JSON.stringify(this.detail_data));
this.isVisible=true; this.isVisible=true;
} }
}
cancelSearch(): void { cancelSearch(): void {
this.submitLoading = false; this.submitLoading = false;
this.logLoading = false; this.logLoading = false;

@ -14,12 +14,14 @@ export class PathComponent implements OnInit, OnChanges {
whiteListParam = {}; whiteListParam = {};
greyListParam = {}; greyListParam = {};
rules; 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; startTime;
endTime; endTime;
constructor( constructor(
private noticeService: NoticeService, private noticeService: NoticeService,
public message: NzMessageService, public message: NzMessageService,
) {} ) {}
ngOnInit() { ngOnInit() {
@ -28,10 +30,10 @@ export class PathComponent implements OnInit, OnChanges {
// this.detail_data = JSON.parse(jsonStr); // this.detail_data = JSON.parse(jsonStr);
// } // }
this.parseData(); this.parseData();
if (this.rules == null) { if (this.rules === undefined) {
this.noticeService.getDefaultRule().subscribe( this.noticeService.getDefaultRule().subscribe(
resp => { resp => {
if (resp.status === 200) { if (resp.code === 200) {
this.rules = resp.data; this.rules = resp.data;
} else { } else {
this.message.error(resp.msg); this.message.error(resp.msg);
@ -54,6 +56,7 @@ export class PathComponent implements OnInit, OnChanges {
parseData() { parseData() {
for (const dataKey in this.detail_data) { for (const dataKey in this.detail_data) {
if (this.detail_data.hasOwnProperty(dataKey)) { if (this.detail_data.hasOwnProperty(dataKey)) {
switch (dataKey) { switch (dataKey) {
case 'type': case 'type':
this.viewType = this.detail_data[dataKey]; this.viewType = this.detail_data[dataKey];
@ -143,6 +146,7 @@ export class PathComponent implements OnInit, OnChanges {
case 4: case 4:
break; break;
} }
this.greyListParam["type"]=0;
this.noticeService.addGreyList(this.greyListParam).subscribe( this.noticeService.addGreyList(this.greyListParam).subscribe(
resp => { resp => {
if (resp.status === 200) { if (resp.status === 200) {
@ -159,7 +163,25 @@ export class PathComponent implements OnInit, OnChanges {
} }
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');
}
} }
// 在组件类中 // 在组件类中

@ -25,18 +25,19 @@ 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);
} }
// 引擎接口 // 引擎接口
@ -246,7 +247,7 @@ export class NoticeService {
// "code": 200, // "code": 200,
// "data": null // "data": null
// } // }
const url = '/ditingEngine/diting/global/whitelist_add'; const url = '/ditingEngine/ueba/engine_name_list/add/';
return this.httpService.post(url,{}, params); return this.httpService.post(url,{}, params);
} }

Loading…
Cancel
Save