Skip to main content

உபுண்டு டெர்மினலில் இருந்து இலவசமாக sms அனுப்பலாம்






இன்று டெர்மினலில் இருந்து எப்படி இலவசமாக sms அனுப்புவது என்று பார்க்கலாம்.

way2sms சென்று sms அனுப்புவதற்கு அந்த தளத்தின் விளம்பரங்களை தாண்டிதான் அனுப்ப வேண்டியிருக்கிறது. விளம்பரங்களை பார்க்கமால் சுலபமாக இந்த script ஐ பயன்படுத்தி இலவசமாக sms அனுப்பலாம்.

இதற்கு முதலில் way2sms ன் பயனராக இருக்க வேண்டும். இல்லை என்றால way2sms.com சென்று ஒரு அக்கவுண்டினை தொடங்கிகொள்ளவும். username, password  வேண்டும்.


இந்த script பயன்படுத்தி மொத்தமாக எத்தனை பேருக்கு வேண்டுமானாலும் sms அனுப்பலாம்.

நீங்கள் உபுண்டு பயனாளர் என்றால் இந்த இரு பேக்கேஜ்களும் வேண்டும்.

இதனை நிறுவ

$ sudo apt-get install libwww-mechanize-perl libio-compress-zlib-perl

என்று டெர்மினலில் கொடுக்கவும். பிறகு கீழே உள்ள scriptஐ காபி செய்து sms என்ற பேரில் சேமிக்கவும். இதில் username மற்றும் passwordல் உங்கள் way2sms ன் username, passwordஐ கொடுக்கவும்.

பிறகு இதனை /usr/bin ற்கு நகர்த்த வேண்டும் அப்போதுதான் நாம் டெர்மினலில் எங்கிருந்த்து வேண்டுமனாலும் அதனை இயக்க முடியும். அதற்கு

$ sudo mv sms /usr/bin/sms

என்று தரவும்.

பிறகு இதன் file permission மாற்ற

$ sudo chmod 755 /usr/bin/sms

என்று தரவும். அப்போது தான் இதனை நாம் இயக்க முடியும்.

இதனை பயன்படுத்த:

1. $ sms 9876543210 ‘hello’
2. $ sms 9876543210,9876501234,9988776655 ‘good morning’


 நீங்கள் அனுப்பவேண்டிய தொலைபேசி எண்களை gedit ல் ஒன்றன் பின் ஒன்றாக போட்டுக்கொள்ளுங்கள். அதனை எதாவது ஒரு பேரில் சேமியுங்கள். அதில் உள்ள அணைத்து எண்களுக்கும் sms அணுப்ப

$ sms -f smslist 'உங்கள் தகவல்'

என்று கொடுத்தால் போதும். sms அணைவருக்கும் சென்று விடும்.

#!/usr/bin/perl

###############################################################################################
# source link : http://digitalpbk.com/2009/12/perl-script-send-free-sms-any-mobile-number-india-using-way2sms
# From CPAN :  from CPAN link itself you can download the source for way2sms.
#
# Modified by : Arulalan.T (arulalant@gmail.com)
#
# Version : 1b on 29-10-2011
#
# Goal : send sms through way2sms.com with few easy options. So I modified this below code accordingly.
#
# Note : This should work only to the Indian regions cell phone numbers only
#
# Usage :
#    Save this file in the path /usr/bin/sms and make it as excutable by setting permission
#    1. $ sms 9876543210 'hello'
#    2. $ sms 9876543210,9876501234,9988776655 'hai dude'
#    3. $ sms -f sms-nos-list-file 'message'
#                sms-nos-list-file is a text file, that contains the 10 digit phone nos with new line character.
#                i.e. each line must have only one phone no.
#                We no need to use +91 or 0 prefix no. So use only 10 digit phone no alone.
####################################################################################################

use WWW::Mechanize;
use Compress::Zlib;

my $mech = WWW::Mechanize->new();

my $username = "way2sms login username"; #fill in username here
my $keyword = "password";  #fill in password here

my ($text,$mobile,$option);
my @mobilenos;
$option = $ARGV[0];

if ( $option == "-f") {
# reading file and collecting the nos
my $smslistfile = $ARGV[1];
$text = $ARGV[2];
open(FILE,$smslistfile) or die "Can not open file\n";
@mobilenos = <FILE>;
close FILE;
}
else{
my $morenos = $ARGV[0];
if (length($morenos) > 10) {
# splitting nos with comma seperated in the first arg
@mobilenos = split(',',$morenos);
}
else {
# for single phone no
@mobilenos = $morenos;
}
# collecting message to send
$text = $ARGV[1];
}

$deb = 1;

print "Total Character of message is ".length($text)."\n" if($deb);

$text = $text."\n\n\n\n\n" if(length($text) < 135);

$mech->get("http://wwwl.way2sms.com/content/index.html");
unless($mech->success())
{
exit;
}
$dest = $mech->response->content;

print "Fetching...\n" if($deb);

if($mech->response->header("Content-Encoding") eq "gzip")
{
$dest = Compress::Zlib::memGunzip($dest);
$mech->update_html($dest);
}

