| version 1.8, 2002/06/17 17:45:55 |
version 1.9, 2002/06/18 07:12:43 |
|
|
| # Based on script flash.sh by Ondrej Jombik |
# Based on script flash.sh by Ondrej Jombik |
| # Copyright (c) 2002 Platon SDG, http://www.platon.sk/ |
# Copyright (c) 2002 Platon SDG, http://www.platon.sk/ |
| # |
# |
| # You'll need wget-special which saves also transitional cookies |
|
| # if you're on pauli server try /home/k/9karas/bin/wget-special |
|
| # |
|
| |
|
| # $Id$ |
# $Id$ |
| |
|
|
|
| text=`echo "$text" | sed 's/%/%25/g; s/\+/%2B/g; s/ /+/g; s/&/%26/g'`; |
text=`echo "$text" | sed 's/%/%25/g; s/\+/%2B/g; s/ /+/g; s/&/%26/g'`; |
| |
|
| # download the file via special wget which stores session cookie to a file |
# download the file via special wget which stores session cookie to a file |
| wget-special \ |
echo 'Logging in...' |
| -q \ |
COOKIE=`GET -e -H "Cookie: SITY=SITY" \ |
| --delete-after \ |
http://www.sity.sk/pls/sity/u_registrate2.login2?NAME="$NAME"\&PASSWD="$PASS"\&ASERVICE=0\&CMD=%21u_sms.home\&SERVICE=0 \ |
| --save-cookies cookies.tmp.txt \ |
| grep '^Set-Cookie' | sed 's/^Set-Cookie: SITY=\([0-9A-F]*\).*/\1/'` |
| --header="Cookie: SITY=SITY" \ |
|
| http://www.sity.sk/pls/sity/u_registrate2.login2?NAME="$NAME"\&PASSWD="$PASS"\&ASERVICE=0\&CMD=%21u_sms.home\&SERVICE=0 |
echo 'Retrieving submit forms...' |
| |
GET -H "Cookie: SITY=$COOKIE" \ |
| wget-special \ |
http://www.sity.sk/pls/sity/\!u_sms.home >tmp.html |
| --output-document=tmp.html \ |
|
| -q \ |
|
| --load-cookies cookies.tmp.txt \ |
|
| --save-cookies cookies.tmp.txt \ |
|
| http://www.sity.sk/pls/sity/\!u_sms.home |
|
| |
|
| #we now extract textarea name, which will be used later |
#we now extract textarea name, which will be used later |
| textareaname=`grep 'textarea cols' tmp.html | sed 's/.*name="\([^"]*\)".*/\1/g'` |
textareaname=`grep 'textarea cols' tmp.html | sed 's/.*name="\([^"]*\)".*/\1/g'` |
| detailvalue=`grep 'DETAIL' tmp.html | sed 's/.*value="\([^"]*\)".*/\1/g'` |
detailvalue=`grep 'DETAIL' tmp.html | sed 's/.*value="\([^"]*\)".*/\1/g'` |
| Line 77 detailvalue=`grep 'DETAIL' tmp.html | se |
|
| Line 69 detailvalue=`grep 'DETAIL' tmp.html | se |
|
| echo 'Hold still, we need to wait 4 seconds.' |
echo 'Hold still, we need to wait 4 seconds.' |
| sleep 4 |
sleep 4 |
| |
|
| wget-special --output-document=tmp2.html \ |
echo 'Submitting SMS...' |
| -q \ |
GET -H "Cookie: SITY=$COOKIE" \ |
| --load-cookies cookies.tmp.txt \ |
http://www.sity.sk/pls/sity/\!u_sms.send_sms?MSG_TEXT="$text"\&SMSMsgLen=480\&SMScount=\&"$textareaname"="$1"\&BT.x=0\&BT.y=0\&DETAIL="$detailvalue" \ |
| --user-agent="Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6c" \ |
> tmp2.html |
| http://www.sity.sk/pls/sity/\!u_sms.send_sms?MSG_TEXT="$text"\&SMSMsgLen=480\&SMScount=\&"$textareaname"="$1"\&BT.x=0\&BT.y=0\&DETAIL="$detailvalue" |
|
| |
|
| smss_left=`grep "Tento mesiac" tmp2.html | sed 's/.*va \([0-9]*\) spr.*/\1/'` |
smss_left=`grep "Tento mesiac" tmp2.html | sed 's/.*va \([0-9]*\) spr.*/\1/'` |
| |
|
| Line 90 if [ $smss_left ]; then |
|
| Line 81 if [ $smss_left ]; then |
|
| # delete unnecessary files, now leaving for debug.. |
# delete unnecessary files, now leaving for debug.. |
| rm tmp.html |
rm tmp.html |
| rm tmp2.html |
rm tmp2.html |
| rm cookies.tmp.txt |
|
| else |
else |
| echo 'Something went wrong, see debug files (tmp.html, tmp2.html, cookies.tmp.txt)' |
echo 'Something went wrong, see debug files (tmp.html, tmp2.html).' |
| fi |
fi |
| |
|