Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ops
/
monitor-service
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
qinchao
7 years ago
Commit
8ff848159d124ba7b9119a7b07d83043e1c120cb
1 parent
35a53fb2
恶意ip封杀原因显示汉化
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
17 deletions
monitor-service-common/src/main/java/com/monitor/common/util/RedisCommonUtil.java
monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/impl/MaliciousIpMapperImpl.java
monitor-service-other/src/main/java/com/monitor/other/maliciousip/contants/MaliciousIpModel.java
monitor-service-other/src/main/java/com/monitor/other/maliciousip/service/impl/MaliciousIpServiceImpl.java
monitor-service-web/src/main/resources/product/send_sms.properties
monitor-service-web/src/main/resources/qcloud/send_sms.properties
monitor-service-common/src/main/java/com/monitor/common/util/RedisCommonUtil.java
View file @
8ff8481
...
...
@@ -325,7 +325,7 @@ public class RedisCommonUtil {
return
total
;
}
p
ublic
static
Map
<
String
,
String
>
cmd_set
(
String
host
,
int
port
,
int
selectIndex
,
String
keyName
,
String
value
){
p
rivate
static
Map
<
String
,
String
>
cmd_set
(
String
host
,
int
port
,
int
selectIndex
,
String
keyName
,
String
value
){
Map
<
String
,
String
>
result
=
new
HashMap
<
String
,
String
>();
Jedis
client
=
null
;
try
{
...
...
monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/impl/MaliciousIpMapperImpl.java
View file @
8ff8481
...
...
@@ -71,7 +71,6 @@ public class MaliciousIpMapperImpl extends InfluxDBQuery implements MaliciousIpM
*/
@Override
public
Map
<
String
,
Map
<
String
,
String
>>
getMaliousIpInfo
(
Set
<
String
>
listMaliciousIp
,
String
influxDBStr
)
{
log
.
info
(
" getMaliousIpInfo begin from the cloud of : "
+
influxDBStr
);
String
query_cmd
=
"select * from "
.
concat
(
mip_rpname
).
concat
(
".monitor_malicousips "
);
if
(
listMaliciousIp
==
null
||
listMaliciousIp
.
size
()
==
0
){
return
null
;
...
...
@@ -84,7 +83,7 @@ public class MaliciousIpMapperImpl extends InfluxDBQuery implements MaliciousIpM
ips
=
StringUtils
.
stripEnd
(
ips
,
" or "
);
//取出每个ip最新的一条数据
query_cmd
=
query_cmd
.
concat
(
"where ("
).
concat
(
ips
).
concat
(
")"
).
concat
(
"group by ip order by time desc limit 1;"
);
log
.
info
(
"getMaliousIpInfo query_cmd is :"
+
query_cmd
);
QueryResult
result
=
query
(
influxDBStr
,
query_cmd
,
InfluxDBContants
.
YOMO_MONITOR
);
for
(
QueryResult
.
Result
queryResult
:
result
.
getResults
())
{
if
(
queryResult
.
getSeries
()
==
null
)
...
...
monitor-service-other/src/main/java/com/monitor/other/maliciousip/contants/MaliciousIpModel.java
0 → 100644
View file @
8ff8481
package
com
.
monitor
.
other
.
maliciousip
.
contants
;
import
lombok.Data
;
@Data
public
class
MaliciousIpModel
{
private
String
deviceTypeCount
;
//设备类型总数
private
String
difMethodCount
;
//访问接口次数
private
String
impApiPrecent
;
//敏感接口占比
private
String
impCount
;
//敏感接口访问次数
private
String
ip
;
//恶意ip
private
String
ipPrecent
;
//ip百分比
private
String
loginApiCount
;
//登录接口访问次数
private
String
notExistUdidPercent
;
//不存在的udid占比
private
String
notExsitUdidCount
;
//不存在的udid个数
private
String
qps
;
//qps
private
String
uidCount
;
//uid个数
private
String
udidCount
;
//udid个数
private
boolean
whiteIpFlag
;
//白名单标志
private
long
timestamp
;
//时间戳
private
String
duration
;
//统计时间:多少秒一个批次,暂时不显示
public
String
toHtmlString
(){
String
str
=
""
;
str
+=
(
"QPS:"
+
this
.
qps
+
"<br>"
);
str
+=
(
"访问接口次数:"
+
this
.
difMethodCount
+
"<br>"
);
str
+=
(
"登录接口访问次数:"
+
this
.
loginApiCount
+
"<br>"
);
str
+=
(
"敏感接口访问次数:"
+
this
.
impCount
+
"<br>"
);
str
+=
(
"敏感接口占比:"
+
this
.
impApiPrecent
+
"<br>"
);
str
+=
(
"ip百分比:"
+
this
.
ipPrecent
+
"<br>"
);
str
+=
(
"uid个数:"
+
this
.
uidCount
+
"<br>"
);
str
+=
(
"udid个数:"
+
this
.
udidCount
+
"<br>"
);
str
+=
(
"不存在的udid占比:"
+
this
.
notExistUdidPercent
+
"<br>"
);
str
+=
(
"不存在的udid个数:"
+
this
.
notExsitUdidCount
+
"<br>"
);
str
+=
(
"设备类型总数:"
+
this
.
deviceTypeCount
+
"<br>"
);
str
+=
(
"白名单标志:"
+
this
.
whiteIpFlag
+
"<br>"
);
str
+=
(
"时间戳:"
+
this
.
timestamp
);
return
str
;
}
}
...
...
monitor-service-other/src/main/java/com/monitor/other/maliciousip/service/impl/MaliciousIpServiceImpl.java
View file @
8ff8481
...
...
@@ -14,6 +14,7 @@ import com.monitor.model.response.BaseResponse;
import
com.monitor.model.response.PageResponse
;
import
com.monitor.mysql.mapper.MalIpRuleMapper
;
import
com.monitor.other.maliciousip.contants.MaliciousIpContants
;
import
com.monitor.other.maliciousip.contants.MaliciousIpModel
;
import
com.monitor.other.maliciousip.model.MaliciousDetailIp
;
import
com.monitor.other.maliciousip.model.MaliciousIp
;
import
com.monitor.other.maliciousip.model.MaliciousIpBL
;
...
...
@@ -200,14 +201,22 @@ public class MaliciousIpServiceImpl implements MaliciousIpService {
Map
<
String
,
String
>
awsInfo
=
awsIpInfo
.
get
(
mipKey
);
String
reasonDur
=
""
;
if
(
awsInfo
!=
null
){
reasonDur
+=
"aws: "
+
awsInfo
.
get
(
"dur"
)
+
" -- "
+
awsInfo
.
get
(
"reason"
);
MaliciousIpModel
model
=
JSON
.
parseObject
(
awsInfo
.
get
(
"reason"
),
MaliciousIpModel
.
class
);
model
.
setDuration
(
""
+
awsInfo
.
get
(
"dur"
));
reasonDur
+=
"aws<br>"
;
reasonDur
+=
model
.
toHtmlString
();
//reasonDur += "aws: " + awsInfo.get("dur") + " -- " + awsInfo.get("reason");
}
Map
<
String
,
String
>
qcloudInfo
=
qcloudIpInfo
.
get
(
mipKey
);
if
(
qcloudInfo
!=
null
){
if
(
reasonDur
.
length
()>
0
){
reasonDur
+=
"</br>"
;
}
reasonDur
+=
"qcloud: "
+
qcloudInfo
.
get
(
"dur"
)+
" -- "
+
qcloudInfo
.
get
(
"reason"
)
;
MaliciousIpModel
model
=
JSON
.
parseObject
(
qcloudInfo
.
get
(
"reason"
),
MaliciousIpModel
.
class
);
model
.
setDuration
(
""
+
qcloudInfo
.
get
(
"dur"
));
reasonDur
+=
"qcloud<br>"
;
reasonDur
+=
model
.
toHtmlString
();
//reasonDur += "qcloud: " + qcloudInfo.get("dur")+ " -- "+ qcloudInfo.get("reason") ;
}
mip
.
setReasonDur
(
reasonDur
);
listMaliciousIp
.
add
(
mip
);
...
...
monitor-service-web/src/main/resources/product/send_sms.properties
View file @
8ff8481
...
...
@@ -8,23 +8,23 @@ qcloud_voice_url=https://yun.tim.qq.com/v3/tlsvoicesvr/sendvoiceprompt?sdkappid=
qcloud_sms_url
=
https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=1400021400&random=124
qcloud_sms_key
=
6e56f948f6f1c0a1bc359e23f7acc140
base_mobile
=
18751986615,18652008443,1
3515100825,18252034289,17361900581,18751886435,17314953523,13515100825
base_mobile
=
18751986615,18652008443,1
8252034289,17361900581,18751886435,17314953523
switch_mobile
=
18751986615
dns_exception_mobile
=
18751986615,18652008443,1
3515100825,1
8252034289,17361900581
dns_exception_mobile
=
18751986615,18652008443,18252034289,17361900581
redis_exception_mobile
=
1
3515100825,1
8751986615,18652008443,17361900581,18252034289
redis_exception_mobile
=
18751986615,18652008443,17361900581,18252034289
java_service_alarm_mobile
=
18751986615,18652008443,1
3515100825,1
8252034289,17361900581,18602555621
java_service_alarm_mobile
=
18751986615,18652008443,18252034289,17361900581,18602555621
java_service_alarm_flag
=
true
java_service_alarm_cost_threshold
=
300
java_service_alarm_count_threshold
=
50
union_mobile
=
18751986615,18652008443,1
3515100825,1
8252034289,18001582955,15051889346,17361900581
union_mobile
=
18751986615,18652008443,18252034289,18001582955,15051889346,17361900581
bigdata_mobile
=
18652925653,18600623107,18651650543,18021522255
java_api_error
=
18751986615,18652008443,1
3515100825,1
8252034289,13951882433,17361900581,18602555621
java_api_error
=
18751986615,18652008443,18252034289,13951882433,17361900581,18602555621
malicious_ip_mobile
=
18652008443,18751986615,13770920736
...
...
monitor-service-web/src/main/resources/qcloud/send_sms.properties
View file @
8ff8481
...
...
@@ -8,23 +8,23 @@ qcloud_voice_url=https://yun.tim.qq.com/v3/tlsvoicesvr/sendvoiceprompt?sdkappid=
qcloud_sms_url
=
https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=1400021400&random=124
qcloud_sms_key
=
6e56f948f6f1c0a1bc359e23f7acc140
base_mobile
=
18751986615,18652008443,1
3515100825,1
8252034289,17361900581
base_mobile
=
18751986615,18652008443,18252034289,17361900581
switch_mobile
=
18751986615
dns_exception_mobile
=
18751986615,18652008443,1
3515100825,1
8252034289,17361900581
dns_exception_mobile
=
18751986615,18652008443,18252034289,17361900581
redis_exception_mobile
=
1
3515100825,1
8751986615,18652008443,17361900581,18252034289
redis_exception_mobile
=
18751986615,18652008443,17361900581,18252034289
java_service_alarm_mobile
=
18751986615,18652008443,1
3515100825,1
8252034289,17361900581,18602555621
java_service_alarm_mobile
=
18751986615,18652008443,18252034289,17361900581,18602555621
java_service_alarm_flag
=
true
java_service_alarm_cost_threshold
=
300
java_service_alarm_count_threshold
=
50
union_mobile
=
18751986615,18652008443,1
3515100825,1
8252034289,18001582955,15051889346,17361900581
union_mobile
=
18751986615,18652008443,18252034289,18001582955,15051889346,17361900581
bigdata_mobile
=
18652925653,17368731356,18600623107
java_api_error
=
18751986615,18652008443,1
3515100825,1
8252034289,13951882433,17361900581,18602555621
java_api_error
=
18751986615,18652008443,18252034289,13951882433,17361900581,18602555621
malicious_ip_mobile
=
18652008443,18751986615,13770920736
...
...
Please
register
or
login
to post a comment