# Commented the below line from version 1b. Uncomment it for version 1a.
#$dest =~ s/<form name="loginForm"/<form action='..\/auth.cl' name="loginForm"/ig;

# Added the below updated line to replace the above line in the version 1b.
$dest =~ s/<form name="loginForm"/<form action='..\/Login1.action' name="loginForm"/ig;

$mech->update_html($dest);
$mech->form_with_fields(("username","password"));
$mech->field("username",$username);
$mech->field("password",$keyword);

print "Loggin...\n" if($deb);

$mech->submit_form();

$dest= $mech->response->content;

if($mech->response->header("Content-Encoding") eq "gzip")
{
$dest = Compress::Zlib::memGunzip($dest);
$mech->update_html($dest);
}

foreach $mobile (@mobilenos){
# for loop begins
chomp($mobile);
print "\nMessage sending to ".($mobile)."\n";

$mech->get("http://wwwl.way2sms.com//jsp/InstantSMS.jsp?val=0");
$dest= $mech->response->content;
if($mech->response->header("Content-Encoding") eq "gzip")
{
$dest = Compress::Zlib::memGunzip($dest);
$mech->update_html($dest);
}

print "Sending ... \n" if($deb);

$mech->form_with_fields(("MobNo","textArea"));
$mech->field("MobNo",$mobile);
$mech->field("textArea",$text);
$mech->submit_form();

if($mech->success())
{
print "Done \n" if($deb);
}
else
{
print "Failed \n" if($deb);
exit;
}

$dest =  $mech->response->content;
if($mech->response->header("Content-Encoding") eq "gzip")
{
$dest = Compress::Zlib::memGunzip($dest);
#print $dest if($deb);
}

if($dest =~ m/successfully/sig)
{
print "Message sent successfully \n" if($deb);
}

# foreach loop ends
}

print "Message sent to all the numbers\n Bye.\n";
exit;
#EOF 

Comments

  1. தலீவா, ரொம்ப தாங்க்ஸ். ஆனா ஏதோ தப்புன்னு சொல்லுதே, கொஞ்சம் உதவ முடியுமா?

    sms ********** 'Hello'
    Total Character of message is 5
    Fetching...
    There is no form with the requested fields at /usr/bin/sms line 87
    Loggin...

    Message sending to **********
    Sending ...
    There is no form with the requested fields at /usr/bin/sms line 118
    Can't call method "value" on an undefined value at /usr/share/perl5/WWW/Mechanize.pm line 1348.

    ReplyDelete
  2. இங்கிருந்து codeஐ download பண்ணிக்கோங்க
    https://gist.github.com/e076f46cbc49dc352632

    ReplyDelete
  3. எனக்கு நன்றாக வேலை செய்கிறது நன்றி.

    ReplyDelete
  4. தற்போது இது வேலை செய்கிறது!! நிச்சயம் எனக்கு இது மிகவும் பயனுள்ளதாக இருக்கும் என்று நம்புகிறேன். நன்றி நண்பா!!

    ReplyDelete

Post a Comment

Popular posts from this blog

ARP/RARP full simulation program

server.c #include "stdio.h" #include "stdlib.h" #include "string.h" #include "sys/types.h" #include "sys/socket.h" #include "arpa/inet.h" #include "netinet/in.h" #define SA struct sockaddr struct IPmac { char ip[100]; char mac[100]; }; int main() { int sockfd,len,i; struct sockaddr_in servaddr; char buff[30],temp[30],ip[30],mac[30];

Configure opendns in ubuntu 12.04

Today i have changed my dns server name to opendns. which is alternative to default dns and it provide more secure, faster browsing experience. What is opendns? OpenDNS is the leading provider of Internet security and DNS services Industry leading malware and botnet protection Award winning Web filtering Faster, reliable, more secure DNS Ultra-reliable, globally distributed cloud network Simple, Smart, Easy How to configure opendns in ubuntu 12.04: open terminal and type sudo nano /etc/resolv.conf enter your password and change these lines   nameserver 208.67.222.222  nameserver 208.67.220.220 to use google public dns use 8.8.8.8, 8.8.4.4 instead of 208.67.222.222, 208.67.220.220 simple isn't..! now see your facebook load faster than before. opendns comes with parental control, so never worry about unwanted websites, and your childrens are safe now. to check your dns changed successfully goto welcome.opendns.com

Given a string, reverse only vowels in it; leaving rest of the string as it is

/* Given a string, reverse only vowels in it; leaving rest of the string as it is. Input : abcdef Output : ebcdaf */ import java.io.*; import java.util.*; public class VowelReverse { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); String vowels = ""; String ans = ""; int arr[] = new int[str.length()]; for(int i=0;i<str.length();i++) { if(str.charAt(i)=='a' || str.charAt(i)=='e' || str.charAt(i)=='i' || str.charAt(i)=='o' || str.charAt(i)=='u') { vowels+=str.charAt(i); arr[i]=1; } } String revVowels = new StringBuffer(vowels).reverse().toString(); int j=0; for(int i=0;i<str.length();i++) { if(arr[i]!=1) { ans+=str.charAt(i); } else { ans+=revVowels.charAt(j); j++; } } System.out.println(ans); } }