#!/usr/bin/perl -w # # linuxsms, a linux console perl script for send short messages # to gsm phones (aka sms 8-)) by z0mbie (thesumidero@yahoo.com) # HOMEPAGE: http://linuxsms.sourceforge.net # # Copyright (C) 2001 Alejandro Portela, # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # DON'T TOUCH NOTHING AFTER HERE!... UNLESS YOU KNOW THAT YOU ARE DOING ;-) # # Perl v5 required #require v5; use IO::Socket; #use strict; use CGI; # last update 14-07-2002 my $VERSION = "0.49"; #$ # global variables my ($SERVER, $DEFAULT_SERVER, $URL); my ($NAME, $NUMBER, $MYNUMBER, $MYPREFIX, $SMS, $SMSCHARLIMIT, $ALIAS, $EMAIL, $SIGNATURE, $SERVER_LIST); my $SIG = 0; my ($LANG); my $FLASH = 0; my $SECURE_MODE = 1; # default commandline is the classic long my $CMDLINE = 0; # COMPRESS SMS default is OFF, set to ON by '-z' commandline option my $COMPRESS = 0; # DEBUG default is OFF, set to ON by '-debug' commandline option my $DEBUG = 0; my ($LOGIN, $PASSWD, $HTTP_SOCKET, $PROXY); my ($COOKIE, $LOCATION, $HOST); # # the home dir of user my $HOME = $ENV{HOME}; # the home dir of script $HOME .= "/.linuxsms/"; # the homepage of script my $LINUXSMSURL = "linuxsms.sourceforge.net"; my $LINUXSMSEMAIL = "thesumidero\@yahoo.com"; # available server list # format is: # name => [ "ACCOUNT REQUIRED ?", "HOST/IP", "URL for register account", "sms limit", "smiley rating", "country" "char limit"], # (the last entry don't have a ',' at end)... and YES, CASE IS SENSITIVE! my %HSERVERS = ( everyday => [ "Y", "eday.tele2.ee" , "www.everyday.com" , "10 sms / day" , ":-)" , "INT" , 130 ], firstwap => [ "Y", "www.1rstwap.com" , "www.1rstwap.com" , "50 sms / week" , ":-?" , "INT" , 160 ], vodafone => [ "N", "212.73.32.54" , "" , "no limit" , ":-)" , "SP" , 136 ], movistar => [ "N", "www.correo.movistar.net", "" , "no limit" , ":-?" , "SP" , 159 ], #movistar1 => [ "N", "www.correo.movistar.net", "" , "no limit" , ":-?" , "SP" , 159 ], #movistar2 => [ "N", "www.correo.movistar.net", "" , "no limit" , ":-?" , "SP" , 159 ], wanadoolb => [ "Y", "tango.wanadoo.com.lb" , "www.wanadoo.com.lb" , "5 sms / day" , ":-D" , "INT" , 110 ], wappi => [ "Y", "www.wappi.com" , "www.wappi.com" , "no limit" , ":-)" , "INT" , 143 ], amena1 => [ "Y", "www.amena.com" , "www.amena.com" , "20 sms / day" , ":-D" , "SP" , 136 ], amena2 => [ "Y", "www.amena.com" , "www.amena.com" , "20 sms / day" , ":-D" , "SP" , 500 ], genieuk => [ "Y", "www.genie.co.uk" , "www.o2.co.uk" , "600 sms / mon" , ":-D" , "UK" , 115 ], smsac => [ "Y", "sms.ac" , "sms.ac" , "5 sms / day" , ":-?" , "INT" , 130 ], orangedk => [ "Y", "myorange.dk" , "myorange.dk" , "no limit" , ":-)" , "DK" , 120 ], bluewin => [ "N", "freesms.bluewin.ch" , "" , "3 sms / day" , ":-)" , "CH" , 130 ], mtsgsm => [ "N", "mercedes.mts.ru" , "" , "10 sms / day" , ":-)" , "INT" , 160 ] ); # # ANSi color codes (default is NO colors) # normal attributes my $c_black = ""; my $c_red = ""; my $c_green = ""; my $c_yellow = ""; my $c_blue = ""; my $c_magenta = ""; my $c_cyan = ""; my $c_white = ""; # default attribute color my $c_default = $c_white; # default blink attribute my $c_blink = $c_default; # default bold attribute my $c_bold = $c_default; # export global vars use vars qw ($c_black $c_red $c_green $c_yellow $c_blue $c_magenta $c_cyan $c_white); use vars qw ($c_default $c_blink $c_bold); use vars qw ($SERVER $DEFAULT_SERVER $URL $PROXY); use vars qw ($NAME $NUMBER $MYNUMBER $MYPREFIX $SMS $SMSCHARLIMIT $ALIAS $EMAIL $SIGNATURE $SIG $FLASH); use vars qw ($LANG $COMPRESS $DEBUG $CMDLINE $SECURE_MODE $SERVER_LIST); use vars qw ($HSERVERS $HOME); use vars qw ($LINUXSMSURL $LINUXSMSEMAIL); use vars qw ($LOGIN $PASSWD $HTTP_SOCKET); use vars qw ($COOKIE $LOCATION $HOST); # # # --- subroutines --- # # # set ANSi colors sub set_ansi() { # normal attributes $c_black = "\033[0;30m"; $c_red = "\033[0;31m"; $c_green = "\033[0;32m"; $c_yellow = "\033[0;33m"; $c_blue = "\033[0;34m"; $c_magenta = "\033[0;35m"; $c_cyan = "\033[0;36m"; $c_white = "\033[0;37m"; # default attribute color $c_default = $c_white; # blink attribute $c_blink = "\033[5m"; # bold attribute $c_bold = "\033[1m"; } # # main starting tests (check dirs && main files) sub main_test() { return(0); } # # print some usefull help text information sub help() { if ($CMDLINE == 1) { print $c_yellow.$c_bold."Commandline options:".$c_default."\n"; print $c_cyan.$c_bold."-h ".$c_green."text that you are reading now \;-\)".$c_default."\n"; print $c_cyan.$c_bold."-server ".$c_green."show available servers".$c_default."\n"; print $c_cyan.$c_bold."-addressbook ".$c_green."list all entries in addressbook".$c_default."\n"; print $c_cyan.$c_bold."-update ".$c_green."check for new version".$c_default."\n"; print $c_cyan.$c_bold."-debug ".$c_green."dump debug info to STDERR".$c_default."\n"; print $c_cyan.$c_bold."-flash ".$c_green."sms-flash ".$c_green.$c_bold."\[ if server have support \]".$c_default."\n"; print $c_cyan.$c_bold."-sig ".$c_green."add signature at end of sms".$c_default."\n"; print $c_cyan.$c_bold."-anonymous ".$c_green."hide your number ".$c_green.$c_bold."\[ if server have support \]".$c_default."\n"; print $c_cyan.$c_bold."-z ".$c_green."compress sms".$c_default."\n"; } else { print $c_yellow.$c_bold."Commandline options:".$c_default."\n"; print $c_cyan.$c_bold."-h ".$c_green."text that you are reading now \;-\)".$c_default."\n"; print $c_cyan.$c_bold."-server ".$c_green."show available servers".$c_default."\n"; print $c_cyan.$c_bold."-server:".$c_cyan."server ".$c_green."select server".$c_default."\n"; print $c_cyan.$c_bold."-addressbook ".$c_green."list all entries in addressbook".$c_default."\n"; print $c_cyan.$c_bold."-name:".$c_cyan."name ".$c_green."find number in addressbook using name".$c_default."\n"; print $c_cyan.$c_bold."-number:".$c_cyan."gsm_number ".$c_green."number of phone ".$c_default."\n"; print $c_cyan.$c_bold."-prefix:".$c_cyan."prefix_numer ".$c_green."country prefix ".$c_default."\n"; print $c_cyan.$c_bold."-sms:".$c_cyan."\"msg\" ".$c_green."text to send ".$c_green.$c_bold."\[ if not set, read from stdin \]".$c_default."\n"; print $c_cyan.$c_bold."-update ".$c_green."check for new version".$c_default."\n"; print $c_cyan.$c_bold."-debug ".$c_green."dump debug info to STDERR".$c_default."\n"; print $c_cyan.$c_bold."-flash ".$c_green."sms-flash ".$c_green.$c_bold."\[ if server have support \]".$c_default."\n"; print $c_cyan.$c_bold."-sig ".$c_green."add signature at end of sms".$c_default."\n"; print $c_cyan.$c_bold."-anonymous ".$c_green."hide your number ".$c_green.$c_bold."\[ if server have support \]".$c_default."\n"; print $c_cyan.$c_bold."-z ".$c_green."compress sms".$c_default."\n"; } print $c_cyan."linuxsms comes with ".$c_white.$c_bold."ABSOLUTELY NO WARRANTY; This is ".$c_white.$c_bold."free software".$c_cyan.", and you are\n"; print $c_cyan."welcome to redistribute it under certain conditions; read COPYING for details.".$c_default."\n"; exit(0); } # # print all available servers sub print_available_servers() { my ($SERVER_NAME, $SERVER_IP, $SERVER_URL, $FAMILY, @VALID_ACCOUNTS, $FOUND, $TEMP); my $PASSWORD = $HOME."password"; my $LINE; # open password file and push server accounts into array @VALID_ACCOUNTS open (PASSWORD, $PASSWORD) or die $c_red.$c_bold.$c_blink."error\!, can\'t open ".$PASSWORD.$c_default."\n"; while ($LINE = ) { if (($LINE !~ /^$/) && ($LINE !~ /^#/)) { if ($LINE =~ /^(.*)\:(.*)\:(.*)$/) { push (@VALID_ACCOUNTS, $1); } } } close (PASSWORD); print $c_yellow.$c_bold."Available servers:".$c_default."\n"; $FOUND = "NO"; foreach $FAMILY (sort(keys %HSERVERS)) { if ($HSERVERS{$FAMILY}[0] =~ /^Y$/) { $FOUND = "NO"; foreach $TEMP (@VALID_ACCOUNTS) { if ($TEMP =~ /^$FAMILY$/) { $FOUND = "YES"; } } if ($FOUND eq "YES" ) { print $c_cyan.$c_bold."- ".$c_white.$c_bold."["; print $c_green.$c_bold."*".$c_default; print $c_white.$c_bold."]".$c_cyan.$c_bold; } elsif ($FOUND eq "NO") { print $c_cyan.$c_bold."- ".$c_white.$c_bold."["; print $c_red.$c_bold.$c_blink."!".$c_default; print $c_white.$c_bold."]".$c_cyan.$c_bold; } } else { print $c_cyan.$c_bold."- ".$c_white.$c_bold."[-]".$c_cyan.$c_bold; } print $c_cyan.$c_bold." : ".$c_green.$FAMILY.$c_default." " x (9 - length($FAMILY)); print $c_cyan.$c_bold." : ".$c_blue.$HSERVERS{$FAMILY}[3].$c_default. " " x (13 - length($HSERVERS{$FAMILY}[3])); print $c_cyan.$c_bold." : ".$c_red.$c_bold.$HSERVERS{$FAMILY}[6]." chars"; print $c_cyan.$c_bold." : ".$c_green.$c_bold.$HSERVERS{$FAMILY}[4].$c_cyan.$c_bold." : ".$c_magenta.$c_bold.$HSERVERS{$FAMILY}[5].$c_default."\n"; if ($FOUND eq "NO" && $HSERVERS{$FAMILY}[0] =~ /^Y$/ && $SERVER_LIST) { print $c_cyan.$c_bold." |-> ".$c_green.$c_bold."register".$c_cyan.$c_bold.": ".$c_blue.$c_bold."http://".$HSERVERS{$FAMILY}[2].$c_default."\n"; } } print $c_yellow.$c_bold."Smiley Server Rating Legend:".$c_default."\n"; print $c_green.$c_bold." :-(".$c_cyan.$c_bold." : ".$c_blue.$c_bold."[ bad ]".$c_default." "; print $c_green.$c_bold." :-?".$c_cyan.$c_bold." : ".$c_blue.$c_bold."[ unpredictable ]".$c_default."\n"; print $c_green.$c_bold." :-)".$c_cyan.$c_bold." : ".$c_blue.$c_bold."[ good ]".$c_default." "; print $c_green.$c_bold." :-D".$c_cyan.$c_bold." : ".$c_blue.$c_bold."[ best ]".$c_default."\n"; print $c_yellow.$c_bold."Server Legend:".$c_default."\n"; print $c_white.$c_bold." [-]".$c_cyan.$c_bold." : ".$c_blue.$c_bold."no account required".$c_default." "; print $c_magenta.$c_bold." INT".$c_cyan.$c_bold." : ".$c_blue.$c_bold."International".$c_default."\n"; print $c_white.$c_bold." [".$c_red.$c_bold.$c_blink."!".$c_default.$c_white.$c_bold."]".$c_cyan.$c_bold." : ".$c_blue.$c_bold."need to register".$c_default." "; print $c_magenta.$c_bold." SP".$c_cyan.$c_bold." : ".$c_blue.$c_bold."Spain only".$c_default."\n"; print $c_white.$c_bold." [".$c_green.$c_bold."*".$c_white.$c_bold."]".$c_cyan.$c_bold." : ".$c_blue.$c_bold."valid account found".$c_default." "; print $c_magenta.$c_bold." UK".$c_cyan.$c_bold." : ".$c_blue.$c_bold."UK only".$c_default."\n"; print $c_magenta.$c_bold." "; print " DK".$c_cyan.$c_bold." : ".$c_blue.$c_bold."Denmark only".$c_default."\n"; print $c_magenta.$c_bold." "; print " CH".$c_cyan.$c_bold." : ".$c_blue.$c_bold."Switzerland only".$c_default."\n"; exit(0); } # # print the addressbook sub print_addressbook() { my $ADDRESSBOOK = $HOME."addressbook"; my ($LINE, @BUFFER); open (ADDRESSBOOK, $ADDRESSBOOK) or die $c_red.$c_bold.$c_blink."error\!, can\'t open ".$ADDRESSBOOK.$c_default."\n"; print $c_yellow.$c_bold."Available names in addressbook:".$c_default."\n"; while ($LINE = ) { if (($LINE !~ /^$/) && ($LINE !~ /^#/)) { push @BUFFER, $LINE; } } @BUFFER = sort @BUFFER; foreach $LINE (@BUFFER) { if (($LINE !~ /^$/) && ($LINE !~ /^#/)) { if ($LINE =~ /^(.*)\:(\d{0,3})\:(\d{8,15})\:?(\w*)?$/) { if ($2) { print $c_cyan.$c_bold."- ".$c_blue."\[".$c_blue.$c_bold.$2." ".$3.$c_blue."\]".$c_cyan.$c_bold." : ".$c_green.$1." "x(10 - length($1)).$c_cyan.$c_bold.": ".$c_magenta.$4.$c_default."\n"; } else { print $c_cyan.$c_bold."- ".$c_blue."\[".$c_blue.$c_bold.$MYPREFIX." ".$3.$c_blue."\]".$c_cyan.$c_bold." : ".$c_green.$1." "x(10 - length($1)).$c_cyan.$c_bold.": ".$c_magenta.$4.$c_default."\n"; } } } } close (ADDRESSBOOK); exit(0); } # # find name in addressbook sub addressbook() { my $ADDRESSBOOK = $HOME."addressbook"; my ($LINE, $N); open (ADDRESSBOOK, $ADDRESSBOOK) or die $c_red.$c_bold.$c_blink."error\!, can\'t open ".$ADDRESSBOOK.$c_default."\n"; while ($LINE = ) { if (($LINE !~ /^$/) && ($LINE !~ /^#/)) { if ($LINE =~ /^(.*)\:(\d{0,3})\:(\d{8,15})\:?(\w*)?$/) { if ($_[0] eq $1) { if ($2) { $MYPREFIX = $2; } $N = $3; if ($4) { $DEFAULT_SERVER = $4; } } } } } close (ADDRESSBOOK); if (! $N) { die $c_red.$c_bold.$c_blink."error\!, name ".$_[0]." was not found in ".$ADDRESSBOOK.$c_default."\n"; } return($N); } # # find login && passwd of server sub auth() { my $PASSWORD = $HOME."password"; my $LINE; open (PASSWORD, $PASSWORD) or die $c_red.$c_bold.$c_blink."error\!, can\'t open ".$PASSWORD.$c_default."\n"; while ($LINE = ) { if (($LINE !~ /^$/) && ($LINE !~ /^#/)) { if ($LINE =~ /^(.*)\:(.*)\:(.*)$/) { if ($_[0] eq $1) { $LOGIN = $2; $PASSWD = $3; } } } } close (PASSWORD); if (! ($LOGIN && $PASSWD)) { print $c_red.$c_bold.$c_blink."error\!, account for server ".$_[0]." was not found in ".$PASSWORD.$c_default."\n"; die $c_yellow.$c_bold."Go to .".$_[0]." homepage, create an account and add it in ".$PASSWORD.$c_default."\n"; } } # # find the IP and sms char limit of a server sub parse_server() { my $FAMILY; foreach $FAMILY (keys %HSERVERS) { if ($FAMILY eq $_[0]) { $SERVER = $FAMILY; $URL = $HSERVERS{$FAMILY}[1]; $SMSCHARLIMIT = $HSERVERS{$FAMILY}[6]; } } if (! $URL) { die $c_red.$c_bold.$c_blink."error\!, the server ".$_[0]." was not found".$c_default."\n"; } } # # check if string is a server sub is_server() { my $FAMILY; my $FOUND = 0; foreach $FAMILY (keys %HSERVERS) { if ($FAMILY eq $_[0]) { $FOUND=1; } } return($FOUND); } # # check if string is a name of addressbook # if is a name, returns number, else returns 0 sub is_name() { my $ADDRESSBOOK = $HOME."addressbook"; my $LINE; my $FOUND = 0; open (ADDRESSBOOK, $ADDRESSBOOK) or die $c_red.$c_bold.$c_blink."error\!, can\'t open ".$ADDRESSBOOK.$c_default."\n"; while ($LINE = ) { if (($LINE !~ /^$/) && ($LINE !~ /^#/)) { if ($LINE =~ /^(.*)\:(\d{0,3})\:(\d{8,15})\:?(\w*)?$/) { if ($_[0] eq $1) { $FOUND = 1; } } } } close (ADDRESSBOOK); return($FOUND); } # # read options from main config file sub config() { # set defaults $LANG = "ES"; $MYNUMBER = 000000000; $EMAIL = "myemail\@myserver.net"; $ALIAS = "linux"; $MYPREFIX = 34; $SERVER_LIST = 0; $CMDLINE = 0; $SIGNATURE = ""; $SIG = 0; $SECURE_MODE = 1; } # # parse commandline options sub parse_commandline() { } # # parse commandline options (short version) sub parse_commandline_new() { } # # compress sms sub compress() { my $LENGTH = length($SMS); # strip blank spaces at begin $SMS =~ s/^[\s]{1,}//; # strip blank spaces at end $SMS =~ s/[\s]{1,}$//; # strip unwanted blank spaces repeated $SMS =~ s/[\s]{2,}/\ /g; # main (spanish) if ($LANG eq "ES") { # alpha chars $SMS =~ s/be/b/ig; $SMS =~ s/ce/c/ig; $SMS =~ s/de/d/ig; $SMS =~ s/efe/f/ig; $SMS =~ s/ge/g/ig; $SMS =~ s/ca/k/ig; $SMS =~ s/ka/k/ig; $SMS =~ s/ele/l/ig; $SMS =~ s/eme/m/ig; $SMS =~ s/ene/n/ig; $SMS =~ s/pe/p/ig; $SMS =~ s/cu/q/ig; $SMS =~ s/ese/s/ig; $SMS =~ s/te/t/ig; # numbers $SMS =~ s/uno/1/ig; $SMS =~ s/dos/2/ig; $SMS =~ s/tres/3/ig; $SMS =~ s/cuatro/4/ig; $SMS =~ s/cinco/5/ig; $SMS =~ s/seis/6/ig; $SMS =~ s/siete/7/ig; $SMS =~ s/ocho/8/ig; $SMS =~ s/nueve/9/ig; $SMS =~ s/diez/10/ig; $SMS =~ s/once/11/ig; $SMS =~ s/doce/12/ig; # short macros $SMS =~ s/mas/\+/ig; $SMS =~ s/menos/\-/ig; $SMS =~ s/igual/\=/ig; $SMS =~ s/por/x/ig; $SMS =~ s/entre/\//ig; $SMS =~ s/una/1/ig; $SMS =~ s/un/1/ig; $SMS =~ s/que/k/ig; $SMS =~ s/ustedes/Vds/ig; $SMS =~ s/usted/Vd/ig; $SMS =~ s/qu/k/ig; } elsif ($LANG eq "EN") { # main (english) # numbers $SMS =~ s/one/1/ig; $SMS =~ s/two/2/ig; $SMS =~ s/three/3/ig; $SMS =~ s/four/4/ig; $SMS =~ s/five/5/ig; $SMS =~ s/six/6/ig; $SMS =~ s/seven/7/ig; $SMS =~ s/eight/8/ig; $SMS =~ s/nine/9/ig; $SMS =~ s/ten/10/ig; $SMS =~ s/eleven/11/ig; $SMS =~ s/twelve/12/ig; # short macros $SMS =~ s/more/\+/ig; $SMS =~ s/equal/\=/ig; $SMS =~ s/between/\//ig; $SMS =~ s/see/c/ig; $SMS =~ s/you/u/ig; } my $LENGTH2 = $LENGTH - length($SMS); print $c_black.$c_bold."zip sms: ".$c_white.$c_bold."\"$SMS\"".$c_black.$c_bold." \[".$LENGTH2." chars saved\]".$c_default."\n"; } # # open a socket in remote host sub open_socket() { my ($PROXY_HOST, $PROXY_PORT); if (! $PROXY) { $HTTP_SOCKET = IO::Socket::INET->new(PeerHost => "$_[0]", PeerPort => "80", Proto => "tcp"); } else { $PROXY =~ /(.*)\:(.*)/; $PROXY_HOST = $1; $PROXY_PORT = $2; if ($PROXY_HOST && $PROXY_PORT) { $HTTP_SOCKET = IO::Socket::INET->new(PeerHost => "$1", PeerPort => "$2", Proto => "tcp"); } } unless ($HTTP_SOCKET) { if (! $PROXY) { print $c_red.$c_bold.$c_blink."\nerror\!, can\'t open socket at ".$_[0].$c_default."\n"; } else { print $c_red.$c_bold.$c_blink."\nerror\!, can\'t open socket at ".$PROXY_HOST.":".$PROXY_PORT.$c_default."\n"; } exit(3); } } # # returns hexadecimal value from a char sub char_to_hex { return sprintf '%%%02X', ord $_[0]; } # # get && parse HTTP header sub parse_http_header() { my $LINE; my $CODE=0; my $HEADER = "EXIST"; while ($HEADER eq "EXIST") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } # HTTP header, first line (HTTP/majorversion.minorversion && response code) if ($LINE =~ /^HTTP\/(\d)\.(\d)\ (\d{3})\ (.*)/ ) { if ($DEBUG) { print STDERR "server response: majorversion: ".$1." - minorversion: ".$2." - code: ".$3." - parameters: ".$4."\n".$LINE; } if ($1 != 1) { $c_black.$c_bold."error : ".$c_white.$c_bold.$c_blink."HTTP major version must be 1\n"; exit(1); } if ($2 != 0 && $2 != 1) { print $c_black.$c_bold."error : ".$c_white.$c_bold.$c_blink."HTTP minor version must be 0\|\|1\n"; exit(1); } } if (defined $3) { $CODE = $3; # 2xx || 3xx (OK) if ($3 =~ /^[2-3]\d{2}$/) { } # 4xx (NOT FOUND) elsif ($3 =~ /^4\d{2}$/) { #print $c_black.$c_bold."error : ".$c_white.$c_bold.$c_blink."server response File Not Found".$c_default."\n"; #exit(1); } # xxx (not supported || unknown HTTP header) else { print $c_black.$c_bold."error : ".$c_white.$c_bold.$c_blink."server response unknown HTTP header: ".$LINE.$c_default."\n"; exit(1); } } if ($LINE =~ /\r\n$/) { while ($HEADER eq "EXIST") { # next lines of HTTP header if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } # get COOKIE (ONLY from ':' to ';', cooming soon fix) if ($LINE =~ /^Set-Cookie\:\ {0,2}(\S*)\;/i) { $COOKIE = "Cookie: ".$1."\r\n"; } # get LOCATION if ($LINE =~ /^Location\:\ (.*)\r$/i) { $LOCATION = $1; } # get HOST if ($LINE =~ /^Host\:\ (.*)\r$/i) { $HOST = "Host: ".$1."\r\n"; } if ($DEBUG) { print STDERR $LINE; } # end of HTTP header if ($LINE =~ /^\r\n$/) { $HEADER = "END"; } } } } return($CODE); } # # get && parse HTTP header appending cookies sub parse_http_header_multicookie() { my $LINE; my $HEADER = "EXIST"; while ($HEADER eq "EXIST") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } # HTTP header, first line (HTTP/majorversion.minorversion && response code) if ($LINE =~ /^HTTP\/(\d)\.(\d)\ (\d{3})\ (.*)/ ) { if ($DEBUG) { print STDERR "server response: majorversion: ".$1." - minorversion: ".$2." - code: ".$3." - parameters: ".$4."\n".$LINE; } if ($1 != 1) { die $c_black.$c_bold."error : ".$c_white.$c_bold.$c_blink."HTTP major version must be 1\n"; } if ($2 != 0 && $2 != 1) { die $c_black.$c_bold."error : ".$c_white.$c_bold.$c_blink."HTTP minor version must be 0\|\|1\n"; } } # 2xx || 3xx (OK) if ($3 =~ /^[2-3]\d{2}$/) { } # 4xx (NOT FOUND) elsif ($3 =~ /^4\d{2}$/) { } # xxx (not supported || unknown HTTP header) else { die $c_black.$c_bold."error : ".$c_white.$c_bold.$c_blink."server response unknown HTTP header: ".$LINE.$c_default."\n"; } if ($LINE =~ /\r\n$/) { while ($HEADER eq "EXIST") { # next lines of HTTP header if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } # get COOKIE (ONLY from ':' to ';', cooming soon fix) if ($LINE =~ /Cookie\:\ {0,2}(\S*)/i) { $COOKIE .= $1."; "; $COOKIE =~ s/\;\;/\;/; if ($COOKIE =~ s/\r//) {} if ($COOKIE =~ s/\n//) {} } # get LOCATION if ($LINE =~ /^Location\:\ (.*)\r$/i) { $LOCATION = $1; } # get HOST if ($LINE =~ /^Host\:\ (.*)\r$/i) { $HOST = "Host: ".$1."\r\n"; } if ($DEBUG) { print STDERR $LINE; } # end of HTTP header if ($LINE =~ /^\r\n$/) { $HEADER = "END"; } } } } } # # HTTP HEAD method sub HTTP_HEAD() { my $BUF; $BUF = "HEAD ".$_[0]." HTTP/1.0\r\n"; $BUF .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)\r\n"; if (($_[1]) && ($_[1] =~ /^Host\:\ /i)) { $BUF .= $_[1]; } if (($_[2]) && ($_[2] =~ /^Referer\:\ /i)) { $BUF .= $_[2]; } $BUF .= "Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*\r\n"; $BUF .= "Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n"; if (($_[3]) && ($_[3] =~ /^Cookie\:\ /i)) { $BUF .= $_[3]; } $BUF .= "Pragma: no-cache\r\n"; $BUF .= "Cache-Control: no-cache\r\n"; $BUF .= "Connection: Keep-Alive\r\n"; $BUF .= "\r\n"; if ($DEBUG) { print STDERR "\n".$BUF; } print $HTTP_SOCKET $BUF; } # # HTTP GET method sub HTTP_GET() { my $BUF; $BUF = "GET ".$_[0]." HTTP/1.0\r\n"; $BUF .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)\r\n"; if (($_[1]) && ($_[1] =~ /^Host\:\ /i)) { $BUF .= $_[1]; } if (($_[2]) && ($_[2] =~ /^Referer\:\ /i)) { $BUF .= $_[2]; } $BUF .= "Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*\r\n"; $BUF .= "Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n"; if (($_[3]) && ($_[3] =~ /^Cookie\:\ /i)) { $BUF .= $_[3]; } $BUF .= "Pragma: no-cache\r\n"; $BUF .= "Cache-Control: no-cache\r\n"; $BUF .= "Connection: Keep-Alive\r\n"; $BUF .= "\r\n"; if ($DEBUG) { print STDERR "\n".$BUF; } print $HTTP_SOCKET $BUF; } # # HTTP POST method sub HTTP_POST() { my $BUF; $BUF = "POST ".$_[0]." HTTP/1.0\r\n"; $BUF .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)\r\n"; if (($_[1]) && ($_[1] =~ /^Host\:\ /i)) { $BUF .= $_[1]; } if (($_[2]) && ($_[2] =~ /^Referer\:\ /i)) { $BUF .= $_[2]; } $BUF .= "Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*\r\n"; $BUF .= "Accept-Encoding: gzip\r\n"; if (($_[3]) && ($_[3] =~ /^Cookie\:\ /i)) { $BUF .= $_[3]; } $BUF .= "Content-type: application/x-www-form-urlencoded\r\n"; $BUF .= "Content-length: ".length($_[4])."\r\n"; $BUF .= "\r\n"; $BUF .= $_[4]; if ($DEBUG) { print STDERR "\n".$BUF."\n"; } print $HTTP_SOCKET $BUF; } # # check if exist a new update of script sub find_new_version() { my ($DATA, $LINE, $QUIT); my $PATH = "http://linuxsms.sourceforge.net/"; print $c_yellow.$c_bold."Checking for versions > ".$VERSION.$c_default."\n"; # open connection &open_socket($LINUXSMSURL); # send GET data &HTTP_GET($PATH, "Host: ".$LINUXSMSURL."\r\n", "", ""); # get && parse HTTP header &parse_http_header(); $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /Last version is\:\ (.*)\,/i) { if ($1 <= $VERSION) { print $c_cyan.$c_bold."You have last version".$c_default."\n"; $QUIT = "YES";} elsif ($1 > $VERSION) { print $c_red.$c_bold.$c_blink."New version found \(v".$1."\)".$c_default."\n"; print $c_cyan.$c_bold."Download it from http://".$LINUXSMSURL.$PATH."".$c_default."\n"; $QUIT = "YES"; } } if ($LINE =~ /\<\/html\>/i) { print $c_red.$c_bold.$c_blink."Error parsing version".$c_default."\n"; $QUIT = "YES"} } close(HTTP_SOCKET); exit(0); } # # # --- servers section BEGIN --- # # process server [everyday] # data sniffed from WinSMS sub sms_everyday() { my ($GET, $POST, $HEAD, $REFERER, $APACHE); my ($TEMP, $LINE, $QUIT); # vars $HEAD = "http://everyday.com/"; $REFERER = "Referer: http://sms.everyday.com/\r\n"; $HOST = "Host: everyday.com\r\n"; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send HEAD &HTTP_HEAD($HEAD, $HOST, $POST, $COOKIE); # get && parse HTTP header &parse_http_header_multicookie(); print $c_white.$c_bold." *".$c_default; close($HTTP_SOCKET); $COOKIE = "Cookie : ".$COOKIE."\r\n"; if ($COOKIE =~ /(ApacheEE\=\w*)/i) { $APACHE = $1; } # vars $GET = "http://sms.everyday.com/login.phtml?login_username=".$LOGIN."&login_password=".$PASSWD; $REFERER = "Referer: http://sms.everyday.com/\r\n"; $HOST = "Host: sms.everyday.com\r\n"; $COOKIE = "Cookie: ".$APACHE."; BrowserDetect=passed\r\n"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_GET($GET, $HOST, $REFERER, $COOKIE); # get && parse HTTP header &parse_http_header(); # vars # our number defined in linuxsmsrc is appended if found $POST = "http://sms.everyday.com/index.phtml"; $REFERER = "Referer: http://sms.everyday.com/index.phtml\r\n"; $COOKIE = "Cookie: ".$APACHE."; BrowserDetect=passed\r\n"; $TEMP = "message=".$SMS."&gsmnumber=%2B".$MYPREFIX.$NUMBER."&fromname=&send_sms=Enviar"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /Has\ llegado\ a\ tu\ limite\ de\ mensajes/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."you waste the limit of sms\/day \(10\) in this server".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } if ($LINE =~ /Tu\ mensaje\ ha\ sido\ enviado/i) { $QUIT = "YES"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; } if ($LINE =~ /\<\/body\>/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } } close ($HTTP_SOCKET); } # # process server [firstwap] sub sms_firstwap() { my ($GET, $POST, $REFERER, $PHPSESSID, $SESTIME); my ($TEMP, $LINE, $QUIT); if ($MYPREFIX == 34) { print $c_black.$c_bold."warning: ".$c_white.$c_bold.$c_blink."firstwap have a unstable support to Spain".$c_default."\n"; } # vars $GET = "http://www.1rstwap.com/partners/go.to/1rstwap"; $REFERER = ""; $LOCATION = ""; $HOST = "Host: www.1rstwap.com\r\n"; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send GET &HTTP_GET($GET, $HOST, $REFERER, ""); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; if ($COOKIE =~ /Cookie: (PHPSESSID\=\w*)/i) { $PHPSESSID = $1; chomp($PHPSESSID); } close ($HTTP_SOCKET); # vars $POST = "http://www.1rstwap.com/partners/go.php?".$PHPSESSID."&sestime=01112001140708&pid=login"; $REFERER = "Referer: http://www.1rstwap.com/partners/go.php?".$PHPSESSID."&pid=first\r\n"; $TEMP = "language=%2Fpartners%2Fgo.php%3F".$PHPSESSID."%26pid%3Dfirst&UserID=".$LOGIN; $TEMP .= "&Passwd=".$PASSWD."&submitButtonName=Login&cobid=1RSTWAP"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /\<\/html\>/i) { $QUIT = "YES"; } } close ($HTTP_SOCKET); # vars $GET = "http://www.1rstwap.com/partners/go.php?".$PHPSESSID."&pid=home"; $REFERER = "Referer: http://www.1rstwap.com/partners/go.php?.".$PHPSESSID."&sestime=01112001141842&pid=login\r\n"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send GET &HTTP_GET($GET, $HOST, $REFERER, $COOKIE); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /sestime\=(\d*)/i) { $SESTIME="&sestime=".$1; $QUIT = "YES"; } if ($LINE =~ /\<\/html\>/i) { $QUIT = "YES"; } } close ($HTTP_SOCKET); # vars $POST = "http://www.1rstwap.com/partners/go.php?".$PHPSESSID.$SESTIME."&pid=addressbook&aid=smswindow&step=send"; $REFERER = "Referer: http://www.1rstwap.com/partners/go.php?".$PHPSESSID."\r\n"; $TEMP = "hp=".$MYPREFIX.$NUMBER."&COUNTER=0&m=".$SMS."&submitButtonName=Send&SENDER=".$MYNUMBER."&flashsms=".$FLASH; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /Message\ has\ been\ sent/i) { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; $QUIT = "YES"; } elsif ($LINE =~ /Quota\ Exceeded/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."you waste the limit of sms\/day \(25\) in this server".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } elsif ($LINE =~ /\<\/html\>/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } } close ($HTTP_SOCKET); } # # process server [movistar] sub sms_movistar() { my ($LINE, $QUIT); if ($MYPREFIX != 34) { print $c_black.$c_bold."error : ".$c_white.$c_bold."movistar only sends to spain (34), try another server".$c_default."\n"; die $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; } my $L = (length($SMS) + length($EMAIL) + 1); if ($L > 160) { print $c_black.$c_bold."error : "; print $c_red.$c_bold.$c_blink."sms is too large \(".($L-160)." chars exceed, limit with your email is ".(160-length($EMAIL)-1).")".$c_default."\n"; exit(1); } # only allow movistar numbers $NUMBER =~ /(\d{3})\d{6}/; if (($1 != 606) && ($1 != 608) && ($1 != 609) && ($1 != 616) && ($1 != 619) && ($1 != 620) && ($1 != 626) && ($1 != 629) && ($1 != 630) && ($1 != 636) && ($1 != 639) && ($1 != 646) && ($1 != 649) && ($1 != 650) && ($1 != 659) && ($1 != 660) && ($1 != 669) && ($1 != 676) && ($1 != 679) && ($1 != 680) && ($1 != 686) && ($1 != 689) && ($1 != 696) && ($1 != 690) && ($1 != 699) ) { print $c_black.$c_bold."error : ".$c_white.$c_bold."this server only sends to movistar numbers".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } #if ($SERVER eq "movistar1") { if ($SERVER eq "movistar") { print $c_black.$c_bold."process:"; system "echo \"To: $NUMBER\@correo.movistar.net\nFrom: $EMAIL\n$SMS\"|/usr/sbin/sendmail -oi -f $EMAIL $NUMBER\@correo.movistar.net"; print $c_white.$c_bold." *".$c_default; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; } #elsif ($SERVER eq "movistar2") { # print $c_black.$c_bold."process:".$c_default; # $HTTP_SOCKET = IO::Socket::INET->new(PeerHost => "correo.movistar.net", PeerPort => "25", Proto => "tcp"); # print $c_white.$c_bold." *".$c_default; # unless ($HTTP_SOCKET) { print $c_red.$c_bold.$c_blink."\nerror\!, can\'t open socket at ".$_[0].$c_default."\n"; } # $QUIT = "NO"; # while ($QUIT eq "NO") { # if (! ($LINE = <$HTTP_SOCKET>)) { # print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; # print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; # exit(2); # } # if ($DEBUG) { print STDERR $LINE; } # if ($LINE =~ /220\ /ig) { # print $c_white.$c_bold." *".$c_default; # print $HTTP_SOCKET "HELO linuxsms.net\r\n"; # } # if ($LINE =~ /250\ / && $LINE !~ /Queued\ mail\ for\ delivery/i && # $LINE !~ /$EMAIL/i && $LINE !~ /$NUMBER/i) { # print $HTTP_SOCKET "MAIL FROM: $EMAIL \r\n"; # print $HTTP_SOCKET "RCPT TO: $NUMBER\@correo.movistar.net\r\n"; # print $HTTP_SOCKET "DATA\r\n"; # print $c_white.$c_bold." *".$c_default; # } # if ($LINE =~ /354\ /) { # print $HTTP_SOCKET "To: $NUMBER\@correo.movistar.net\r\n"; # print $HTTP_SOCKET "From: $EMAIL\r\n"; # print $HTTP_SOCKET "\r\n".$SMS."\r\n.\r\n"; # print $c_white.$c_bold." *".$c_default; # } # if ($LINE =~ /Queued\ mail\ for\ delivery/ig) { # print $HTTP_SOCKET "QUIT\n"; # print $c_white.$c_bold." *".$c_default; # print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; # $QUIT = "YES"; # } # } # close ($HTTP_SOCKET); #} } # # process server [wappi] sub sms_wappi() { my ($POST, $REFERER); my ($TEMP, $LINE, $QUIT, $ID); # vars $COOKIE = ""; $LOCATION = ""; $POST = "http://www.wappi.com/php/index.php"; $REFERER = "Referer: http://www.wappi.com/index.shtml\r\n"; $HOST = "Host: www.wappi.com\r\n"; $TEMP = "login=".$LOGIN."&password=".$PASSWD; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # sent POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /id=(\w*)\>/i) { $ID = $1; } if ($LINE =~ /\<\/html\>/i) { $QUIT = "YES"; } } if (! $ID) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } close ($HTTP_SOCKET); # vars $POST = "http://ww7.wappi.com/php/sms.php"; $TEMP = "login=".$LOGIN."&id=".$ID."&azione=sendsm&sub=invia&type=web2sms&prefisso=%2B&"; $TEMP .= "telefono=%2B".$MYPREFIX.$NUMBER."&msgText=".$SMS."&charsleft=".length($SMS)."&=Invia"; $REFERER = "Referer: http://ww7.wappi.com/php/sms.php\r\n"; $REFERER = ""; $HOST = "Host: ww7.wappi.com\r\n"; $LOCATION = ""; $URL = "194.243.91.42"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /Spiacente\,\ ma\ hai\ superato\ il\ limite\ massimo\ di\ messaggi\ che/i) { $QUIT = "YES"; print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."you waste the limit of sms\/day \(10\) in this server".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } if ($LINE =~ /\<\/html\>\/i) { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /window\.alert\(\"Messaggio\ inviato\ al\ numero/i) { $QUIT = "YES"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; } if ($LINE =~ /window\.alert\(\"Non\ inviato\.\ \ Hai\ inviato\ troppi\ messaggi\ allo\ stesso\ numero\.\"\)\;/i) { $QUIT = "YES"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } } if ($LINE =~ /\<\/html\>/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } } close ($HTTP_SOCKET); } # # process server [wanadoolb] # sub sms_wanadoolb() { my ($POST, $REFERER); my ($TEMP, $LINE, $QUIT); # vars $POST = "http://www.wanadoo.com.lb/signin.asp?signin=1&language=1"; $REFERER = "Referer: http://www.wanadoo.com.lb/signin.asp?language=1\r\n"; $HOST = "Host: www.wanadoo.com.lb\r\n"; $TEMP = "MemberName=".$LOGIN."&Password=".$PASSWD; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, "", $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; if ($COOKIE !~ /^Cookie\:\ ASPSESSIONID/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } close ($HTTP_SOCKET); $POST = "http://www.wanadoo.com.lb/sms/default.asp?language=1"; $REFERER = "Referer: http://www.wanadoo.com.lb/sms/default.asp?language=1\r\n"; $TEMP = "message=".$SMS."&counter=109®ion=".$MYPREFIX."&msidn=".$NUMBER."&submit1=Send&sid=2352154"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /FirstMsg\ \=\ (\d)/i) { if ($1 == 6) { $QUIT = "YES"; print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."you waste the limit of sms\/day \(5\) in this server".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } elsif ($1 < 6) { $QUIT = "YES"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; } } if ($LINE =~ /\<\/HTML\>/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } } close ($HTTP_SOCKET); } # # process server [amena] # sub sms_amena() { if ($MYPREFIX != 34) { print $c_black.$c_bold."error : ".$c_white.$c_bold."movistar only sends to spain (34), try another server".$c_default."\n"; die $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; } my ($GET, $POST, $REFERER); my ($TEMP, $LINE, $QUIT, $COOK); # vars $POST = "http://www.amena.com/sms_login"; $REFERER = "Referer: http://www.amena.com/login_y_password/sms_login1.html\r\n"; $HOST = "Host: www.amena.com\r\n"; #$COOKIE = "Cookie: SESSION_GO=/sms_amena/refer.html\r\n"; $TEMP = "usu=".$LOGIN."&clave=".$PASSWD."&url=%2Flogin_y_password%2Fsms_login2.html"; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST #&HTTP_GET($GET, $HOST, $REFERER, $COOKIE); &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; if (! $COOKIE) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } close ($HTTP_SOCKET); $GET = "http://www.amena.com/smspremium/index.html?user=".$LOGIN; $COOKIE =~ s/\r\n//g; $COOKIE .="; SESSION_USER_ID=".$LOGIN."\r\n"; $COOK = $COOKIE; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_GET($GET, $HOST, $REFERER, $COOKIE); # get && parse HTTP header &parse_http_header(); $QUIT = "NO"; if (! $COOKIE) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } close ($HTTP_SOCKET); $GET = "http://www.amena.com/smspremium/page.html?user=".$LOGIN; $REFERER = "Referer: http://www.amena.com/smspremium/index.html?user=".$LOGIN."\r\n"; $COOKIE =~ s/\r\n//g; $COOK =~ s/Cookie: //g; $COOK =~ s/\r\n//g; $COOKIE .="; ".$COOK; $COOKIE .= "; SESSION_GO=/opinion/privado/i2r/amena_opinion/enviar_sms; ref_cookie=ingles.amena.com,integracion.amena.com,eresmas.amena.com,am10.mad.eresmas.com,www.amena.com,deve.amena.com,tsamena.amena.com,amenaok.eresmas.com,mail.amenate.com,sms.amenate.com,www.amenapolis.com,amenapolisbs.com,beatles.cselt.it,finedelcookie\r\n"; $COOK = $COOKIE; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_GET($GET, $HOST, $REFERER, $COOKIE); # get && parse HTTP header &parse_http_header(); close ($HTTP_SOCKET); $COOKIE = $COOK; $POST = "http://www.amena.com/smspremium/sendsms.html"; $REFERER = "Referer: http://www.amena.com/smspremium/page.html?user=".$LOGIN."\r\n"; if ($MYNUMBER) { $TEMP = "from=".$LOGIN."&cook=true&senddate=&smspremiumcount=15&smspremiumdata=11579&remindercount=20&reminderdata=11580&maxmessaggexday=2&input_numero=&firma=on&numero=".$NUMBER."&msg=".$SMS."&ricevuta=off&combocategoria=&comboabreviatura=ABREVIATURAS80"; } else { $TEMP = "from=".$LOGIN."&cook=true&senddate=&smspremiumcount=15&smspremiumdata=11579&remindercount=20&reminderdata=11580&maxmessaggexday=2&input_numero=&firma=off&numero=".$NUMBER."&msg=".$SMS."&ricevuta=off&combocategoria=&comboabreviatura=ABREVIATURAS"; } # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header if (&parse_http_header() ne "200") { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /\\
\<\/body\>/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."you waste the limit of sms\/day \(20\) in this server".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } } close ($HTTP_SOCKET); } # # process server [genieuk] sub sms_genieuk() { if ($MYPREFIX != 44) { print $c_black.$c_bold."error : ".$c_white.$c_bold."jump only sends to UK (44), try another server".$c_default."\n"; die $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; } my ($GET, $POST, $REFERER, $COOK); my ($TEMP, $LINE, $QUIT); # vars $POST = "http://www.genie.co.uk/O2/login/doLogin"; $REFERER = "Referer: http://www.genie.co.uk/05252304120896400267/O2/login/doLogin/?dest=http://sendtxt.genie.co.uk/cgi-bin/sms/send_sms.cgi\r\n"; $HOST = "Host: www.genie.co.uk\r\n"; $TEMP = "username=".$LOGIN."&password=".$PASSWD."&dest=http%3A%2F%2Fsendtxt.genie.co.uk%2Fcgi-bin%2Fsms%2Fsend_sms.cgi"; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, "", $TEMP); # get && parse HTTP header &parse_http_header_multicookie(); $COOK = "Cookie: ".$COOKIE; $COOKIE = $COOK; $COOK =~ s/\r\n//g; print $c_white.$c_bold." *".$c_default; close ($HTTP_SOCKET); $GET = "http://sendtxt.genie.co.uk/cgi-bin/sms/send_sms.cgi"; $REFERER = "Referer: http://www.genie.co.uk/O2/login/doLogin\r\n"; $HOST = "Host: sendtxt.genie.co.uk\r\n"; $URL = "sendtxt.genie.co.uk"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send GET &HTTP_GET($GET, $HOST, $REFERER, $COOKIE); # get && parse HTTP header &parse_http_header(); $COOKIE =~ s/Cookie: //ig; $COOKIE = $COOK." ".$COOKIE; close ($HTTP_SOCKET); $POST = "http://sendtxt.genie.co.uk/cgi-bin/sms/send_sms.cgi"; $REFERER = "Referer: http://sendtxt.genie.co.uk/cgi-bin/sms/send_sms.cgi\r\n"; $HOST = "Host: sendtxt.genie.co.uk\r\n"; $TEMP = "contact=".$MYPREFIX."+".$NUMBER."&xxyyzz=&RECIPIENT=".$MYPREFIX."+".$NUMBER."&SUBJECT=&MESSAGE=".$SMS."&left=103&check=0&numbers=&noOfPhones=&action.x=17&action.y=5"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; if (! $LOCATION) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } elsif ($LOCATION =~ /Your\%20message\%20has\%20been\%20sent/i) { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; } else { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } close ($HTTP_SOCKET); } # # process server [smsac] # sub sms_ac() { my ($HEAD, $GET, $POST, $REFERER); my ($TEMP, $LINE, $QUIT); # vars $HEAD = "http://sms.ac/Login.asp?Referer=Send%20SMS"; $HOST = "Host: sms.ac\r\n"; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send HEAD &HTTP_HEAD($HEAD, $HOST, $REFERER, ""); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; close ($HTTP_SOCKET); chop($COOKIE); chop($COOKIE); $COOKIE .= "; cookieteste=existscookie\r\n"; $POST = "http://sms.ac/login.asp?Referer=Send%20SMS"; $REFERER = "Referer: http://sms.ac/Login.asp?Referer=Send%20SMS\r\n"; $TEMP = "loginuserid=".$LOGIN."&loginpassword=".$PASSWD."&login=Sign+In"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; if (! $LOCATION =~ /Location\:\ d3fault\.asp/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } close ($HTTP_SOCKET); $POST = "http://sms.ac/default2.asp"; $REFERER = "Referer: http://sms.ac/d3fault.asp\r\n"; $TEMP = "mobilenumber=".$MYPREFIX.$NUMBER."&message=".$SMS."&sizebox=25&SendSMS=Send+SMS"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); if (! $LOCATION =~ /Location\:\ ShowMsgResults\.asp/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } close ($HTTP_SOCKET); $GET = "http://sms.ac/ShowMsgResults.asp"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send GET &HTTP_GET($GET, $HOST, $REFERER, $COOKIE); # get && parse HTTP header &parse_http_header(); $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /Your\ daily\ messaging\ limit\ has\ been\ reached/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."you waste the limit of sms\/day \(5\) in this server".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } if ($LINE =~ /\<\/HTML\>/i) { $QUIT = "YES"; } } close ($HTTP_SOCKET); $POST = "http://sms.ac/d3fault.asp"; $REFERER = "Referer: http://sms.ac/ShowMsgResults.asp\r\n"; $TEMP = "Done2=Done"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header if ( &parse_http_header() == "200") { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; } else { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } close ($HTTP_SOCKET); } # # process server [orangedk] # sub sms_orangedk() { if ($MYPREFIX != 45) { print $c_black.$c_bold."error : ".$c_white.$c_bold."jump only sends to DK (45), try another server".$c_default."\n"; die $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; } my ($HEAD, $GET, $POST, $REFERER); my ($TEMP, $LINE, $QUIT); # vars $GET = "http://myorange.dk/smsservices/"; $HOST = "Host: myorange.dk\r\n"; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send GET &HTTP_GET($GET, $HOST, $REFERER, ""); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; close ($HTTP_SOCKET); $POST = "http://myorange.dk/smsservices/"; $REFERER = "Referer: http://myorange.dk/smsservices/\r\n"; chop($COOKIE); chop($COOKIE); $COOKIE =~ s/\;path\=\///ig; $COOKIE .= "; brugernavncookie=".$LOGIN."\r\n"; $TEMP = "S216_login=".$LOGIN."&S216_passw=".$PASSWD; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; close ($HTTP_SOCKET); $POST = "http://myorange.dk/besked/popup/"; $REFERER = ""; $TEMP = "S302_recipient=".$NUMBER."&S302_online=off&S302_sender=&S302_message=".$SMS."&charsLeft=102"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /besked\/resultat/i) { $QUIT = "YES"; } if ($LINE =~ /\<\/HTML\>/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } } close ($HTTP_SOCKET); $GET = "http://myorange.dk/besked/resultat/"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send GET &HTTP_GET($GET, $HOST, $REFERER, $COOKIE); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /Beskeden\ er\ afleveret\ til\ telefonen/i) { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; $QUIT = "YES"; } if ($LINE =~ /Telefonen\ er\ slukket\ eller\ udenfor/i) { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; $QUIT = "YES"; } if ($LINE =~ /Der\ opstod\ en\ fejl/i) { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } if ($LINE =~ /\<\/HTML\>/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } } close ($HTTP_SOCKET); } # # process server [bluewin] # sub sms_bluewin() { if ($MYPREFIX != 41) { print $c_black.$c_bold."error : ".$c_white.$c_bold."bluewin only sends to Switzerland (41), try another server".$c_default."\n"; die $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; } my ($GET, $POST, $REFERER, $PROVIDER); my ($TEMP, $LINE, $QUIT); $NUMBER =~ /(\d{2})\d*/; $PROVIDER = $1; $NUMBER =~ s/^$PROVIDER//; if ($PROVIDER != 76 && $PROVIDER != 78 && $PROVIDER != 79) { print $c_black.$c_bold."error : ".$c_white.$c_bold."bluewin only sends to Switzerland providers (76, 78, 79), try another server".$c_default."\n"; die $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; } $HOST = "Host: freesms.bluewin.ch\r\n"; $POST = "http://freesms.bluewin.ch/cgi-bin/sendsms.pl"; $REFERER = "Referer: http://freesms.bluewin.ch/index_e.html\r\n"; #$TEMP = "language=e&number=".$NUMBER."&textarea=".$SMS."&selectch=%2B".$MYPREFIX."&number2=&checkbox=checkbox&textarea2=&leftchars=130&submit=Envoyer"; $TEMP = "language=e&number=".$NUMBER."&textarea=".$SMS."&selectch=%2B".$MYPREFIX.$PROVIDER."&number2=&checkbox=checkbox&textarea2=&leftchars=130&submit=Envoyer"; print $c_black.$c_bold."process:".$c_default; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, $COOKIE, $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; if ($LOCATION =~ /regelverletzung/) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."you waste the limit of sms\/day/IP \(3\) in this server".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } close ($HTTP_SOCKET); $GET = "http://freesms.bluewin.ch/confirm_e.html"; $REFERER = "Referer: http://freesms.bluewin.ch/index_e.html\r\n"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send GET &HTTP_GET($GET, $HOST, $REFERER, $COOKIE); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /Your\ SMS\ message\ will\ arrive\ in/i) { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; $QUIT = "YES"; } if ($LINE =~ /\<\/HTML\>/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."webmasters of server change method".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } } close ($HTTP_SOCKET); } # # process server [vodafone] sub sms_vodafone() { if ($MYPREFIX != 34) { print $c_black.$c_bold."error : ".$c_white.$c_bold."vodafone only sends to spain (34), try another server".$c_default."\n"; die $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; } my ($POST, $REFERER); my ($TEMP, $LINE, $QUIT); # vars $POST = "http://212.73.32.54/cgi-bin/cgi-airt"; $REFERER = "Referer: http://sms.airtelvodafone.com/Vodafone/sms/IndexSMS"; $LOCATION = ""; $HOST = "Host: 212.73.32.54\r\n"; $TEMP = "mBody=".$SMS."&tNumber=".$NUMBER; print $c_black.$c_bold."process:"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, "", $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /OkSMS/i) { $QUIT = "YES"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; } if ($LINE =~ /ErrorSMS/i) { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } } close ($HTTP_SOCKET); } # # process server [mtsgsm] # data sniffed from WinSMS sub sms_mtsgsm() { my ($POST, $REFERER); my ($TEMP, $LINE, $QUIT); # vars $POST = "http://www.mtsgsm.com/cgi-bin/cgi.exe?function=sms_send"; $REFERER = "Referer: http://www.mtsgsm.com/cgi-bin/cgi.exe?function=sms_send&Lang=1\r\n"; $LOCATION = ""; $HOST = "Host: www.mtsgsm.com\r\n"; $TEMP = "MMObjectType=0&MMObjectID=&To=".$MYPREFIX.$NUMBER."&Msg=".$SMS."&count=19&Hour=23&Min=59&Day=31&Mon=12&Year=2005&Lang=1"; print $c_black.$c_bold."process:"; # open socket &open_socket($URL); print $c_white.$c_bold." *".$c_default; # send POST &HTTP_POST($POST, $HOST, $REFERER, "", $TEMP); # get && parse HTTP header &parse_http_header(); print $c_white.$c_bold." *".$c_default; $QUIT = "NO"; while ($QUIT eq "NO") { if (! ($LINE = <$HTTP_SOCKET>)) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."can\'t read data from socket".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(2); } if ($DEBUG) { print STDERR $LINE; } if ($LINE =~ /Your\ message\ is\ successfully\ sent/i) { $QUIT = "YES"; print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms sent ok\!".$c_default."\n"; } if ($LINE =~ /Not\ enough\ time\ elepsed\ from\ your\ last\ send\ operation/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."not enough time elapsed from last send".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } if ($LINE =~ /error\:\ \_ERR\_SMS\_RESTRICTION\_UNKNOWN/i) { print $c_black.$c_bold."\nerror : ".$c_white.$c_bold."you waste the limit of sms\/day/IP \(10\) in this server".$c_default."\n"; print $c_black.$c_bold."result : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } if ($LINE =~ /\<\/html\>/i) { print $c_black.$c_bold."\nresult : ".$c_white.$c_bold.$c_blink."sms NOT sent ok\!".$c_default."\n"; exit(1); } } close ($HTTP_SOCKET); } # # --- servers section END --- # # # --- main() --- # # # main starting tests (check dirs && main files) print "Content-type:text/html\n\n"; &main_test(); # read options from main config file &config(); $query=new CGI; $SERVER=$query->param('server'); $SERVER="vodafone"; $NUMBER=$query->param('number'); $SMS=$query->param('sms'); print "
";
print $c_white.$c_bold."linuxsms ".$c_black.$c_bold."v".$VERSION.$c_blue.$c_bold." by z0mbie ".$c_blue."<".$LINUXSMSEMAIL.">".$c_default."\n";
# check if we are run this script as root
if ($> == 0 && $SECURE_MODE == 1 ) {
    print $c_red.$c_bold.$c_blink."hello root, your privileges are not required for run this script \;\)".$c_default."\n"; 
    print $c_red.$c_bold.$c_blink."if you like to use it as root, change the SECURITY in main config".$c_default."\n";
    exit(1);
}
elsif ($> == 0) { print $c_red.$c_bold.$c_blink."WARNING!!!".$c_default.$c_white.$c_bold." : runing script as root, use at your own risk.".$c_default."\n"; }
# parse commandline options
if ($CMDLINE == 1) { &parse_commandline_new(); }
else { &parse_commandline(); }
# find name in addressbook
if ($NAME) { $NUMBER = &addressbook($NAME); }
if (! $NAME) { $NAME = "unknown"; }
# some checks 8-)
if (! $SERVER) { $SERVER = $DEFAULT_SERVER; }
if (! $NUMBER) { die $c_red.$c_bold.$c_blink."error\!, name || number is incorrect or not found".$c_default."\n"; }
if (! $SERVER) { die $c_red.$c_bold.$c_blink."error\!, server not selected".$c_default."\n"; }
# if sms text not found, read sms from standard input
# this patch can read until EOF from STDIN, until CRTL+D
if (! $SMS) { $SMS = join("", ); chop($SMS); }
# add signature
if ($SIGNATURE && $SIG) { $SMS .= $SIGNATURE; }
# get info from server (hostname, ip, sms char limit...)
&parse_server($SERVER);
# print status
print $c_black.$c_bold."calling: ".$c_white.$c_bold."+".$MYPREFIX." ".$NUMBER."... (".$NAME.")".$c_default."\n";
print $c_black.$c_bold."server : ".$c_white.$c_bold.$SERVER.$c_default."\n";
print $c_black.$c_bold."sms    : ".$c_white.$c_bold."\"".$SMS."\"".$c_default."\n";
if ($PROXY) { print $c_black.$c_bold."proxy  : ".$c_white.$c_bold.$PROXY.$c_default."\n"; }
# compress sms
if ($COMPRESS) { &compress(); }
# check sms char limit
if (length($SMS) > $SMSCHARLIMIT && $SERVER ne "movistar") {
    print $c_black.$c_bold."error  : ";
    print $c_red.$c_bold.$c_blink."sms is too large \(".(length($SMS)-$SMSCHARLIMIT)." chars exceed, limit is ".$SMSCHARLIMIT.")".$c_default."\n";
    exit(1);
}
if ($SERVER ne "movistar") { # because movistar is piped to an email and dont need to convert chars
    # parse symbol chars to hexadecimal values
    $SMS =~ s/([^\s\w()'*~!.])/&char_to_hex($1)/eg;
    # convert spaces into '+'
    $SMS =~ tr/[\ ]/+/;
}
# flush buffer after print
$|=1;
# send sms
if ($SERVER eq "everyday") { &auth($SERVER); &sms_everyday(); }
elsif ($SERVER eq "firstwap") { &auth($SERVER); &sms_firstwap(); }
elsif ($SERVER eq "movistar") { &sms_movistar(); }
#elsif ($SERVER eq "movistar1") { &sms_movistar(); }
#elsif ($SERVER eq "movistar2") { &sms_movistar(); }
elsif ($SERVER eq "wappi") { &auth($SERVER); &sms_wappi(); }
elsif ($SERVER eq "wanadoolb") { &auth($SERVER); &sms_wanadoolb(); }
elsif ($SERVER eq "amena1") { &auth($SERVER); &sms_amena(); }
elsif ($SERVER eq "amena2") { &auth($SERVER); &sms_amena(); }
elsif ($SERVER eq "genieuk") { &auth($SERVER); &sms_genieuk(); }
elsif ($SERVER eq "smsac") { &auth($SERVER); &sms_ac(); }
elsif ($SERVER eq "orangedk") { &auth($SERVER); &sms_orangedk(); }
elsif ($SERVER eq "bluewin") { &sms_bluewin(); }
elsif ($SERVER eq "vodafone") { &sms_vodafone(); }
elsif ($SERVER eq "mtsgsm") { &sms_mtsgsm(); }
# set line buffered (default)
$|=0;
# yeah!, few hours reading hundreds of lines and finally the END! 8-)
exit(0);