码迷,mamicode.com
首页 > 微信 > 详细

微信报警脚本

时间:2018-12-05 10:25:55      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:ascii   UNC   --   use   ==   ext   message   bin   des   

 1 #!/bin/bash
 2 #====================================================
 3 # Author: VizierBi
 4 # Create Date: 2018-10-19
 5 # Description:微信监控报警脚本 
 6 #====================================================
 7 CropID=‘wwaebf94b1310467a9‘
 8 Secret=‘W6ahrPd1vg-M2I1CbXa9MYhRW_Vp10NNmOQNov2ELvY‘
 9 GURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CropID&corpsecret=$Secret"
10 Gtoken=$(/usr/bin/curl -s -G $GURL | awk -F\" ‘{print $10}‘)
11 PURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Gtoken"
12 
13 function body(){
14     local int AppID=1000002
15     local UserID=$1
16     local PartyID=1
17     local Msg=$(echo "$@" | cut -d" " -f3-)
18     printf ‘{\n‘
19     printf ‘\t"touser": "‘"$User"\"",\n"
20     printf ‘\t"toparty": "‘"$PartyID"\"",\n"
21     printf ‘\t"msgtype": "text",\n‘
22     printf ‘\t"agentid": "‘" $AppID "\"",\n"
23     printf ‘\t"text": {\n‘
24     printf ‘\t\t"content": "‘"$Msg"\""\n"
25     printf ‘\t},\n‘
26     printf ‘\t"safe":"0"\n‘
27     printf ‘}\n‘
28 }
29 /usr/bin/curl --data-ascii "$(body $1 $2 $3)" $PURL

 

微信报警脚本

标签:ascii   UNC   --   use   ==   ext   message   bin   des   

原文地址:https://www.cnblogs.com/vizier-bi/p/10068802.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!