Skip to content

Commit

Permalink
Update to work with new vodacom portal Mar 2011
Browse files Browse the repository at this point in the history
  • Loading branch information
singe committed Nov 15, 2011
1 parent 0f71128 commit 47fc7ad
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 44 deletions.
5 changes: 5 additions & 0 deletions Changelog
@@ -1,3 +1,8 @@
1st March 2011:
* Updated for the new Vodacom portal & msg sending. Significant changes required.
* Added usage output when no params
* Added a real dirty install.sh

2nd June 2006:
* Added support for displaying the number of sms'es left.
* Rewrote the innards to be more modular.
Expand Down
14 changes: 9 additions & 5 deletions README
@@ -1,8 +1,9 @@
VodaSMS

This program was written to avoid the horrors of the Vodacom4me website
(http://www.vodacom4me.co.za). It allows you to do all sorts of things with
your sms account without having to leave the comfort of your command line.
This program was initialy written to avoid the horrors of the Vodacom4me
website since rebranded as the Vodacom Portal (http://www.vodacom.co.za). It
allows you to do all sorts of things with your sms account without having to
leave the comfort of your command line.

Getting Started
---------------
Expand All @@ -24,10 +25,12 @@ Getting Started

* Send an sms.

* There is a very quick 'n dirty install script that will do some of this for you. From the tarball extracted directory run ./install.sh

Usage
-----

vodasms [number|name from phonebook] <message>
vodasms <number|name from phonebook> <message>

e.g.
vodasms +27821234567 hello
Expand All @@ -39,13 +42,14 @@ Testing
My number is in the default phonebook, and I like getting sms'es. So send me an
sms telling me what you think.

e.g.
vodasms Dominic "OMFG I have never seen such awful Perl, and that's saying a lot\!"

License
-------

This software is licensed under the GPLv2 by Dominic White
(http://singe.rucus.net/)
(http://singe.za.net/)

The use of the software may be illegal and the user does so at their own risk.
This software is provided for demonstration/educational use only.
15 changes: 15 additions & 0 deletions install.sh
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
echo Making directory ~/.vodasms
mkdir ~/.vodasms
echo Copying files into above directory
cp -R vodaform vodasms.ini phonebook.example ~/.vodasms/
echo Making ~/bin
mkdir ~/bin
echo Copying vodasms into the above
cp vodasms ~/bin
echo Creating the default phone book
mv ~/.vodasms/phonebook.example ~/.vodasms/phonebook
echo Editing the .ini to point to the new ~/.vodasms directory
sed -i.orig -e "s/<installdir>/\~\/.vodasms\//g" ~/.vodasms/vodasms.ini
echo Done
echo Make sure to edit ~/.vodasms/vodasms.ini to add your username/password
11 changes: 6 additions & 5 deletions vodaform/vodalogin.html
@@ -1,11 +1,12 @@
<html>
<head><title>i.hate.vodacom4me</title></head>
<body>
<form method="post" id="formlogin" action="https://www.vodacom4me.co.za/vodacom4me-personal/login.do">
<input type="text" name="V_LOGIN_NAME" value="" class="cellform" /><br />
<input type="password" name="V_PASSWORD" value="" class="passwordform" maxlength="64" /><br />
<input name="image" type="submit" id="Login" />
<form method="post" id="formlogin" action="https://www.vodacom.co.za/portal/site/myaccount/template.VCOMLOGIN/action.process/">
<input type="text" name="realm" value="realm1" class="cellform" /><br />
<input type="text" name="logon" value="" class="cellform" /><br />
<input type="password" name="password" value="" class="passwordform" maxlength="64" /><br />
<input name="submit" type="submit" id="Login" />
</form>
<a href="http://www.vodacom4me.co.za/vodacom4me-personal/logout.do" title="Logoff">Logoff</a>
<a href="https://www.vodacom.co.za/portal/site/myaccount/template.LOGOUT/" title="Logoff">Logoff</a>
</body>
</html>
30 changes: 16 additions & 14 deletions vodaform/vodasend.html
@@ -1,21 +1,23 @@
<html>
<head><title>i.hate.vodacom4me</title></head>
<body>
<form name="smsForm" method="post" action="http://www.vodacom4me.co.za/vodacom4me-personal/sendSMS.do?operation=init&send=yes">
<input type="hidden" name="picture" value="null.gif" /><br />
<input type="text" name="message.recipient" size="50" value="" /><br />
<textarea name="message.message" cols="40" rows="5"style="width:290pt"></textarea><br />
<!--<form name="smsForm" method="post" action="URL=https://www.vodacom.co.za/portal/site/myaccount/template.PAGE/action.process/freemessaging/?javax.portlet.action=true&javax.portlet.tpst=214d238c7916ac93197bd620413f37a0&javax.portlet.prp_214d238c7916ac93197bd620413f37a0=SendSMS%3DSendSMS&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken">-->
<form name="smsForm" method="post" action="https://www.vodacom.co.za/portal/site/myaccount/template.PAGE/action.process/freemessaging/?javax.portlet.action=true&javax.portlet.tpst=214d238c7916ac93197bd620413f37a0&javax.portlet.prp_214d238c7916ac93197bd620413f37a0=SendSMS%3DSendSMS&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken">
<input type="hidden" name="recipient" value="" /><br />
<input type="hidden" name="contactListBox" value="0" /><br />
<input type="hidden" name="futureSMSTime" value="now" /><br />
<input type="hidden" name="sendDate" value="" /><br />

<textarea name="messageBody" cols="40" rows="5"style="width:290pt"></textarea><br />
<input type="text" name="hiddenDestinationNumber" size="50" value="" /><br />

<input type="hidden" name="hiddenName" value="" /><br />
<input type="hidden" name="hiddenSaveSMS" value="" /><br />
<input type="hidden" name="scheduledSMS" value="" /><br />
<input type="hidden" name="hideCurrentSelectedDestination" value="" /><br />

<input type="submit" name="SendSMSButton" value="Send SMS" />
<p />
<select name="QuickList" size="1">
<option selected value="">--Quick list--</option>
</select>
<input type="button" name="Contacts" value="Contacts" />
<input type="checkbox" name="autoPopUp" value="on" />
<input type="checkbox" name="flashingSMS" value="on" />
<INPUT TYPE="TEXT" NAME="charsLeft" SIZE="3" VALUE="" readonly="readonly" />
<input type="text" name="numOfMsg" size="1" value="1" readonly="readonly" />
</form>
<a href="http://www.vodacom4me.co.za/vodacom4me-personal/logout.do" title="Logoff">Logoff</a>
<a href="https://www.vodacom.co.za/portal/site/myaccount/template.LOGOUT/" title="Logoff">Logoff</a>
</body>
</html>
46 changes: 28 additions & 18 deletions vodasms
@@ -1,16 +1,16 @@
#!/usr/bin/perl -w
#!/usr/bin/env perl -w
#location of user installed modules e.g. WWW::Mechanize (Mechanize.pm)
#this is useful if not root and unable to install necessary modules
#BEGIN { unshift @INC, qw(/home/user/bin/perlmods); }

#Created by singe@rucus.net
#Created by singe (http://singe.za.net/)
#Based on an idea originally by vhata@rucus.net
#Script written to make using the vodacom4me service a little less horrendous.

#This script is licensed under the GPL
#Use of this script may be illegal, do so at your own risk
#Use of this script may violate Voacom's terms of service, do so at your own risk

#June 3rd 2006
#Jan 1st 2011

use strict;
use warnings;
Expand Down Expand Up @@ -59,8 +59,17 @@ my $maxmsgs=$cfg->val( 'sms', 'maxmsgs' );

#Get user input
sub get_input {
my ($num,@msg)=@_;
# Check for blanks
if (@_ == 0) {
print "VodaSMS by Dominic White\n";
print "\tusage: vodasms <number|phonebook name> <msg>\n";
print "You may need to \"quote\" the message.\n";
print "Check the config .ini for settings.\n";
exit;
}

# Read input
my ($num,@msg)=@_;
my $msg="@msg";

return ($num,$msg);
Expand Down Expand Up @@ -146,10 +155,10 @@ sub login {
$browser->submit_form(
form_number => 1,
fields => {
V_LOGIN_NAME => $user,
V_PASSWORD => $pass
logon => $user,
password => $pass
},
button => 'image'
button => 'submit'
);
return $browser;
}
Expand All @@ -159,14 +168,14 @@ sub send_sms {
my ($num,$msg,$browser) = @_;

#Goto the SMS page
$browser->get("file:///$sendform");
$browser->get("file:///$sendform");

#Send the SMS
$browser->submit_form(
form_name => "smsForm",
fields => {
'message.recipient' => $num,
'message.message' => $msg
'hiddenDestinationNumber' => $num,
'messageBody' => $msg
},
button => 'SendSMSButton'
);
Expand All @@ -177,11 +186,11 @@ sub send_sms {
#Log out
sub log_out {
my ($browser) = @_;
$browser->get("http://www.vodacom4me.co.za/vodacom4me-personal/logout.do");
$browser->get("https://www.vodacom.co.za/portal/site/myaccount/template.LOGOUT/");
return $browser;
}

#Check status and log out
#Check status
sub check_success {
my ($msg,$nummsgs,$browser) = @_;

Expand All @@ -191,7 +200,7 @@ sub check_success {
}
else {
my $err = $browser->res();
$browser = log_out($browser);
#$browser = log_out($browser);
die "There was an error trying to send the SMS:".$err."\n";
}
return $browser;
Expand All @@ -203,15 +212,16 @@ sub smses_left {
my $sms;

if ($sms_left) {
$browser->get("http://www.vodacom4me.co.za/vodacom4me-personal/homepage.do?operation=init");
$browser->get("https://www.vodacom.co.za/portal/site/myaccount/freemessaging/");
$sms = $browser->content();

#This code is sensitive to changes by Vodacom, it assumes the following HTML
#line:
#<span class="vodacomblue">&raquo;Free SMS's left =</span><span class="vodacomgreen"> 18 of 20 <a href="/vodacom4me-personal/sendSMS.do?operation=init" class="breadcrumb">&raquo;send now</a></span>
while($sms =~ s/.*?Free SMS's left.*?"> (.*?) of 20//) {
#&nbsp;&nbsp;Free SMS's Left today: 20</td>
while($sms =~ s/.*Free SMS's Left today: (..)//) {
$sms=$1;
}
#$sms =~ s/.*Left today: (.*?)<\/td>/$1/;

print "You have ".$sms." sms'es left.\n";
}
Expand Down Expand Up @@ -241,7 +251,7 @@ sub start {
#print $browser->content();
#print "\n\n URI : ".$browser->uri() ."\n";
#print "\n\n Cookie : ".$browser->cookie_jar->as_string()."\n";
#$browser->get("http://www.vodacom4me.co.za/vodacom4me-personal/logout.do");
$browser = log_out($browser);
#die "DEBUG";
}

Expand Down
4 changes: 2 additions & 2 deletions vodasms.ini
Expand Up @@ -18,8 +18,8 @@ password=
;e.g.
;phonebook=~/.vodasms/phonenums
[files]
phonebook=<installdir>.phonenums
log=<installdir>.smslog
phonebook=<installdir>phonebook
log=<installdir>smslog

;The vodacom4me site is written horribly, using these forms allows for much
;faster sms sending and saner code. Advanced users can tweak these.
Expand Down

0 comments on commit 47fc7ad

Please sign in to comment.