Authored by qinchao

恶意ip接口

... ... @@ -303,6 +303,7 @@ public class HttpUriContants {
public static final String GET_MIPS_RECORD_FROM_OPS_DB_FORBID = "/maliciousIp/getMaliciousIpRecordForbidList";
public static final String GET_MIPS_RECORD_FROM_OPS_HBASE="/maliciousIp/getMaliciousDetection";
public static final String GET_MIPS_RECORD_FROM_OPS_HBASE_MIN="/maliciousIp/getMaliciousDetectionBeforeMin";
public static final String GET_MIPS_FROM_OPS_REIDS = "/maliciousIp/getMipsFromOpsReids";
public static final String DEL_MIPS_FROM_OPS_REDIS = "/maliciousIp/delMipsFromOpsRedis";
public static final String ADD_MIPS_FROM_OPS_REDIS = "/maliciousIp/addMipsFromOpsRedis";
... ...
... ... @@ -80,7 +80,7 @@ public class MaliciousIpCtrl {
@RequestMapping("/getMaliciousDetection")
@ResponseBody
public BaseResponse getMaliciousDetection(MaliciousIpRecordReq req) {
if(StringUtils.isBlank(req.getIp())){
if(StringUtils.isBlank(req.getIp())||req.getTimestamp()<=0){
return null;
}
BaseResponse response = httpClient.defaultPost(HttpUriContants.GET_MIPS_RECORD_FROM_OPS_HBASE, req,
... ... @@ -88,6 +88,19 @@ public class MaliciousIpCtrl {
return response;
}
@RequestMapping("/getMaliciousDetectionBeforeMin")
@ResponseBody
public BaseResponse getMaliciousDetectionBeforeMin(MaliciousIpRecordReq req) {
if(StringUtils.isBlank(req.getIp())||req.getTimestamp()<=0){
return null;
}
BaseResponse response = httpClient.defaultPost(HttpUriContants.GET_MIPS_RECORD_FROM_OPS_HBASE_MIN, req,
BaseResponse.class);
return response;
}
/**
* 从运维系统的redis获取恶意ip
* @return
... ...
... ... @@ -101,6 +101,25 @@
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width:900px;">
<div class="modal-content" style="width: 140%">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body">
<input id="hbasePrefix"type="text" readonly disabled style="width:350px;" />
<div id="hbaseTable" style="overflow-y: auto; overflow-x:hidden;max-height: 700px" /></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</body>
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
... ... @@ -119,6 +138,103 @@
});
refreshTable();
$("#hbaseTable").table({
url: contextPath + "maliciousIp/getMaliciousDetectionBeforeMin",
queryParams:{},
dataType: 'json',
striped: true,
pagination: false,
//pageSize: 10,
//sortName: 'count', // 设置默认排序为 name
//sortOrder: 'desc', // 设置排序为反序 desc
panelClass: "panel-success",
loadFilter: function (data) {
return defaultLoadFilter(data);
},
columns: [
{
title: "本地IP",
width:"12%",
field: "localIp",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},{
title: "用户IP",
width:"12%",
field: "userIp",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},{
title: "时间",
width:"9%",
field: "currDateStr",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},{
title: "请求方式",
width:"7%",
field: "requestType",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},{
title: "User-Agent",
width:"9%",
field: "userAgent",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},{
title: "请求标示",
field: "requestMark",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},{
title: "请求参数",
field: "requestParam",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},{
title: "HTTP响应码",
width:"9%",
field: "responseCode",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},{
title: "请求处理时间",
width:"9%",
field: "dealTime",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
}
]
});
});
//点击搜索按钮
... ... @@ -152,7 +268,7 @@
},
{
title: "reason",
width: "60%",
width: "50%",
field: "reason",
align: "left",
formatter:function(value,rowData,rowIndex){
... ... @@ -194,10 +310,42 @@
}
},
{
title: "操作",
field: "ip",
width: "10%",
formatter:function (value,rowData,rowIndex) {
var div = $("<div>");
$("<button onclick=\"qpsDetailMip(\'" + rowData.ip +"\'"+ ","+"\'"+rowData.hbaseTime+"\'"+ ","+"\'"+rowData.hbaseSource+"\')\">").addClass("btn btn-xs btn-info").html("详情").appendTo(div);
return div;
}
}]
});
}
function qpsDetailMip(mip,hbaseTime,hbaseSource){
if(!hbaseTime){
hbaseTime=0;
}
$("#hbasePrefix").val(hbaseSource+" "+mip+":"+hbaseTime+":");
refreshHbaseTable(mip,hbaseTime,hbaseSource);
$("#myModal").modal('show');
}
function refreshHbaseTable(mip,hbaseTime,hbaseSource){
$("#hbaseTable").table("loadLoaclData",[]);
var param={
ip:mip,
timestamp:hbaseTime,
cloudType:hbaseSource,
type:"message"
};
$("#hbaseTable").table("load", param);
}
function showResons(elememt){
var that = elememt;
var btnText = $(that).attr("value");
... ...