SRL Archive - Research & Development Lounge

SendSMS using Google Voice via Simba!


Harry

2012-03-24 01:50:29

This function will send an SMS using Google Voice to the number of your choice, using Simba. FYI, Google Voice is currently only available 100% free for United States users, and you may only SMS to +1 country code (US/Canada).

At the moment, there are one blocker that you as a user will experience;
Problem: HTTPS sites do not load in Simba. This is due to lacking proper SSL libs.
Solution: Extract the two attached OpenSSL DLLs into the same folder as your Simba.exe. NOTE: OpenSSL uses an Original BSD-style license with an announcement clause that makes it "incompatible" with GPL; I am unsure if these dlls are legal to redistribute, and using OpenSSL is even illegal in some non-free countries, so use at your own risk.


Without further to do, here's the code! Enjoy, and post any bugs you have with it :)
program GoogleVoiceSMSSender;

(*
SendSMS
~~~~~~~~~~

.. code-block:: pascal

function SendSMS(yourEmail, yourPassword, toNumber, theMessage: string): boolean;

Sends an SMS from a Google Voice account to a mobile number in the US.

yourEmail/yourPassword should have a Google Voice number set up @ voice.google.com
toNumber should be a 10 digit US number; no spaces nor special characters.
theMessage should be under 160 characters.

Please don't use this to spam people! Google takes abuse seriously.

.. note::

Author: Harry and Sex
Last Modified: 4 November 2014

Example:

.. code-block:: pascal

if SendSMS('FakeGoogleLogin@gmail.com', 'mypassword', '5551231234', 'This Simba SMS sending is really cool!') then
WriteLn('Woohoo!');
*)
function SendSMS(yourEmail, yourPassword, toNumber, theMessage: string): boolean;
var
cl, i, redir: integer;
verifyStatus, s, loc, _rnr_se: string;
PostVars: TStringArray;
begin
try
cl := InitializeHTTPClient(True);
SetHTTPUserAgent(cl, 'SimbaVoice/0.2');

verifyStatus := '';
if (length(yourEmail) < 1) or (length(yourPassword) < 1) then
verifyStatus := 'up';
if (length(toNumber) <> 10) then
verifyStatus := 'number';
if (length(theMessage) > 160) then
verifyStatus := 'message';

case verifyStatus of
'up': WriteLn('Email or Password is invalid!');
'number': WriteLn('Number is invalid! Number must be 10 digits, no spaces or symbols.');
'message':
begin
WriteLn('WARNING: Your message is long (length: '+toStr(length(theMessage))+' characters)!');
WriteLn(' Your message should be under 160 characters, but it will most likely still go through.');
verifyStatus = '';
end;
end;
if (verifyStatus <> '') then
Exit;

WriteLn('Logging into Google Voice.'); // Load login page for GALX etc
s := GetHTTPPage(cl, 'https://accounts.google.com/ServiceLogin?service=grandcentral&passive=1209600&continue=https://www.google.com/voice&followup=https://www.google.com/voice&ltmpl=open');
if (length(s) < 10) then
begin
WriteLn('You don''t have the SSL libs for Simba, or https://accounts.google.com/ is blocked by your firewall.');
WriteLn('You must place libeay32.dll and libssl32.dll in the same folder as your Simba.exe!');
Exit;
end;

PostVars := ['Email', yourEmail,
'GALX', between(' value="', '">', s),
'Passwd', yourPassword,
'continue', 'https://www.google.com/voice',
'followup', 'https://www.google.com/voice',
'service', 'grandcentral',
'signIn', 'Sign in'];

for i := 0 to high(PostVars) do
begin
AddPostVariable(cl, PostVars[i], PostVars[i + 1]);
inc(i);
end;

s := PostHTTPPageEx(cl, 'https://accounts.google.com/ServiceLoginAuth');
ClearPostData(cl);
if (pos('LoginDoneHtml', s) <> 0) then
WriteLn('Login successful!')
else begin
WriteLn('Login failed. Check your username/password and ensure your Google account is validated.');
Exit;
end;

