RE: Web Services


Title: RE: Web Services

Sander <

> wrote:

> Is it possible to get information from the database through Web
> Services?
[...]

Yes it is, just help yourself :)

In the old time (3 years ago) we used to use the http protocol and some regexp to feed DB.

I joined a script I am developping to query the whois through the web (the per_mod does not compile for me) and then print sorted result, the script can be modified though to write in a database

The query is all inentnum we maintain, sorted by IP order, and I patheticaly tried to indicate a hierarchy of inclusion.


Friendly,

Let me know if you use and improve it so that I can improve what I have done so far.

Julien Tayon

 
-------------
IMPORTANT NOTICE : The contents of this e-mail and any attachments are
confidential and may be privileged or otherwise protected from disclosure.
It is intended for the named recipient(s) only.
If you are not the intended recipient please notify the system manager
(Postmaster@localhost) or  the sender immediately and delete this message and any
attachment from your system. If you are not the intended recipient you must not copy,
forward or store this message or attachment or disclose the contents to any other
person.

IMPORTANT : Ce message est exclusivement destine a la personne a laquelle il est
adresse. Les informations qu'il contient sont confidentielles et peuvent etre couvertes
par le secret professionnel. Si vous l'avez recu par erreur, nous vous serions
reconnaissants de le renvoyer a son expediteur et de le supprimer de votre systeme
informatique, sans le lire , en prendre copie ou l'envoyer a quiconque.
-------------

#!/usr/bin/perl -w 

# (c) 2003
# Julien Tayon LDCOM 
# julien@localhost julien.tayon@localhost
# 

use strict;
 
use LWP::UserAgent;
use LWP::RobotUA;
use LWP::Authen::Basic;
use Data::Dumper;
use Net::IP;
use Math::BigInt;
my $ua = LWP::UserAgent->new;
$ua->agent("whois wanderer 1.0");
my $req = HTTP::Request->new(GET => 
'http://ripe.net/perl/whois?form_type=advanced&full_query_string=&searchtext=LDCOM-mnt&do_search=Search&reverse_delegation_domains=ON&inverse_attributes=mnt-by&ip_search_lvl=Default&alt_database=RIPE&object_type=inetnum');
my $res = $ua->request($req);

if ($res->is_success) {
# noting here 
} else {
#  print STDERR Dumper ($res->headers);
  die "impossible to get URL \n";
}
my @ips;
my $val;
my $pflag=0;
foreach my $line ( split ("\n", $res->content) ) {
  chomp ($line);
  if( $line =~ m!inetnum[^\d]+([0-9][\d\.\-\s]{10,})! ) {
    $pflag=1;
    push @ips,  new Net::IP($1) or die (Net::IP::Error());
  }
  $pflag = ($line =~ /^source:/) ? 0 : $pflag; 
 # print $line . "\n" if ($pflag);

}
#print Dumper @ips;
sub is_included { 
  my $res = $a->overlaps($b) eq $IP_A_IN_B_OVERLAP;
    if  ( $res != 0 ) {
    return $res;
  } else {
    return  $a->intip() <=> $b->intip() ;
  }
}
my $last;
my $decalage=0;
my $firsttime=0;
my ($a,$b);
my $big=0;
format this =
debut :  @<<<<<<<<<<<<<<<<<< fin : @<<<<<<<<<<<<<<<<<<
         $a,                       $b
.
$~ = 'this';


foreach my $ip (sort is_included @ips) {
  if ( $firsttime eq 0) {
    $last=$ip;
    $firsttime=1;
  }
  
  my $inc;
  if ( $big ) { $last = $big };
 
  $~ = '';
  $inc  = $ip->overlaps($last) eq $IP_A_IN_B_OVERLAP;

  if ($inc) { $decalage++;
              $big=$last;
            } 
  else 
    {$decalage=0;
     $big=0;
   }
  print " " x $decalage . ":" x ( 8 - $decalage ) ;

  $~ = 'this';



  #  foreach my $ip2 (sort { $a <=> $b } @ips) {
  #  if (
  $a=$ip->ip();
  $b=$ip->last_ip();

 write;
  $last=$ip;

}