1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
| #!/bin/bash
export TheHost='https://tp.m-team.cc'
export Account='username=用户名&password=密码'
export MyeMail='邮箱'
export Decrypt='0'
export HostUrl="$(echo "${TheHost}" |awk -F '://|/' '{print $2}')"
export dirCookie='/tmp/cookie.txt'
Request(){
URL="${1}"
DATA="${2:-}"
ItRef="${3:-login.php}"
[[ -z "$(echo "${URL}" |grep '://')" ]] && echo "Error! URL incorrect. " && exit 1
[ -n "${Decrypt}" ] && [ "${Decrypt}" -eq '1' ] && [ "${ItRef}" != 'login.php' ] && {
curl -k --silent \
-H 'Host: '${HostUrl}'' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: zh-CN,en-US;q=0.8,zh;q=0.5,en;q=0.3' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Referer: '${TheHost}'/'${ItRef}'' \
-H 'Connection: keep-alive' \
-b ''${dirCookie}'' \
-c ''${dirCookie}'' \
${DATA} ''${URL}'' |gzip -dc
} || {
curl -k --silent \
-H 'Host: '${HostUrl}'' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: zh-CN,en-US;q=0.8,zh;q=0.5,en;q=0.3' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Referer: '${TheHost}'/'${ItRef}'' \
-H 'Connection: keep-alive' \
-b ''${dirCookie}'' \
-c ''${dirCookie}'' \
${DATA} ''${URL}''
}
}
uMessages(){
export ReceiveBox=''${1:-action=viewmailbox&box=1&unread=yes}''
[[ -z "$(echo "$(Request ''${TheHost}'/usercp.php' '-X GET' 'index.php')" |grep 'messages.php' |grep 'embedded')" ]] && export Unread='0' || export Unread='1'
[ "${Unread}" -eq '1' ] && ReadIt="$(echo "$(Request ''${TheHost}'/messages.php?'${ReceiveBox}'' '-X GET' 'messages.php')" |grep -A1 'unreadpm' |grep 'messages.php?action=viewmessage')"
[ "${Unread}" -eq '1' ] && [ -n "${ReadIt}" ] && [ -n "$(which mailx)" ] && TheMessage="$(echo "$(echo "${ReadIt}" |awk -F '"' '{print $2}')" |head -n 1)" && echo "$(Request ''${TheHost}'/'${TheMessage}'' '-X GET' 'messages.php')" >/dev/null
[ "${Unread}" -eq '1' ] && [ -n "${ReadIt}" ] && [ -n "$(which mailx)" ] && [ -n "${TheMessage}" ] && echo -e "New Message\n\n"$(echo "${ReadIt}" |awk -F '<|>' '{print $5}' |head -n 1)"\n"${TheHost}"/"${TheMessage}"\n" |mailx -s "Notice for ${HostUrl}" "${MyeMail}"
[ "${Unread}" -eq '0' ] || uMessages 'action=viewmailbox&box=-2&unread=yes'
}
Request ''${TheHost}'/takelogin.php' '-X POST -d '${Account}'' >/dev/null
[[ -n "$(echo "$(Request ''${TheHost}'/usercp.php' '-X GET' 'index.php')" |grep 'logout.php')" ]] && Login='1' || Login='0'
[[ "${Login}" -eq '1' ]] && {
echo -e "
[ -n "${MyeMail}" ] && uMessages;
rm -rf "${dirCookie}";
exit 0
} || {
[ -n "${MyeMail}" ] && [ -n "$(which mailx)" ] && echo -e "$(date "+%F [%T]")\nLogin Fail! " |mailx -s "Notice for ${HostUrl}" "${MyeMail}"
echo -e "#${HostUrl}#\nLogin Fail! " && rm -rf "${dirCookie}";
exit 1
}
|