You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
|
From: <asb...@us...> - 2009-12-16 16:05:20
|
Revision: 12
http://scanorama.svn.sourceforge.net/scanorama/?rev=12&view=rev
Author: asbjornp
Date: 2009-12-16 16:04:59 +0000 (Wed, 16 Dec 2009)
Log Message:
-----------
Changed shebang back to default
Modified Paths:
--------------
trunk/scanorama/bin/report
trunk/scanorama/cgi-bin/hostinfo.cgi
Modified: trunk/scanorama/bin/report
===================================================================
--- trunk/scanorama/bin/report 2009-12-16 16:01:24 UTC (rev 11)
+++ trunk/scanorama/bin/report 2009-12-16 16:04:59 UTC (rev 12)
@@ -1,4 +1,4 @@
-#!/local/bin/perl
+#!/usr/bin/perl
##
## Author : University of Oslo <sca...@us...>
Modified: trunk/scanorama/cgi-bin/hostinfo.cgi
===================================================================
--- trunk/scanorama/cgi-bin/hostinfo.cgi 2009-12-16 16:01:24 UTC (rev 11)
+++ trunk/scanorama/cgi-bin/hostinfo.cgi 2009-12-16 16:04:59 UTC (rev 12)
@@ -1,4 +1,4 @@
-#!/local/bin/perl
+#!/usr/bin/perl
##
## Author : University of Oslo <sca...@us...>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <asb...@us...> - 2009-12-16 16:01:32
|
Revision: 11
http://scanorama.svn.sourceforge.net/scanorama/?rev=11&view=rev
Author: asbjornp
Date: 2009-12-16 16:01:24 +0000 (Wed, 16 Dec 2009)
Log Message:
-----------
Fixed code in more scripts due to change in DBD::Pg
Modified Paths:
--------------
trunk/scanorama/bin/report
trunk/scanorama/cgi-bin/hostinfo.cgi
Modified: trunk/scanorama/bin/report
===================================================================
--- trunk/scanorama/bin/report 2009-12-16 09:51:26 UTC (rev 10)
+++ trunk/scanorama/bin/report 2009-12-16 16:01:24 UTC (rev 11)
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
+#!/local/bin/perl
##
## Author : University of Oslo <sca...@us...>
## Date : 01/07-2003
-## Serial : 2005051801
+## Serial : 2009121601
## Descrption : Scanorama commandline report script
##
@@ -12,7 +12,6 @@
use DBI;
use DBD::Pg;
use Getopt::Long;
-use Data::Dumper;
# Include Scanorama module
use Scanorama;
@@ -22,15 +21,12 @@
my $DSN = $Scanorama::Config->{dsn};
my $USER = $Scanorama::Config->{pguser};
my $PASSWD = $Scanorama::Config->{pgpass};
+my $db_encoding = "$Scanorama::Config->{db_encoding}";
# Commandline options
my ($tcp, $udp, $hosts, @ports, $port, @hosts, $host);
-my ($regex, $os, $output, $match, $subnet, $service, $sreg, $extra, $view, $noports, $usage);
-#my ($usage);
+my ($ip, $regex, $os, $output, $match, $subnet, $service, $sreg, $extra, $view, $noports, $verbose, $help);
-# Enable/disable verbose mode
-my $verbose = 0;
-
my %winver = ('Windows NT 4.0' => "Windows NT 4.0",
'Windows 5.0' => 'Windows 2000',
'Windows 5.1' => 'Windows XP');
@@ -40,30 +36,31 @@
GetOptions ('p|port=s' => \$tcp,
'u=s' => \$udp,
'n|name|hostname=s' => \$hosts,
+ 'ip=s' => \$ip,
'r=s' => \$regex,
'o|os=s' => \$os,
- 'sql=s' => \$extra,
'service=s' => \$service,
'service-matches=s' => \$sreg,
'output=s' => \$output,
'match=s' => \$match,
's|subnet|nett=s' => \$subnet,
- 'u|usage' => \$usage,
'v|view=s' => \$view,
'noports' => \$noports,
+ 'verbose!' => \$verbose,
+ 'help|h|?|u|usage' => \$help,
);
-if ($usage ) {
- usage() ;
+if($help) {
+ usage();
+ die("\nEnd of help\n");
}
$match = "AND" unless (defined $match and $match =~ /^or$/i);
-
# Connect to db
db_connect();
+$dbh->do("SET client_encoding = '$db_encoding'");
-my %tcp_services = %{get_services('tcp')};
my $sql = make_sql();
my $data = get_hostinfo($sql);
@@ -136,28 +133,27 @@
if ($host->{'smtp_server'}) {
print "SMTP: ";
print $host->{'smtp_server'}, "\n";
- }
+ }
- unless ($noports) {
- my $ports = $data->{$key}->{'ports_tcp'};
+ unless ($noports) {
+ for my $proto qw(tcp udp) {
+ my $ports = $data->{$key}->{"ports_" . $proto};
+ if($ports) {
+ print uc($proto), " ports:\n";
+ my %services = %{get_services($proto)};
+ my $name;
- if ($ports) {
- $ports =~ s/\{//g;
- $ports =~ s/\}//g;
-
- print "TCP ports:\n";
- my $name;
-
- for my $port (split /,/, $ports) {
- if (defined @{$tcp_services{$port}}[0]) {
- $name = @{$tcp_services{$port}}[0];
- } else {
- $name = "unknown";
+ foreach my $port(@$ports) {
+ if (defined @{$services{$port}}[0]) {
+ $name = @{$services{$port}}[0];
+ } else {
+ $name = "unknown";
+ } # End of if/else
+ printf "%5d %s\n", $port, $name;
}
- printf "%5d %s\n", $port, $name;
- } # End of for my $port
- } # End of if($ports)
- } # End of unless
+ }
+ }
+ }
} # End of for my $key
@@ -168,7 +164,7 @@
# Sub make_sql
sub make_sql {
my $delim = " AND ";
- my $sql = "SELECT hostname, ip_address, nmap_os as os, ports_tcp, ports_udp, web_server, ftp_server, smtp_server, dns_server, mysql_server, netbios_server, netbios_os, netbios_domain FROM $view WHERE age(last_seen) < '14 days' ";
+ my $sql = "SELECT hostname, ip_address, nmap_os as os, ports_tcp, ports_udp, web_server, ftp_server, smtp_server, dns_server, mysql_server, netbios_server, netbios_os, netbios_domain FROM $view WHERE age(last_seen) < '14 days' ";
# TCP
if ($tcp) {
@@ -224,10 +220,16 @@
if ($subnet) {
die usage() unless ($subnet =~ /\d+\.\d+\.\d+\.\d+\/\d/);
$sql .= "$delim ip_address << \'$subnet\' ";
-
$delim = " AND ";
} # End of if($subnet)
+ # IP
+ if ($ip) {
+ die usage() unless ($ip =~ /\d+\.\d+\.\d+\.\d+/);
+ $sql .= "$delim ip_address = \'$ip\' ";
+ $delim = " AND ";
+ } # End of if($ip)
+
# SERVICE
if ($service) {
$sql .= "$delim $service is not null";
@@ -246,12 +248,6 @@
$delim = " AND ";
} # End of if($sreg)
- # EXTRA
- if ($extra) {
- $sql .= $delim;
- $sql .= $extra;
- } # End of if($extra)
-
die usage() unless ($delim eq " AND " or defined $view);
$verbose and print "$sql \n";;
return $sql;
@@ -306,12 +302,13 @@
$dbh->do($sql);
} # End of sub dbupdate
-# Sub usage - print usage
+## Sub usage - print usage
sub usage {
-return <<End_of_usage
+print<<END;
Usage: report <options>
Options:
+ -(h|help|?|u|usage) Displays usage instructions (this text)
-n <regex|undef> Search for hosts matcing regex.
-n undef gives hosts with missing hostname
@@ -328,6 +325,8 @@
--subnet <subnet/mask> Searches for hosts within a subnet. Subnet
--net declaration must be on the form 129.240.220.0/23
+ -ip <ipadr> Search for single ip-address.
+
-s, --service <name> Lists all hosts running the service specified, and
name can be httpd, smtpd, sshd, named.
@@ -336,10 +335,6 @@
--service-matches Does a regexp-search in all registered services, or
in the service specified with --service.
- --sql Lets you add additional SQL to the database query
-
- -u, --usage Displays usage instructions (this text)
-
-o --os <string> Searches for hosts with os matching string (regex)
-End_of_usage
-} # End of sub usage
+END
+} # End_of_usage
Modified: trunk/scanorama/cgi-bin/hostinfo.cgi
===================================================================
--- trunk/scanorama/cgi-bin/hostinfo.cgi 2009-12-16 09:51:26 UTC (rev 10)
+++ trunk/scanorama/cgi-bin/hostinfo.cgi 2009-12-16 16:01:24 UTC (rev 11)
@@ -1,19 +1,18 @@
-#!/usr/bin/perl
+#!/local/bin/perl
##
## Author : University of Oslo <sca...@us...>
## Date : 01/07-2003
-## Serial : 2005062001
+## Serial : 2009121601
## Descrption : cgi script for detailed host view
##
-#use CGI;
use CGI qw(:param);
use DBI;
use DBD::Pg;
# Include Scanorama module
-use lib '../lib';
+use lib '../../lib';
use Scanorama;
# Vars
@@ -27,11 +26,7 @@
my @fields = qw(hostname ip_address last_seen nmap_os tcp_scan_date udp_scan_date tcp_lightscan_date udp_lightscan_date netbios_domain netbios_os netbios_server netbios_date smtp_server smtp_date web_server web_date ftp_server ftp_date dns_server dns_date mysql_server mysql_date);
# What do you want to do today
-#if ($q->param("ip_address")){
display($q->param("ip_address"));
-#} else {
-# first_page();
-#}
##
### Subs
@@ -40,50 +35,50 @@
# Sub display
sub display {
# Get options
- my $ip_address = shift;
+ my $ip_address = shift;
# ping to se if host is alive
- my $status = system ("$ping $ip_address");
- if ($status) {
+ my $status = system ("$ping $ip_address");
+ if ($status) {
$status = "<font color=\"red\">The host is down</font>";
- } else {
+ } else {
$status = "<font color=\"green\">The host is up</font>";
- }
+ }
- my %labels = (hostname => "Hostname",
- ip_address => "IP address",
- last_seen => "Last seen on",
- nmap_os => "OS (nmap)",
- tcp_scan_date => "Last full TCP scan",
- udp_scan_date => "Last full UDP scan",
- tcp_lightscan_date => "Last light TCP scan",
- udp_lightscan_date => "Last light UDP scan",
- web_server => "Web server",
- web_date => "Web server checked",
- ftp_server => "FTP server",
- ftp_date => "FTP server checked",
- smtp_server => "SMTP server",
- smtp_date => "SMTP server checked",
- mysql_server => "MySQL server",
- mysql_date => "MySQL checked",
- netbios_domain => "Windows domain",
- netbios_os => "NetBIOS OS",
- netbios_server => "NetBIOS server",
- netbios_date => "NetBIOS info checked",
- dns_server => "BIND DNS server",
- dns_date => "DNS server checked",
- );
+ my %labels = (hostname => "Hostname",
+ ip_address => "IP address",
+ last_seen => "Last seen on",
+ nmap_os => "OS (nmap)",
+ tcp_scan_date => "Last full TCP scan",
+ udp_scan_date => "Last full UDP scan",
+ tcp_lightscan_date => "Last light TCP scan",
+ udp_lightscan_date => "Last light UDP scan",
+ web_server => "Web server",
+ web_date => "Web server checked",
+ ftp_server => "FTP server",
+ ftp_date => "FTP server checked",
+ smtp_server => "SMTP server",
+ smtp_date => "SMTP server checked",
+ mysql_server => "MySQL server",
+ mysql_date => "MySQL checked",
+ netbios_domain => "Windows domain",
+ netbios_os => "NetBIOS OS",
+ netbios_server => "NetBIOS server",
+ netbios_date => "NetBIOS info checked",
+ dns_server => "BIND DNS server",
+ dns_date => "DNS server checked",
+ );
# Connect
- db_connect();
+ db_connect();
# Sql statement
- my $sql = "select * from all_view where ip_address = \'$ip_address\'";
+ my $sql = "select * from all_view where ip_address = \'$ip_address\'";
my $sth = $dbh->prepare($sql);
$sth->execute();
- print $q->header();
- print qq|
+ print $q->header('text/html');
+ print qq|
<html>
<head>
<title> S C A N O R A M A - detailed info page </title>
@@ -97,145 +92,144 @@
<b>[</b><a href="../">/</a><b>]</b>
</p>
|;
- print qq|<table border="1">|;
+ print qq|<table border="1">|;
print "<tr><td colspan=\"5\" align=\"center\"><h3>Registered information</h3></td></tr>";
# Loop through output
- while (my $ref = $sth->fetchrow_hashref()) {
- my %h = %{$ref};
+ while (my $ref = $sth->fetchrow_hashref()) {
+ my %h = %{$ref};
- # For each of the keywords we put in @fields
- for my $key (@fields) {
- # We want scan dates even though they are NULL in db, so we temp label it
- if (!$h{$key} && $labels{$key} =~ /P scan/i){ $h{$key} = 'never'; }
+ # For each of the keywords we put in @fields
+ for my $key (@fields) {
+ # We want scan dates even though they are NULL in db, so we temp label it
+ if (!$h{$key} && $labels{$key} =~ /P scan/i){ $h{$key} = 'never'; }
- # If $key doesnt have value in hash $h, print it to web
- if ($h{$key}) {
- print "<tr><td>";
- print $labels{$key};
- print "<td>";
- if (($key eq "hostname" or $key eq "web_server") and $h{'web_server'}) {
- print "<a href=\"http://$h{ip_address}\">\n";
- print $h{$key};
- print "</a>\n";
- } elsif ( $key eq "ftp_server" and $h{'ftp_server'}) {
- print "<a href=\"ftp://$h{ip_address}\">\n";
- print $h{$key};
- print "</a>\n";
- } else {
- print $h{$key};
- } # End of if/elsif/else
- print "</td></tr>\n";
- } # End of if($h{$key})
- } # End of for
+ # If $key doesnt have value in hash $h, print it to web
+ if ($h{$key}) {
+ print "<tr><td>";
+ print $labels{$key};
+ print "<td>";
+ if (($key eq "hostname" or $key eq "web_server") and $h{'web_server'}) {
+ print "<a href=\"http://$h{ip_address}\">\n";
+ print $h{$key};
+ print "</a>\n";
+ } elsif ( $key eq "ftp_server" and $h{'ftp_server'}) {
+ print "<a href=\"ftp://$h{ip_address}\">\n";
+ print $h{$key};
+ print "</a>\n";
+ } else {
+ print $h{$key};
+ } # End of if/elsif/else
+ print "</td></tr>\n";
+ } # End of if($h{$key})
+ } # End of for
- print "<tr><td>Status</td><td>$status</td></tr>\n";
- print "</table>\n";
- print "</p>\n";
- print "<table border=\"1\">\n";
- print "<tr><td colspan=\"5\" valign=\"top\" align=\"center\"><h3>Ports</h3></td></tr>\n";
+ print "<tr><td>Status</td><td>$status</td></tr>\n";
+ print "</table>\n";
+ print "</p>\n";
+ print "<table border=\"1\">\n";
+ print "<tr><td colspan=\"5\" valign=\"top\" align=\"center\"><h3>Ports</h3></td></tr>\n";
- for my $proto qw(tcp udp) {
- print '<tr>' unless ($proto eq "udp");
- print "<td valign=\"top\">";
- portlist($h{"ports_" . $proto}, $proto, $h{'ip_address'});
- print "</td>\n";
- } # End of for
- print "</tr></table>\n";
+ for my $proto qw(tcp udp) {
+ print '<tr>' unless ($proto eq "udp");
+ print "<td valign=\"top\">";
+ portlist($h{"ports_" . $proto}, $proto, $h{'ip_address'});
+ print "</td>\n";
+ } # End of for
+ print "</tr></table>\n";
- # Sql statement
- my $sql = "select date,author,comment from comments where ip_address = \'$h{ip_address}\'";
- my $sth = $dbh->prepare($sql);
- $sth->execute();
- my $count = $sth->rows();
+ # Sql statement
+ my $sql = "select date,author,comment from comments where ip_address = \'$h{ip_address}\'";
+ my $sth = $dbh->prepare($sql);
+ $sth->execute();
+ my $count = $sth->rows();
- if($count) {
- print "</table>\n";
- print "<br><br>\n";
+ if($count) {
+ print "</table>\n";
+ print "<br><br>\n";
- print "<table border=\"1\">\n";
- print "<tr><td colspan=\"5\" align=\"center\"><h3>Comments</h3></td></tr>\n";
- print "<tr><td><b><center>Date</center></b></td><td><b><center>Author</center></b></td><td><b><center>Text</center></b></td><td> </td></tr>\n";
+ print "<table border=\"1\">\n";
+ print "<tr><td colspan=\"5\" align=\"center\"><h3>Comments</h3></td></tr>\n";
+ print "<tr><td><b><center>Date</center></b></td><td><b><center>Author</center></b></td><td><b><center>Text</center></b></td><td> </td></tr>\n";
- my $array_ref = $dbh->selectall_arrayref($sql);
+ my $array_ref = $dbh->selectall_arrayref($sql);
- # Spinning tha weel
- while (my $ref = $sth->fetchrow_arrayref()) {
- my ($tmp1,$tmp2) = split(" ", ${$ref}[0]);
- print "<tr><td>$tmp1</td><td>${$ref}[1]</td><td>${$ref}[2]</td><td><a href=\"comments.cgi?perform=del&ip_address=$h{ip_address}&author=${$ref}[1]&delDate=$tmp1&delTime=$tmp2\">Delete</a></td></tr>\n";
- }
- print "</table>\n";
+ # Spinning tha weel
+ while (my $ref = $sth->fetchrow_arrayref()) {
+ my ($tmp1,$tmp2) = split(" ", ${$ref}[0]);
+ print "<tr><td>$tmp1</td><td>${$ref}[1]</td><td>${$ref}[2]</td><td><a href=\"comments.cgi?perform=del&ip_address=$h{ip_address}&author=${$ref}[1]&delDate=$tmp1&delTime=$tmp2\">Delete</a></td></tr>\n";
}
- print "</table>\n";
- print "<a href=\"comments.cgi?perform=add&ip_address=$ip_address\"><h5>==> Add new comment for this ip</h5>\n";
- } # End of while
+ print "</table>\n";
+ }
+ print "</table>\n";
+ print "<a href=\"comments.cgi?perform=add&ip_address=$ip_address\"><h5>==> Add new comment for this ip</h5>\n";
+ } # End of while
print "</body>\n";
print "</html>\n";
# Disconnect
- db_disconnect();
+ db_disconnect();
} # End of sub display
# Sub get_services
sub get_services {
# Get options
- my $proto = shift;
+ my $proto = shift;
# Local vars and hashes
my ($port, $name, $descr);
- my %services;
+ my %services;
# Sql statement
- my $sql = "select port, name, descr from services where proto = \'$proto\'";
- my $array_ref = $dbh->selectall_arrayref($sql);
+ my $sql = "select port, name, descr from services where proto = \'$proto\'";
+ my $array_ref = $dbh->selectall_arrayref($sql);
# Spinning tha weel
- for my $ref (@{$array_ref}) {
+ for my $ref (@{$array_ref}) {
($port, $name, $descr) = @{$ref};
my @ary = ($name, $descr);
$services{$port} = \@ary;
- } # End of for
+ } # End of for
return \%services;
} # End of get_services
# Sub portlist
sub portlist {
- # Get options
- my $ports = shift;
- my $proto = shift;
- my $ip_address = shift;
+ my $ports = shift;
+ my $proto = shift;
+ my $ip_address = shift;
# Local vars and hashes
- my %services = %{get_services($proto)};
+ my %services = %{get_services($proto)};
my $name;
# Remove unwanted chars
- $ports =~ s/\{//g;
- $ports =~ s/\}//g;
+ $ports =~ s/\{//g;
+ $ports =~ s/\}//g;
# print print print
- print qq|<table border="1">|;
+ print qq|<table border="1">|;
- last unless $ports =~ /\d/;
+ last unless $ports =~ /\d/;
- print "<tr><td colspan=\"5\" align=\"center\"><h3>$proto</h3></td></tr>";
-
- for my $port (split /,/, $ports) {
- if (defined @{$services{$port}}[0]) {
- $name = @{$services{$port}}[0];
+ print "<tr><td colspan=\"5\" align=\"center\"><h3>$proto</h3></td></tr>";
+
+ foreach my $port(@$ports) {
+ if (defined $ports->[0]) {
+ $name = @{$services{$port}}[0];
} else {
- $name = "unknown";
+ $name = "unknown";
} # End of if/else
if ($proto eq "tcp" and $port == 80) {
- printf "<tr><td><a href=\"http://$ip_address\">%d</a></td><td><a href=\"http://$ip_address\">%s</a></td></tr>", $port, $name;
+ printf "<tr><td><a href=\"http://$ip_address\">%d</a></td><td><a href=\"http://$ip_address\">%s</a></td></tr>", $port, $name;
} elsif ($proto eq "tcp" and $port == 21) {
- printf "<tr><td><a href=\"ftp://$ip_address\">%d</a></td><td><a href=\"ftp://$ip_address\">%s</a></td></tr>", $port, $name;
+ printf "<tr><td><a href=\"ftp://$ip_address\">%d</a></td><td><a href=\"ftp://$ip_address\">%s</a></td></tr>", $port, $name;
} else {
- printf "<tr><td>%d</td><td>%s</td></tr>", $port, $name;
+ printf "<tr><td>%d</td><td>%s</td></tr>", $port, $name;
} # End of if/elsif/else
- } # End of for
+ } # End of for
print "</table>";
} # End of sub portlist
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <asb...@us...> - 2009-12-16 09:51:33
|
Revision: 10
http://scanorama.svn.sourceforge.net/scanorama/?rev=10&view=rev
Author: asbjornp
Date: 2009-12-16 09:51:26 +0000 (Wed, 16 Dec 2009)
Log Message:
-----------
Changed code for get_hostinfo() in Update.pm to only return one row, to reduce db-traffic for large number of hosts
Modified Paths:
--------------
trunk/scanorama/lib/Scanorama/Update.pm
Modified: trunk/scanorama/lib/Scanorama/Update.pm
===================================================================
--- trunk/scanorama/lib/Scanorama/Update.pm 2009-12-15 13:50:16 UTC (rev 9)
+++ trunk/scanorama/lib/Scanorama/Update.pm 2009-12-16 09:51:26 UTC (rev 10)
@@ -2,7 +2,7 @@
##
## Author : University of Oslo <sca...@us...>
## Date : 01/07-2003
-## Serial : 2009121501
+## Serial : 2009121601
## Descrption : Configuration module for Scanorama, used by all scripts and modules
##
@@ -63,9 +63,6 @@
db_connect();
$dbh->do("SET client_encoding = '$db_encoding'");
- # Get registered info from the database
- $registered = get_hostinfo();
-
# Parse XML-file to get new info
my $hosts = parse_file($xml_file);
$verbose and print "hosts: ", scalar @{$hosts}, "\n";
@@ -75,21 +72,25 @@
my @lines;
for my $host (@{$hosts}) {
- $verbose and print "-------------------------------------------\n\n";
+ $verbose and print "-------------------------------------------\n\n";
- if (exists $registered->{${$host}->{ip_address}}) {
+ # Get registered info from the database
+ $host = ${$host};
+ $registered = get_hostinfo("$host->{ip_address}");
+
+ if (exists $registered->{'ip_address'}) {
@lines = make_update($host);
$verbose and print "update_lines:\n", join "\n", @lines, "\n";
for $line (@lines) {
- dbupdate($line);
- }
- } else {
+ dbupdate($line);
+ }
+ } else {
my @lines = make_insert($host);
$verbose and print "insert_lines:\n", join "\n", @lines, "\n";
for $line (@lines) {
- dbupdate($line);
+ dbupdate($line);
} # End of for $line
- } # End of if/else
+ } # End of if/else
} # End of for my $hsot
unlink $xml_file unless ($test);
@@ -251,7 +252,7 @@
# If the host is down, we want to know it if we
# already have it in the database
if ($key->{status}->{state} eq "down") {
- if (defined $registered->{$ip_address}) {
+ if (defined $registered->{'$ip_address'}) {
$o->{state} = "down";
$o->{ip_address} = $key->{address}->{addr};
push @wanted, \$o;
@@ -442,13 +443,13 @@
my $wanted = 0;
my $host = shift;
my @sql;
- $host = ${$host};
+ #$host = ${$host};
my ($ports_tcp, $ports_udp, $num_filtered, $os, $ip_address, $hostname, $uptime, $last_boot, $scan_rate);
my (@closed_udp, @closed_tcp) = ();
%reg_tcp = ();
my %reg_udp = ();
- my $reg_os = $registered->{$host->{ip_address}}->{os};
+ my $reg_os = $registered->{'os'};
# Prepare some data for later
$ip_address = $host->{ip_address};
@@ -489,19 +490,18 @@
my $sql = "UPDATE hosts SET ";
- # If we did a tcp scan
+ # If we did a tcp scan
if ($ports_tcp) {
$wanted++;
# TODO : Check if we could drop doing get_hosts before full scan
- #unless ($full_tcp_scan or $full_udp_scan) {
unless ($full_tcp_scan) {
# Get registered TCP ports
- my $reg_tcp = $registered->{$host->{ip_address}}->{ports_tcp};
+ my $reg_tcp = $registered->{'ports_tcp'};
# TODO: remove next line?
- my $reg_full_tcp_scan = $registered->{$host->{ip_address}}->{full_tcp_scan};
+ my $reg_full_tcp_scan = $registered->{'full_tcp_scan'};
# Push referance (of tcp ports from db) to a hash
foreach (@$reg_tcp) { $reg_tcp{$_}=1; }
@@ -545,8 +545,8 @@
$wanted++;
unless ($full_udp_scan) {
- my $reg_udp = $registered->{$host->{ip_address}}->{ports_udp};
- my $reg_full_udp_scan = $registered->{$host->{ip_address}}->{full_udp_scan};
+ my $reg_udp = $registered->{'ports_udp'};
+ my $reg_full_udp_scan = $registered->{'full_udp_scan'};
# Push referance (of udp ports from db) to a hash
foreach (@$reg_udp) { $reg_udp{$_}=1; }
@@ -625,7 +625,7 @@
}
if ($hostname) {
- my $reg_hostname = $registered->{$host->{ip_address}}->{hostname};
+ my $reg_hostname = $registered->{'hostname'};
if (defined $hostname and defined $reg_hostname and $hostname ne $reg_hostname) {
$wanted++;
$hostname = $dbh->quote($hostname);
@@ -928,8 +928,9 @@
# Get registered info from the database
sub get_hostinfo {
- my $sql = "SELECT ip_address, hostname, ports_tcp, ports_udp, full_tcp_scan, full_udp_scan, os FROM hosts";
- my $hash_ref = $dbh->selectall_hashref($sql, "ip_address");
+ my $adr = shift;
+ my $sql = "SELECT ip_address, hostname, ports_tcp, ports_udp, full_tcp_scan, full_udp_scan, os FROM hosts WHERE ip_address = \'$adr\'";
+ my $hash_ref = $dbh->selectrow_hashref($sql);
$debug and print "Value returned: $hash_ref->{val}\n";
return $hash_ref;
@@ -940,7 +941,6 @@
my $sql = shift;
my $sth;
# $dbh->do($sql) or db_error($sql);
- print "\nDEBUG : $sql";
$sth = $dbh->prepare($sql);
$sth->execute();
} # End of sub dbupdate
@@ -973,6 +973,5 @@
return $timestamp;
} # End of sub timestamp
-
# Be positive!
1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pe...@us...> - 2007-09-11 13:45:45
|
Revision: 7
http://scanorama.svn.sourceforge.net/scanorama/?rev=7&view=rev
Author: pere
Date: 2007-09-11 06:45:43 -0700 (Tue, 11 Sep 2007)
Log Message:
-----------
Add contact info, and test the new commits mailing list.
Modified Paths:
--------------
trunk/scanorama/README
Modified: trunk/scanorama/README
===================================================================
--- trunk/scanorama/README 2007-08-28 15:12:44 UTC (rev 6)
+++ trunk/scanorama/README 2007-09-11 13:45:43 UTC (rev 7)
@@ -8,3 +8,6 @@
The latest version is available from
<URL: https://sourceforge.net/projects/scanorama/ >.
+
+To report problems, submit patches or contact the developers, use the
+sca...@li... mailing list.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|