...
|
...
|
@@ -171,6 +171,8 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
//发送拦截短信
|
|
|
String mobile_yunwei = getUsersInfoUtil.getMobileByAlarmGroup(AlarmGroupContants.GROUP_NAME_MALICIOUS_IP);
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String createTimeStr=sdf.format(new Date());
|
|
|
for(int i=0;i<ipsObjArray.size();i++){
|
|
|
JSONObject jo= ipsObjArray.getJSONObject(i);
|
|
|
String ip=jo.getString("ip");
|
...
|
...
|
@@ -182,7 +184,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
alarmMsgService.sendSms("MaliciousIp", smsStr, mobile_yunwei);
|
|
|
|
|
|
try {
|
|
|
maliciousIpMapper.insertMipObj(influxDBStr, ip, reason, duration,hbaseTime);
|
|
|
maliciousIpMapper.insertMipObj(influxDBStr, ip, reason, duration,hbaseTime,createTimeStr);
|
|
|
} catch (Exception e) {
|
|
|
logger.error("writeMipsObjToOpsReids insert mip into influxdb failed", e);
|
|
|
}
|
...
|
...
|
@@ -359,6 +361,8 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
long ts=0l;
|
|
|
String insertTime="";
|
|
|
String insertTime2="";
|
|
|
String hbaseTime="";
|
|
|
String hbaseTime2="";
|
|
|
for(String mipKey : mipKeys){
|
|
|
MaliciousIp mip = new MaliciousIp();
|
|
|
mip.setIp(mipKey);
|
...
|
...
|
@@ -368,7 +372,8 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
if( awsIpInfo.get(mipKey) != null){
|
|
|
Map<String,String> awsInfo = awsIpInfo.get(mipKey);
|
|
|
String reason=awsInfo.get("reason");
|
|
|
insertTime=awsInfo.get("time");
|
|
|
insertTime=awsInfo.get("createtime");
|
|
|
hbaseTime=awsInfo.get("hbasetime");
|
|
|
try{
|
|
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
|
|
reason=model.toHtmlString();
|
...
|
...
|
@@ -386,7 +391,8 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
reasonDur += "</br>";
|
|
|
}
|
|
|
String reason=qcloudInfo.get("reason");
|
|
|
insertTime2=qcloudInfo.get("time");
|
|
|
insertTime2=qcloudInfo.get("createtime");
|
|
|
hbaseTime2=qcloudInfo.get("hbasetime");
|
|
|
try{
|
|
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
|
|
reason=model.toHtmlString();
|
...
|
...
|
@@ -414,15 +420,23 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
}*/
|
|
|
mip.setTs(ts);
|
|
|
if(StringUtils.isNotBlank(insertTime)&&StringUtils.isNotBlank(insertTime2)){
|
|
|
try{
|
|
|
if(insertTime.compareTo(insertTime2)>0){
|
|
|
mip.setTime(insertTime.substring(0,10)+" "+insertTime.substring(11,19));
|
|
|
mip.setTime(insertTime);
|
|
|
}else{
|
|
|
mip.setTime(insertTime2.substring(0,10)+" "+insertTime2.substring(11,19));
|
|
|
mip.setTime(insertTime2);
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
|
|
|
if(StringUtils.isNotBlank(hbaseTime)&&StringUtils.isNotBlank(hbaseTime2)){
|
|
|
if(hbaseTime.compareTo(hbaseTime2)>0){
|
|
|
mip.setHbaseTime(hbaseTime);
|
|
|
}else{
|
|
|
mip.setHbaseTime(hbaseTime2);
|
|
|
}
|
|
|
}else if(StringUtils.isNotBlank(hbaseTime2)){
|
|
|
mip.setHbaseTime(hbaseTime);
|
|
|
}else{
|
|
|
mip.setHbaseTime(hbaseTime2);
|
|
|
}
|
|
|
|
|
|
listMaliciousIp.add(mip);
|
...
|
...
|
|