Saturday, October 29, 2005

another sms script

this works with a gprs router/modem attched to your box. can be easily modified to work with mobile phones as well. just replace the telnet part with maybe with a serial connection or connect throug bluetooth. then use the AT commands. In this case I am using a SARIAN 2000 Series EDGE Router, connect through eth. the script here works with xchat. so ppl just need to send you the msg !sms number message

#!/usr/bin/perl
#sms send script from xchat by darkm00n

use Net::Telnet ();

IRC::register("darkm00nSMS",1.0,"","");

IRC::add_message_handler("PRIVMSG", "privmsg_handler");
IRC::print("[darkm00n SMS Loaded]");

sub privmsg_handler {
$irc_message = shift(@_);
$irc_message =~ ~ /:(.*)!(.*@.*).*(#.*) :(.*)/;
$irc_nick = lc $1;

my @msgs = split(' ', $irc_message);

if ($msgs[3] eq ":!sms") {
$t = new Net::Telnet (Timeout => 10, Prompt => '/ss32263>/');
$t->open("192.168.0.99");
$t->login("username","password");
$words = @msgs;

$text= " ";
for ($r=5;$r<=$words;$r++){
$text = $text . " " . $msgs[$r];
}

$number = $msgs[4];
@lines = $t->cmd('sendsms '. $number . ' "'. $text . ' - darkm00n sms script-"');
$t->close;
sleep(1);
IRC::print(@lines);
}

return 0;
}

No comments: