SMS gateway dengan Gammu tidak mengirim pesan

Diskusi tentang Ubuntu Server baik webserver, database server, samba server dan service lainnya serta jaringan menggunakan Sistem Operasi Ubuntu.
Post Reply
User avatar
sumardani
Contact:

SMS gateway dengan Gammu tidak mengirim pesan

Post 10 Feb 2013, 14:51

Selamat siang para master,
saya mau tanya Sms gateway dengan Gammu dan modem vodafone K3565 rev b ko ga mengirim pesan ke handphone padahal udah dicek udah running dan sudah masuk ke dalam database tp reportnya ga diterima di hp
berikut source code nya
#!/usr/bin/perl

use DBI;
use DBD::mysql;
use strict;
use Net::SMTP;


my $STime = time();
my $lastcheck = 10000;
my $DBC = DBI->connect('DBI:mysql:snortdb','root','asdasd') || die "$DBI::errstr";
my $DBSMS = DBI->connect('DBI:mysql:smsd','root','asdasd') || die "$DBI::errstr";
my $ip_src = "";
my $ip_dst = "";
my $sig_id = "";
my $sig_name = "";
my $timestamp = "";



sub SET_DATABASE_CONNECTION {
my $DBC = DBI->connect('DBI:mysql:snortdb','root','asdasd') || die "$DBI::errstr";
my $DBSMS = DBI->connect('DBI:mysql:smsd','root','asdasd') || die "$DBI::errstr";
}

sub GET_LASTCHECK {
$STime = time();
my $get_lastcheck = $DBC->prepare("SELECT lastcheck FROM snortdb.lastcheck");
$get_lastcheck->execute();
while ( my $ref_lastcheck = $get_lastcheck->fetchrow_hashref() ) {
$lastcheck = $ref_lastcheck->{'lastcheck'};
}
my $set_lastcheck = $DBC->prepare("UPDATE snortdb.lastcheck SET lastcheck = $STime");
$set_lastcheck->execute();
}


sub DO_CHECK {
$STime = time();
my $q_sel_src = "SELECT DISTINCT(INET_NTOA(a.ip_src)) as ip_src, INET_NTOA(a.ip_dst) as ip_dst,
a.sid, a.cid, c.sig_id, c.sig_name, b.timestamp
from ((iphdr a left join event b on (a.sid = b.sid AND a.cid = b.cid))
left join signature c on b.signature = c.sig_id) left join ip_blocked d on (a.ip_src d.ip_src)
WHERE c.filtered = 1 AND a.checked = 0 AND a.ip_src INET_ATON('192.168.1.1')
AND a.ip_src INET_ATON('10.35.2.1') AND ( (FROM_UNIXTIME($lastcheck) = b.timestamp))
GROUP BY a.ip_src";
my $sel_src = $DBC->prepare($q_sel_src);
$sel_src->execute();
while ( my $ref = $sel_src->fetchrow_hashref() ) {
my $ip_src = $ref->{'ip_src'};
my $ip_dst = $ref->{'ip_dst'};
my $sid = $ref->{'sid'};
my $cid = $ref->{'cid'};
my $sig_id = $ref->{'sig_id'};
my $sig_name = $ref->{'sig_name'};
my $timestamp = $ref->{'timestamp'};
my $cmd = `/usr/sbin/arp -a $ip_src`;
my ( $aa, $bb, $cc, $mac_addr, $dd ) = split (/\ /,$cmd);
my $temp = "INSERT INTO snortdb.ip_blocked (ip_src, ip_dst, mac, sid, cid, sig_id, sig_name, timestamp)
VALUES (INET_ATON('$ip_src'), INET_ATON('$ip_dst'), '$mac_addr', $sid, $cid, $sig_id, '$sig_name', '$timestamp')";
my $ins_blocked = $DBC->prepare($temp);
my $set_check = $DBC->prepare("UPDATE snortdb.iphdr SET checked = 1 WHERE (sid = $sid) AND (cid = $cid)");

// source gammu

my $ins_smsd = $DBSMS->prepare("INSERT INTO snortdb.outbox (DestinationNumber, TextDecoded) VALUES ('081573644999', 'ALERT: $ip_src || $mac_addr || $timestamp || $sig_name' )");
$ins_smsd->execute();
//
Terima kasih


User avatar
q_p
Contact:

Post 10 Feb 2013, 19:34

Bantu sundul saja mas, sory :)
OOT= Apakah SMSgateway dengan Gammu ini bisa memproses seperti yang di tv itu :"ketik reg spasi 777 kirim ke 080808" ?


Post Reply

Who is online

Users browsing this forum: No registered users and 89 guests