Bash/Shell查询光猫运行状态(光纤光衰,运行温度等...)
2021/7/11 7:08:07
本文主要是介绍Bash/Shell查询光猫运行状态(光纤光衰,运行温度等...),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
#!/bin/bash #查询光猫状态:光纤光衰值等... #匹配型号:友华 PT926G modemType="友华 PT926G" trap "rm -f $cookieFile" 0 curl -s 'http://192.168.1.1:8080/boaform/admin/formLogin' \ -H 'Connection: keep-alive' \ -H 'Pragma: no-cache' \ -H 'Cache-Control: no-cache' \ -H 'Origin: http://192.168.1.1:8080' \ -H 'Upgrade-Insecure-Requests: 1' \ -H 'DNT: 1' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ -H 'Referer: http://192.168.1.1:8080/admin/login.asp' \ -H 'Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6,zh-TW;q=0.5' \ --data-raw 'csrfmiddlewaretoken=KbyUmhTLMpYj7CD2di7JKP1P3qmLlkPt&csrfmiddlewaretoken=KbyUmhTLMpYj7CD2di7JKP1P3qmLlkPt&username=telecomadmin&psd=xxxxxxzE3MTU1MzQ%3D&postSecurityFlag=37558&csrftoken=b5c8cda4e0a34ce43ec6abae32d443ee' \ >/dev/null curlInfo=$(curl -sS http://192.168.1.1:8080/status_gpon.asp|iconv -f GBK -t UTF-8|grep -A 22 '<b>光模块信息</b>') echo "$modemType 当前光猫信息如下:" echo "$curlInfo"|sed -r 's/<[^>]+>//g;s/\s//g;/^\s*$/d'|awk '{printf $0;if(NR%2!=0){printf "\n";}else{printf ":"}}'
这篇关于Bash/Shell查询光猫运行状态(光纤光衰,运行温度等...)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-02Java管理系统项目实战入门教程
- 2024-11-02Java监控系统项目实战教程
- 2024-11-02Java就业项目项目实战:从入门到初级工程师的必备技能
- 2024-11-02Java全端项目实战入门教程
- 2024-11-02Java全栈项目实战:从入门到初级应用
- 2024-11-02Java日志系统项目实战:初学者完全指南
- 2024-11-02Java微服务系统项目实战入门教程
- 2024-11-02Java微服务项目实战:新手入门指南
- 2024-11-02Java项目实战:新手入门教程
- 2024-11-02Java小程序项目实战:从入门到简单应用