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'); }

Replies are listed 'Best First'.
Re: send latest advisories
by dws (Chancellor) on Oct 12, 2001 at 23:29 UTC
    The handling of URLs in this script looks suspicious. In particular, the GET and POST that get manufactured use the full "http://host" URL form. This might work for whatever web servers Sprint uses (Netscape Enterprise 3.6 when I looked a moment ago), but other web servers might take umbrage at seeing a request come in that starts with "http://". I see these periodically in my Apache logs, and a bit of experimenting suggests that Apache won't abide by this scheme.