利用飛信給本身發短信的shell腳本翻譯自一個python腳本由於openwrt要裝python太大了.因此用了兩天非工做時間 翻譯成了 shell腳本 .測試可用.html
http://dl.dbank.com/c030f0gldipython
#!/bin/sh #Convert Python Fetion To @2012 user='xxxxxxxxx' #飛信帳號 通常是你的手機號 password='xxxxx' #飛信密碼,希望只有你本身知道. loginstatus='4' url_login='http://f.10086.cn/im/login/inputpasssubmit1.action' url_logout='http://f.10086.cn//im/index/logoutsubmit.action' url_msg='http://f.10086.cn/im/user/sendMsgToMyselfs.action' TempDir='shfethionTmp' read -p "please enter :" msg $msg [ -d "$TempDir" ]; rm -rf ${TempDir} "$TempDir" "$TempDir" fi wget -q -P ${TempDir} --save-cookies=${TempDir}/cookie --keep-session-cookies --post-data "m=${user}&pass=${password}&loginstatus=${loginstatus}" ${url_login} url=`grep -Eo '<card id="start".*?(ontimer="(.*?))' ${TempDir}/inputpasssubmit1.action | grep -Eo '(\/+[^\s]*)n'` arg_t=`grep -Eo '<card id="".*?(ontimer="(.*?))' ${TempDir}/inputpasssubmit1.action | grep -Eo 't=\w+'` $url [ "${url}" = '/im/login/login.action' ]; 'Login Failed!' 0 'Login Successfully!' fi wget -q -P ${TempDir} --load-cookies=${TempDir}/cookie --keep-session-cookies --post-data "msg=${msg}" ${url_msg} $arg_t wget -q -P ${TempDir} --load-cookies=${TempDir}/cookie --keep-session-cookies --post-data "${arg_t}" ${url_logout} 'Logout Successfully!' rm -rf ${TempDir}