Make your own SMS sender in LINUX!!! [Warid, Telenor Added]

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.
Post Reply
masud
Havaldaar
Posts: 108
Joined: Thu Aug 05, 2004 12:15 am
Location: Fremont, CA
Contact:

Make your own SMS sender in LINUX!!! [Warid, Telenor Added]

Post by masud »

salamz
i got som thing for programmers :) its a open source code for sms sending protocol use by mobile companies ,,, follow the instruction and make a one for your self thnx....

Mobilink:
http://www.linuxpakistan.net/forum2x/vi ... 6326#26326

Ufone:
http://www.linuxpakistan.net/forum2x/vi ... 6338#26338

Warid::
http://www.linuxpakistan.net/forum2x/vi ... 6700#26700

Telenor:
http://www.linuxpakistan.net/forum2x/vi ... 0035#30035

Detail: (paktel, insta)
http://www.linuxpakistan.net/forum2x/vi ... 6662#26662

Thanks
Last edited by masud on Sun Oct 01, 2006 10:55 pm, edited 5 times in total.
--SP--
LinuxFreaK
Site Admin
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
Location: Karachi
Contact:

Re:

Post by LinuxFreaK »

Dear masud,
Salam,

Great !!

Best Regards.
Farrukh Ahmed
Kdaemon
Naib Subedar
Posts: 346
Joined: Sat Nov 30, 2002 12:22 pm
Location: Islamabad. GPS: LHR

Post by Kdaemon »

Code: Select all

#!/usr/bin/perl
# Mobilink SMS Gateway Interface

$aginame="sms300";

use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>3, Port=>51215, Errmode=>'die');
$telnet->open('202.125.143.22');
$telnet->waitfor('//');
$telnet->print('#LOGIN#SMS Messenger');
($output)=$telnet->getline;
$pin = substr($output,9,7);
$telnet1 = new Net::Telnet ( Timeout=>3, Port=>51215, Errmode=>'die');
$telnet1->open('202.125.143.22');
$telnet1->waitfor('//');
$telnet1->print("#JAFERY#\$#CELL#\$$ARGV[0]\$#MSG#\$CONVE: $ARGV[1]\$#FROM#\$$pin\$#IP#\$202.125.143.22\$#END#\$");
$telnet->print('quit');
#perl script.pl cellno 'message'

this was the perl sms script used to send sms back last year, I think they have changed something and script is not working... :roll:
reg linux user #298274
masud
Havaldaar
Posts: 108
Joined: Thu Aug 05, 2004 12:15 am
Location: Fremont, CA
Contact:

Post by masud »

yes they do change it IP and port number remains the same but all they included is a junk of data with msg as
WEBCHAT||12345678||SPLAYER: hi
now they folow this rule to send sms

adopt coding from my intro n make a one for perl :)
thnx
--SP--
n3m3sis
Havaldaar
Posts: 123
Joined: Sun Apr 18, 2004 2:35 pm
Location: Islamabad

Post by n3m3sis »

great!!

Thanks!
whizkid
Cadet
Posts: 8
Joined: Sat Oct 16, 2004 8:18 pm
Location: Karachi
Contact:

Post by whizkid »

In an independent approach... I made an application for it. You can download the j2me app here:
http://nasim.org/mobile/download.wml

and send free messages through GPRS from your cell phone to ufone/mobilink!

:-)
n3m3sis
Havaldaar
Posts: 123
Joined: Sun Apr 18, 2004 2:35 pm
Location: Islamabad

Post by n3m3sis »

salamz
i got som thing for programmers Smile its a open source code for sms sending protocol use by mobile companies ,,, follow the instruction and make a one for your self thnx....

http://www.aosp.net/sms.htm
http://www.aosp.net/sms.doc
All the programs given in these links have a simple mistake!

The line 166 is:
gets(&sms);

and from man pages I see that
char *gets(char *s);

and sms is define as
char sms[100];