WriteLn('Loading inbox, please be patient...');
redir := 0;
repeat // follow Google's insane number of redirects.
loc := between('Location: ', #13#10, GetRawHeaders(cl));
writeln(loc);
if loc <> '' then
s := GetHTTPPage(cl, loc)
else
break;
DebugLn('Following link to '+ loc);
if (redir > 9) then
begin
WriteLn('Took over 9 redirects to get to Google Voice. Something is wrong!');
Exit;
end;
inc(redir);
until(loc = '');

_rnr_se := between('<input name="_rnr_se" type="hidden" value="','"/>',s); // Some anti-CSRF stuff Google has.
if (_rnr_se = '') then
begin
WriteLn('The CSRF code was not found properly!');
WriteLn('Ensure your Google Voice account works, and that you have a US-based IP address.'); // country-specific Google domains break this script for some reason, t.ex google.se
Exit;
end
else
DebugLn('CSRF: '+_rnr_se);

WriteLn('Sending SMS now...!');
AddPostVariable(cl, 'phoneNumber', '+1'+toNumber);
AddPostVariable(cl, 'text', theMessage);
AddPostVariable(cl, '_rnr_se', _rnr_se);
s := PostHTTPPageEx(cl,'https://www.google.com/voice/sms/send/');
ClearPostData(cl);

if (Pos('Your client has issued a malformed or illegal request',s) <> 0) then
begin
WriteLn('You got a HTTP-400 error from Google. This means you sent invalid cookies. This probably means your Simba is out of date.');
Exit;
end;

case s of // return codes. There is no published list, and these may be inaccurate.
'{"ok":true,"data":{"code":0}}':
begin
WriteLn('SMS sent okay!');
Result := True;
end;

'{"ok":false,"data":{"code":2046}}':
WriteLn('Error 2046: you do not have a Google Voice number.');

'{"ok":false,"data":{"code":67}}':
WriteLn('Error 67: invalid destination (only US numbers supported)');

else
WriteLn('We did not get a proper send code. Result: '+s);
end;

finally
FreeHTTPClient(cl);
end;
end;

begin
ClearDebug;

if SendSMS('usename@gmail.com','password','5555555555','Simba is cool!') then
writeln('Yay!');
end.

Enjoy. :)

Sex

2012-03-24 01:54:56

Looks good :).

Brotein

2012-03-24 02:01:49

Awesome work can't wait to try it out in a script!

P1nky

2012-03-24 03:35:51

Something I been waiting for! Thank You, must test!

Sex

2012-03-24 04:00:35

2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.

So we can just add it to LICENSE, no? Lol.

alexes

2012-03-24 05:17:39

=0 I ever wanted something like this. Awesome! Thank you Harry ^^

LordJashin

2012-03-24 14:15:15

I mentioned doing this in i believe Justin's thread. Good job, I didn't know there is blockers. Good to know nice tut! So in order for Simba to receive messages, maybe there is a way to log in to google voice and read the messages from a certain sender. You could also read the HTML page, and use that aswell.

Maybe, send message->Google voice->Forwards to some other email that is totally HTML based.

Just some suggestions. Also idk if you can email google voice, or the account then have that forwarded to your phone. I'd imagine there is some ways you could work this out, which would be the easiest?

Shatterhand

2012-03-24 15:52:20

Looks great, but what is the point of knowing our script ran into a random when we are out?

Sex

2012-03-24 16:18:31

From: hunt3rx3
Looks great, but what is the point of knowing our script ran into a random when we are out?


This could extend the functionality of RandomTool so that you may be able to reply with commands at one point, such as "Your account xxx has entered the xxx random. Reply with 'solve' or 'logout'." etc.

This can be used for things other than randoms with the addition of TMayaTimer (thanks Daniel!) we can do things like remote control.

Also, please note, I've never used Google Voice so I'm not sure if it is possible to receive messages.

LordJashin

2012-03-24 16:44:28

From: Sex
This could extend the functionality of RandomTool so that you may be able to reply with commands at one point, such as "Your account xxx has entered the xxx random. Reply with 'solve' or 'logout'." etc.

This can be used for things other than randoms with the addition of TMayaTimer (thanks Daniel!) we can do things like remote control.

Also, please note, I've never used Google Voice so I'm not sure if it is possible to receive messages.


It is possible I've used GV before. What is TMayaTimer O_O? Is that the maya plugin or whatever?

Sex

2012-03-24 16:50:39

From: LordJashin
It is possible I've used GV before. What is TMayaTimer O_O? Is that the maya plugin or whatever?


Nah, it is basically a working TTimer. It runs in a separate thread etc. It will be in Simba 0.99rc4.

hoopla

2012-03-26 15:58:27

Wonderful idea! Thank you kindly!!

shishio830

2012-05-12 10:56:52

hey i cant code because i dont really understand the tutorials but was trying to read through this code i guess, i wanted it just to text me if it was stuck in a random but just if its in a random mind enligtening me?

