Authored by qinchao

恶意ip管理_新

... ... @@ -276,6 +276,8 @@ public class HttpUriContants {
* 恶意请求ip
* 获取
*/
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 GET_MALICIOUS_IP = "/maliciousIp/getIps";
public static final String GET_MALICIOUS_DETAIL = "/maliciousIp/getDetail";
public static final String GET_MALICIOUS_UPLOADIP = "/maliciousIp/uploadIp";
... ...
... ... @@ -14,7 +14,7 @@ import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
@Controller
@RequestMapping("maliciousIp")
@RequestMapping("/maliciousIp")
public class MaliciousIpCtrl {
@Autowired
... ... @@ -24,6 +24,35 @@ public class MaliciousIpCtrl {
public ModelAndView toMaliciousIps(Model model) {
return new ModelAndView("malicious/maliciousIpList");
}
@RequestMapping("/toMaliciousIpsNew")
public ModelAndView toMaliciousIpsNew(Model model) {
return new ModelAndView("malicious/maliciousIpListNew");
}
/**
* 从运维系统的redis获取恶意ip
* @return
*/
@RequestMapping("/getMipsFromOpsReids")
@ResponseBody
public BaseResponse<List<Object>> getMipsFromOpsReids() {
BaseResponse<List<Object>> response = httpClient.defaultPost(HttpUriContants.GET_MIPS_FROM_OPS_REIDS, null,
BaseResponse.class);
return response;
}
/**
* first调用相关系统提供的接口从正式封杀环境中删除,再从运维系统的redis删除恶意ip
* @return
*/
@RequestMapping("/delMipsFromOpsRedis")
@ResponseBody
public BaseResponse delMipsFromOpsRedis(String ip){
BaseResponse response = httpClient.defaultPost(HttpUriContants.DEL_MIPS_FROM_OPS_REDIS+"?ip="+ip, null,
BaseResponse.class);
return response;
}
@RequestMapping("/toMaliciousIpsBL")
public ModelAndView toMaliciousIpsBL(Model model) {
... ...
... ... @@ -236,7 +236,7 @@
</div>
</div>
</body>
<script src="<%=basePath %>script/common/genarate_left_panel.js?v=20170818"></script>
<script src="<%=basePath %>script/common/genarate_left_panel.js?v=20170821"></script>
<script type="text/javascript">
$("#li_dashboard").addClass("active");
</script>
... ...
<%--
CreateUser: xuhui
CreateDate: 2017/3/20
--%>
<%@ page import="org.aspectj.weaver.ast.Var" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=basePath %>css/bootstrap.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/unicorn.main.css"/>
<link rel="stylesheet" href="<%=basePath %>css/unicorn.grey.css"/>
<link rel="stylesheet" href="<%=basePath %>css/jquery-ui.css"/>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap-responsive.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/uniform.css"/>
<link rel="stylesheet" href="<%=basePath %>css/select2.css"/>
<script src="<%=basePath %>js/excanvas.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/jquery-1.12.0.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/jquery-ui.custom.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>/js/bootstrap.min.js"></script>
<script src="<%=basePath %>/js/unicorn.js"></script>
<script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/moment-with-locales.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/bootstrap-datetimepicker.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/global.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.table.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.breadcrumb.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.validate.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/layer/layer.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.select.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/jstree/jstree.min.js"></script>
<script src="<%=basePath %>js/jquery.toaster.js"></script>
<script>
var contextPath = '<%=basePath %>';
</script>
<title>YOHO!运维</title>
</head>
<body>
<!-- 头部 -->
<div id="head">
</div>
<!-- 右侧具体内容 -->
<div id="content">
<div id="breadcrumb">
<a href="#" title="Go to Home" class="tip-bottom"><i
class="icon-home"></i> Home</a> <a href="#" class="current">被封杀的恶意请求ip集合</a>
</div>
<div class="container-fluid">
<div class="widget-box">
<div class="widget-title">
<h5>恶意ip top</h5>
</div>
<div class="widget-title" style="height: 56px;">
<div>
<div class="form-inline" role="form" id="inBoxQueryDiv" style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left">
<span class="input-group-addon" style="height:34px;">全选:</span>
<span class="input-group-addon" style="height:34px;width:40px;"></span>
<input type="checkbox" id="checkAll" class="form-control" style="margin-top:7px;margin-left:-30px;width:20px;height:20px;" onclick="checkAll()" />
</div>
<button id="uploadIps" class="btn-primary" style="margin-left: 80px;" onclick="batchDeleteIPs()">批量删除
</button>
</div>
</div>
</div>
<div id="ipTable" style="overflow-y: auto; overflow-x:hidden;max-height: 700px" /></div>
</div>
</div>
</body>
<script src="<%=basePath %>js/pagination.js"></script>
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
<script>
$("#li_config").addClass("active open");
$("#li_malicious_ips").addClass("active");
</script>
</html>
<script>
$(function () {
refreshTable();
});
function refreshTable() {
$("#ipTable").table({
url: contextPath + "maliciousIp/getMipsFromOpsReids",
dataType: 'json',
striped: true,
panelClass: "panel-success",
loadFilter: function (data) {
return defaultLoadFilter(data);
},
columns: [
{
title: "",
width:"20px",
field: "ip",
formatter: function (value, rowData, rowIndex) {
var div = $("<div>");
//复选框
var checkBox = $("<input name='checkType' type='checkbox' value='"+value+"'>").addClass("ckbox-default").appendTo(div);
return div;
}
},
{
title: "ip",
width: "100px",
field: "ip"
},
{
title: "操作",
width: "50px",
field: "ip",
formatter: function (value, rowData, rowIndex) {
var div = $("<div>");
//移除
var editBtn = $("<button data-toggle='modal'>").addClass("btn btn-xs btn-warning").html("移除").appendTo(div);
editBtn.click(function () {
removeMips(rowData.ip);
});
return div;
}
}]
});
}
function removeMips(mip){
if(confirm("是否确定要删除如下ip:\r\n" + mip)){
$.ajax({
url: contextPath + "maliciousIp/delMipsFromOpsRedis",
type: "post",
dataType: "json",
data: {
ip: mip
},
success: function (response) {
if(200==response.code){
refreshTable();
}else{
alert("发生错误:"+response.message);
}
},
error: function (e) {
alert("移除恶意ip发生异常");
}
});
}
}
//全选
function checkAll(){
$("#ipTable input[type='checkbox']").each(function(){
if($("#checkAll").is(':checked'))
$(this).prop("checked", true);
else
$(this).prop("checked", false);
});
}
function batchDeleteIPs(){
var listip = "";
$("#ipTable input[type='checkbox']:checked").each(function(){
listip += $(this).val() + ",";
});
if(listip.length == 0){
alert("请至少选择一条数据");
return;
}
removeMips(listip);
}
</script>
\ No newline at end of file
... ...
... ... @@ -74,6 +74,7 @@ innerHTML += "<li id='li_cache_info'><a id='li_cache_info_a' href=''><i class='i
innerHTML += "<li id='li_aws_ebs'><a id='li_aws_ebs_a' href=''><i class='icon icon-th'></i> <span>AWS_EBS镜像任务</span></a></li>";
innerHTML += "<li id='li_ips_compare'><a id='li_ips_compare_a' href=''><i class='icon icon-th'></i> <span>在线服务Ip配置对比</span></a></li>";
innerHTML += "<li id='li_malicious_ips'><a id='li_malicious_ips_a' href=''><i class='icon icon-th'></i> <span>恶意ip管理</span></a></li>";
innerHTML += "<li id='li_malicious_ips_new'><a id='li_malicious_ips_a_new' href=''><i class='icon icon-th'></i> <span>恶意ip管理_新</span></a></li>";
innerHTML += "<li id='li_malicious_ips_bl'><a id='li_malicious_ips_bl_a' href=''><i class='icon icon-th'></i> <span>恶意ip管理 | 敏感接口比例</span></a></li>";
innerHTML += "<li id='li_malicious_ips_cs'><a id='li_malicious_ips_cs_a' href=''><i class='icon icon-th'></i> <span>恶意ip管理 | 敏感接口次数</span></a></li>";
innerHTML += "</ul></li>";
... ... @@ -105,7 +106,7 @@ innerHTML += "<li id='li_switchtopo'><a id='li_switchtopo_a' href='#'>NGINX切
innerHTML += "</ul></li>";
/*manage*/
innerHTML += "<li class='submenu' id='li_manager'><a id='li_manager_a' href='#'><i class='icon icon-th-list'></i> <span>管理员</span><span class='label'>3</span></a>";
innerHTML += "<li class='submenu' id='li_manager'><a id='li_manager_a' href='#'><i class='icon icon-th-list'></i> <span>管理员</span><span class='label'>6</span></a>";
innerHTML += "<ul><li id='li_user'><a id='li_user_a' href=''>用户管理</a></li>";
innerHTML += "<li id='li_module'><a id='li_module_a' href=''>模块管理</a></li>";
innerHTML += "<li id='li_taskConfigure'><a id='li_taskConfigure_a' href=''>任务管理</a></li>";
... ... @@ -175,6 +176,7 @@ document.getElementById("li_javarestart_a").setAttribute("href", path + "/javaRe
//document.getElementById("li_centerswitch_a").setAttribute("href", path + "/centerSwitch/toCenterSwitch");
document.getElementById("li_ips_compare_a").setAttribute("href", path + "/compareIps/toCompareIps");
document.getElementById("li_malicious_ips_a").setAttribute("href", path + "/maliciousIp/toMaliciousIps");
document.getElementById("li_malicious_ips_a_new").setAttribute("href", path + "/maliciousIp/toMaliciousIpsNew");
document.getElementById("li_malicious_ips_bl_a").setAttribute("href", path + "/maliciousIp/toMaliciousIpsBL");
document.getElementById("li_malicious_ips_cs_a").setAttribute("href", path + "/maliciousIp/toMaliciousIpsCS");
... ...