...
|
...
|
@@ -112,7 +112,6 @@ public class MaliciousIpController { |
|
|
/* HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Host","erp.yoho.yohoops.org");*/
|
|
|
String[] hosts=maliciousRedisHosts.split(",");
|
|
|
String[] ports=maliciousRedisPorts.split(",");
|
|
|
for(int i=0;i<hosts.length;i++){
|
|
|
//":"+ports[i] 不需要端口号
|
|
|
String url="http://"+hosts[i]+"/malIp?method=del&ips=";
|
...
|
...
|
@@ -136,6 +135,40 @@ public class MaliciousIpController { |
|
|
return new BaseResponse();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* first调用相关系统提供的接口从正式封杀环境中删除,再从运维系统的redis删除恶意ip
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/addMipsFromOpsRedis")
|
|
|
@ResponseBody
|
|
|
public BaseResponse addMipsFromOpsRedis(String ip) {
|
|
|
if(StringUtils.isNotBlank(ip)){
|
|
|
//获取header信息,
|
|
|
/* HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Host","erp.yoho.yohoops.org");*/
|
|
|
String[] hosts=maliciousRedisHosts.split(",");
|
|
|
for(int i=0;i<hosts.length;i++){
|
|
|
//":"+ports[i] 不需要端口号
|
|
|
String url="http://"+hosts[i]+"/malIp?method=add&ips=";
|
|
|
String removeReturnMsg = httpRestClientService.getWithHeaderHost(url + ip, null, String.class);
|
|
|
if(StringUtils.isBlank(removeReturnMsg)){
|
|
|
return new BaseResponse(201,"添加恶意ip返回结果为空,出现异常,主机:"+hosts[i]);
|
|
|
}
|
|
|
JSONObject jo = JSON.parseObject(removeReturnMsg);
|
|
|
Object codeValueStr=jo.get("code");
|
|
|
if(codeValueStr==null){
|
|
|
return new BaseResponse(201,"添加恶意ip返回结果code为空,出现异常,主机:"+hosts[i]);
|
|
|
}
|
|
|
Integer codeValue=(Integer)codeValueStr;
|
|
|
if(codeValue!=200){
|
|
|
return new BaseResponse(201,"添加恶意ip出现异常,主机:"+hosts[i]+",异常msg:"+removeReturnMsg);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return new BaseResponse();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|