This gets a list of the latest vulnerabilities from linuxsecurity.com (in rdf format) and compares it with the last one sent. If its new it uses SprintPCS's website to send a message to my phone with the title.
#!/usr/bin/perl -w
use Socket;
use strict;
my $xml_location = "http://www.linuxsecurity.com/linuxsecurity_advisor
+ies.rdf";
my $sprint_site = "http://www.messaging.sprintpcs.com/sms/check_messa
+ge_syntax.html";
my $mobile_num = "1234567890";
my $callback = "";
my $ack_email = "";
my $save_result = "/scripts/wap/current";
my ($message, $page, @host, $item, @line, $current);
&do_socket ($xml_location, "GET $xml_location" );
while (<HTML>) {
@line = split (/>/);
if ($item) {
$line[1] =~ s/<\/title//;
open (CUR, $save_result);
$current = <CUR>;
close (CUR);
if ($line[1] ne $current) {
open (NEW, ">$save_result");
print NEW $line[1];
close (NEW);
$message = $line[1];
$message =~ s/ /%20/g;
&do_socket ($sprint_site, "POST $sprint_site?mobilenum".
"=$mobile_num&callbacknum=$callback&message=$message".
"&ack_add=$ack_email");
}
close (HTML);
exit;
}
elsif ($line[0] =~ /<item/) {
$item = 1;
next;
}
}
sub do_socket {
my ($temp, $action) = @_;
@host = split (/\//, $temp);
socket (HTML, PF_INET, SOCK_STREAM, getprotobyname ('tcp'));
connect (HTML, sockaddr_in (80, inet_aton ($host[2])));
send (HTML, "$action HTTP/1.0\n\n", '0');
}