微信、钉钉验证登录服务器

网友投稿 284 2022-10-01

微信、钉钉验证登录服务器

一、服务器被非法登录的前夕

何时被非法登录的? 非法登录者使用哪个账号登录的? 非法登录者身在何处? 非法登录者做过什么操作? 如何避免服务器中毒,被非法登录 所谓知己知彼,方能百战不殆

二、剖析问题并解决

1.1 获取AgentId(AppID)、Secret

1.2 获取 CropID

放到/etc/profile.d/ 登录自动触发

#!/bin/bash #WeiXin ENV------------------------------------------------------------------------------------- CropID='ww022bebbed74xxxx' Secret='RauJ_-t-LxBhfEN7g1sh4OhVB_vREBWvqeFaaxxxxx' APIURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CropID&corpsecret=$Secret" TOKEN=$(/usr/bin/curl -s -G $APIURL | awk -F\" '{print $10}') POSTURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$TOKEN" ##WeiXin body-------------------------------------------------------------------------------------- function body() { local int AppID=1000004 local UserID=xuewenlong local PartyID=2 printf '{\n' printf '\t"touser": "'"$UserID"\"",\n" printf '\t"toparty": "'"$PartyID"\"",\n" printf '\t"msgtype": "text",\n' printf '\t"agentid": "'"$AppID"\"",\n" printf '\t"text": {\n' printf '\t\t"content": "'"$Msg"\""\n" printf '\t},\n' printf '\t"safe":"0"\n' printf '}\n' } Status=`who am i | awk '{print $NF}' | sed 's/(//g' | sed 's/)//g'` if [ -n "$Status" ]; then Msg="有用户上线请注意:\n主机名:`hostname`\n主机ip:`ifconfig ens33 | grep "inet" | awk 'NR==1{ print $2}'`\n登录用户:`whoami`\n地址来源:"$Status"" /usr/bin/curl -s --data-ascii "$(body guozhiheng0123 $2)" $POSTURL 2>&1 > /dev/null fi

3、登录用户需要二次验证码 验证

read 读入

三、非法登录者做过什么操作

一般通过几种手段去做:

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:使用Docker构建JenkinsCICD自动发布
下一篇:Java超详细讲解排序二叉树
相关文章

 发表评论

暂时没有评论,来抢沙发吧~