Loading... **说明:** 最近在handsome主题群里,挺多人遭到攻击。偶然间在loc看到了一个:`CF自动开启5秒盾 + 验证码脚本`的帖子,不需要自己手动去开启。自己试了下感觉还行,由于有的网友不太会,所以应网友要求写了这个文章。 项目开源地址:https://github.com/jiuqiMax/autouam **autouam** 通过检测系统负载(cpu或load)`自动开启cloudflare UAM和challenge`(验证码) 注意!默认challenge=1,将在开启UAM的同时开启验证码。如果你不想,请将它设为0 CloudFlare官网:https://www.cloudflare.com/ 需要自行注册账户,这里就不多讲大致就是输入邮箱+密码+验证邮箱就ok. 下载脚本: wget https://raw.githubusercontent.com/gynotes/autouam/master/autouam.sh && chmod +x autouam.sh 修改以下三项: email="`注册邮箱`" CloudFlare 账号邮箱 api_key="`API key`" CloudFlare API KEY zone_id="`区域id`" 区域ID 在域名的概述页面获取 Zone ID获取方式:域名的概述页面下拉获取 ![Zone id][1] Api Key获取方式:点击`Get your API token`---->`VIEW`输入密码及验证码取得。 ![api key][2] 设定计划任务每分钟执行: * * * * * bash /root/autouam.sh ok,配置完成,如果需要其余配置自行修改。 **测试是否能自动开启:** 将上面文件中的负载改低,新建一个文件,将下面占用服务器资源的代码放进去执行。查看网站是否自动开启验证码。 vim cpu.sh #!/bin/bash while (true); do { for i in $(seq 100000 100100) do X=`expr $i \* 3 + $i \* 9999`; echo $X >> /tmp/a.txt; done echo "" > /tmp/a.txt } done 执行autouam.sh,cpu占用超过30自动开启 ![开启验证码][3] ![开启验证码2][4] ![当前状态][5] 关闭之前执行的占用服务器资源的进程 ![自动关闭验证码][6] ![自动关闭2][7] [1]: https://cdn.jsdelivr.net/gh/gynotes/demo/mg/autouamzone.png [2]: https://cdn.jsdelivr.net/gh/gynotes/demo/mg/autouamkey.png [3]: https://cdn.jsdelivr.net/gh/gynotes/demo/mg/autouamfz.png [4]: https://cdn.jsdelivr.net/gh/gynotes/demo/mg/autouamyz.png [5]: https://cdn.jsdelivr.net/gh/gynotes/demo/mg/autouamfz2.png [6]: https://cdn.jsdelivr.net/gh/gynotes/demo/mg/autouamgb.png [7]: https://cdn.jsdelivr.net/gh/gynotes/demo/mg/autouamgb2.png<hr class="content-copyright" style="margin-top:50px" /><blockquote class="content-copyright" style="font-style:normal"><p class="content-copyright">版权声明:版权归 <span class="external-link"><a class="no-external-link" href="http://geeh.cn" target="_blank">怪友<i data-feather='external-link'></i></a></span> 所有,转载请注明出处!</p><p class="content-copyright">本文链接:<a class="content-copyright" href="https://www.geeh.cn/archives/44/">https://www.geeh.cn/archives/44/</a></p><p class="content-copyright">如果博客出现404或链接失效,请留言或者联系博主修复!</p></blockquote> Last modification:April 30th, 2020 at 08:39 pm © 允许规范转载
用着不错,感谢分享