since sms is an array and the identifier of the array automatically holds the address of the first memory location occupied by the first item in the array, we do not need to pass the address-of operator

simply

gets(sms);

when compiling it says that gets is a dangerous function to use
any one know why?
zaeemarshad
Lieutenant Colonel
Posts: 660
Joined: Sat Jul 06, 2002 12:35 pm
Location: Islamabad
Contact:

Post by zaeemarshad »

yes gets is definitely dangerous because it does no bound checking. That means that you can just fill in as many characters as you like. So if sms is a 100 element array and you use something like

gets(sms);

a carefully crafted input that exceeds 100 characters will exceed the array boundary and will overwrite the other memorylocations in the stack. Now with a carefully crafted input, one can change the value of the return pointer and cause arbitrary code to execute.

Instead of using gets() you should use fgets. There is another function for this but i cant recall it at the moment.

Cheers
Zaeem
masud
Havaldaar
Posts: 108
Joined: Thu Aug 05, 2004 12:15 am
Location: Fremont, CA
Contact:

back

Post by masud »

slamz!!
Ramzan Mubarak to every one :) sorry i was busy(or perhaps i m busy in LNMS http://sourceforge.net/projects/lnms .. sorry!!!!!
first of all thnx "n3m3sis" for read my code before doing anything , althoug u already given answer in ur question LOL
all we need is address :) and second thing about that gets()
you can use dat stuff in a local process , i mean the process whic is run by you, but for the process which hosts users and run by any privilage user then u already hav an exelent defination given bye "zaeemarshad"
anyway thnx u both :)
ALLAHHAFIZ
--SP--
wtiwana
Cadet
Posts: 6
Joined: Sun Oct 31, 2004 5:37 am

Mobilink has Changed Protocol

Post by wtiwana »

Salmz All;

Thanks for posting great messages. Your work has greated helped me in my own project.
NOw Iam stuck again. It seems that Mobilink has changed protocol again. Now previous techniques are not responding.
Please Help. My project is due for viva immediately after eid.

Thanks
masud
Havaldaar
Posts: 108
Joined: Thu Aug 05, 2004 12:15 am
Location: Fremont, CA
Contact:

hehehe

Post by masud »

Salamz!!
Good news! i will try, if i get time.
:)
AH
--SP--
masud
Havaldaar
Posts: 108
Joined: Thu Aug 05, 2004 12:15 am
Location: Fremont, CA
Contact:

hi back!!

Post by masud »

Salamz
ok try this new code !! working fine.
:arrow: http://aosp.net/sms/mobilinkv2.c
--SP--
wtiwana
Cadet
Posts: 6
Joined: Sun Oct 31, 2004 5:37 am

Thanks

Post by wtiwana »

Salam to All.
Thanks Masud. Your code really works. I was in the process of decompiling Mobilinks webchat applet, but you saved me. Thanks again.
How do you guys identify the protocol in any system such as this?

Thanks

I hope to learn, discover and distribute.

:D :)
masud
Havaldaar
Posts: 108
Joined: Thu Aug 05, 2004 12:15 am
Location: Fremont, CA
Contact:

nice!!

Post by masud »

salamz!!
How do you guys identify the protocol in any system such as this?

Netwrok protocols are easy to identify unless they are not using any key to encrypt data back to them. Just use any packet sniffer to sniff packets and study them what they are sending and recieving but before doing any thing like this, please read RFC's of TCP/IP's because every packet is not a data packet or require packet.
I hope to learn, discover and distribute.
I like this but say it like this
I hope to learn , discover and distribute freely with source code. :)

For any kind of help reagarding low level programming (TCP/IP/UDP/ICMP/Ethernet)
" MAY HOUN NA"
ALLAHHAFIZ
--SP--
Kdaemon
Naib Subedar
Posts: 346
Joined: Sat Nov 30, 2002 12:22 pm
Location: Islamabad. GPS: LHR

Post by Kdaemon »

Here is php code for sending sms to mobilinkers.
reg linux user #298274
Post Reply