语音聊天监控

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

语音聊天监控​

Kafka数据源​
topic:chat_inbox_voice​
格式:
JSON
1 {
2 "id":123,
3 "localId":1608100366451,
4 "srcId":1184175,
5 "destId":1591243,
6 "type":6,
7 "messageType":0,
8 "content":"
{"remotePath":"https:\/\/a1.easemob.com\/1113190618090767\/real\/chatfiles\/82b4
ae80-3f68-11eb-ab5d-
c563f99f17b2","isRecording":false,"url":"file:\/\/\/var\/mobile\/Containers\/Dat
a\/Application\/31FDAF28-60BC-4752-A119-
CFA30D6463F3\/Library\/Caches\/RecordPath\/1608100361.aac","isplaying":false,"du
ration":5}",
9 "createTime":null,
10 "updateTime":null,
11 "messageId":"818344028058683440",
12 ,
"isAvailable":1 ​
13 "result": "哈哈哈还好哈哈哈"
14 }

语音微信关键词报警-1小时内发出语音微信关键词超5次​
一个用户仅报警一次
content:{"userId": 1746556, "timestamp": 1609143288571, "results": [{"name":
"voice_wechat_hour1_over3", "desc": "1小时内发出语音微信关键词:4次"}]}​

语音微信关键词报警-24小时内发出语音微信关键词超10次​
报警后静默24小时,然后再次命中后继续报警​
content:{"userId": 1746556, "timestamp": 1609143288571, "results": [{"name":
"voice_wechat_hour1_over3", "desc": "24小时内发出语音微信关键词:12次"}]}​

语音微信关键词报警-24小时内发出语音微信关键词超20次​
一个用户仅报警一次
content:{"userId": 1746556, "timestamp": 1609143288571, "results": [{"name":
"voice_wechat_hour1_over3", "desc": "24小时内发出语音微信关键词:20次"}]}​
传递属性 isSpam:"voice_wechat_keyword_hour24_over20", punish:1​
语音微信报警-1小时内发出语音微信超3次​
一个用户仅报警一次
content:{"userId": 1746556, "timestamp": 1609143288571, "results": [{"name":
"voice_wechat_hour1_over3", "desc": "1小时内发出语音微信:4次, 语音微信:18610380001"}]}​

语音微信报警-24小时内发出语音微信超5次​
报警后静默24小时,然后再次命中后继续报警​
content:{"userId": 1746556, "timestamp": 1609143288571, "results": [{"name":
"voice_wechat_hour24_over5", "desc": "24小时内发出语音微信:5次, 语音微信:18610380001"}]}​

语音微信报警-24小时内发出语音微信超10次​
一个用户仅报警一次
rabbit_mq 传递属性isSpam:"voice_wechat_hour24_over10", punish:1​
content:{"userId": 1746556, "timestamp": 1609143288571, "results": [{"name":
"voice_wechat_hour24_over10", "desc": "24小时内发出语音微信:11次, 语音微信:18610380001"}]}​

汉字数字映射

一, 壹, 幺​
二, 贰 ​
三, 叁​
四, 肆​
五, 伍​
六, 陆​
七, 柒​
八, 捌​
九, 玖 ​

微信关键词:
微聊, 微信, 加微, qq, 加q, q聊​
微信正则表达式:
1[3-9]{10} # 手机号​

[1-9][0-9]{8,11} # QQ号​
[a-zA-Z][-_a-zA-Z0-9]{6,18}?[-|_|0-9] # 微信号​

需要保存识别的微信号到数据库
rabbitmq_connection = pika.BlockingConnection(​
pika.ConnectionParameters(host='10.110.0.22',​
port=5672,​
credentials=pika.PlainCredentials(​
'real',​
'jiecaojiecao')​
)​
)​
rabbitmq_channel = rabbitmq_connection.channel()​
rabbitmq_channel.queue_declare(queue='​
', arguments={"x-max-priority": 5})​
data = {​
"userId": uid,​
"strategy": 5,​
"reason": reason,​
"createTime": int(time.time() * 1000)​
}​
If isSpam:​
data["punish"] = 1​
data["isSpam"] = 'wechat_black_list'​
body = json.dumps({​
"eventName": "anti_spam",​
"data":​
json.dumps( data )​
})​
rabbitmq_channel.basic_publish(exchange='', routing_key='anti_spam', body=body)​

You might also like