caused

2012-06-08 08:57:48

Logging into Google Voice.
Login successful!
Sending SMS...
You got a HTTP-400 error from Google. This means you sent invalid cookies. This probably means your Simba is out of date.
Successfully executed.

This looks so awesome.

Is there a fix to make it work again yet ? Got Simba Rev. 984


//or it maybe that its still working just for for EU numbers

Sex

2012-06-08 16:59:37

From: caused
Logging into Google Voice.
Login successful!
Sending SMS...
You got a HTTP-400 error from Google. This means you sent invalid cookies. This probably means your Simba is out of date.
Successfully executed.

This looks so awesome.

Is there a fix to make it work again yet ? Got Simba Rev. 984


//or it maybe that its still working just for for EU numbers

Read again the solution for problem 1.

Velvet Glam

2012-06-08 17:28:40

cool..

Is this HTTP stuff the same as a webrequest?

Sex

2012-06-08 17:48:50

From: Velvet Glam
cool..

Is this HTTP stuff the same as a webrequest?


Yes.

Luke L

2012-07-04 04:12:26

I have been thinking about this for months! I even posted a thread about it, and people said "yeah it could be possible", and here it is. It's been here for like 4 months and I'm just now seeing it!?!?

By the way, I intend on using this to help me get my max cape. I plan on using it when doing skills like wcing in remote areas where you don't see anyone for hours upon hours besides an occasional bot hunter - I have a "SomeoneTalked" function (thanks to sin :D) that I call with FindNormalRandoms, and I have it play a loud alarm to alert me so I can get to my pc and respond. Obviously this only works throughout my house.

But it'll be nice to be out and still have bot running, so if someone talks I can have a text sent to me, and I can get on team viewer via my iPhone and respond!

Wala, 24 hr safe botting, with REAL human responses ;)!!!

Master BAW

2012-07-04 05:37:13

Really cool! Will test this in à while ;))))

shstiger2009

2012-07-05 16:33:07

From: Sex
This could extend the functionality of RandomTool so that you may be able to reply with commands at one point, such as "Your account xxx has entered the xxx random. Reply with 'solve' or 'logout'." etc.

This can be used for things other than randoms with the addition of TMayaTimer (thanks Daniel!) we can do things like remote control.

Also, please note, I've never used Google Voice so I'm not sure if it is possible to receive messages.


This is exactly what I did until Warrior's site went down. I'd just use the Random Tool so it stopped my script, and have a SMS message sent to my phone. I'd login via TeamViewer and if it was one I know Simba solves, click let SRL do it. If not, I'd either just logout or do it myself. Worked really well.

Being able to get a SMS sent to your phone saying- "You are in the Molly Random. Reply SOLVE to solve, or LOGOUT to logout" would be even sweeter. To know what random we were in would be awesome.

We need to make this happen!

footballjds

2012-07-05 16:42:01

nice, subscribing till simba official release solves issues.

Harry

2014-11-04 11:27:17

Updated this, fixed some stuff, added stuff. Let me know if any problems!

KeepBotting

2014-11-04 11:51:09

Woo, looks like Harry is back in the game :)
From: Harry
Updated this, fixed some stuff, added stuff. Let me know if any problems!

footballjds

2014-11-04 15:25:32

From: Harry
Updated this, fixed some stuff, added stuff. Let me know if any problems!


Do we still need to muck around to get this to work in Simba?

The Mayor

2014-11-04 15:41:25

I think push notifications are easier and more customisable, especially these days with smart phones

footballjds

2014-11-04 15:47:00

From: The Mayor
I think push notifications are easier and more customisable, especially these days with smart phones


for the average leach it will be easier to provide a phone number than to ask them to install notifio.

Harry

2014-11-04 16:16:35

From: footballjds
Do we still need to muck around to get this to work in Simba?

Just the OpenSSL dlls need to be dropped into the Simba.exe folder, sadly. Dunno if that will ever be packaged into Simba anytime soon, probably not a high priority. Your scripts can still compile etc with this code+without dll, just won't actually work.

From: The Mayor
I think push notifications are easier and more customisable, especially these days with smart phones

SMSes can be sent to anyone though with less setup also, but yeah that's cool too :D

Wizzup?

2014-11-05 04:44:59

What version of openssl does Simba currently require? We can ship openssl libs, I think, at least as external package, but then I do want to ship recent ones that are not -too- vulnerable.

JJordan

2014-11-14 00:34:53

I've been trying to figure out how to implement this into my private scripts recently. Thanks!