~ubuntu-branches/ubuntu/natty/ntop/natty

« back to all changes in this revision

Viewing changes to utils/addMacAddressFile.pl

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2005-01-30 21:59:13 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050130215913-xc3ke963bw49b3k4
Tags: 2:3.0-5
* Updated README.Debian file so users will understand what to do at
  install, closes: #291794, #287802.
* Updated ntop init script to give better output.
* Also changed log directory from /var/lib/ntop to /var/log/ntop,
  closes: #252352.
* Quoted the interface list to allow whitespace, closes: #267248.
* Added a couple of logcheck ignores, closes: #269321, #269319.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
# Specify the ntop.db file location
 
4
$ntop_db_file = "../ntop.db";
 
5
 
 
6
if($ARGV[0] eq "") {
 
7
  print "Usage: addMacAddressFile.pl <file name>\n";
 
8
  exit -1;
 
9
}
 
10
 
 
11
if(open(IN, "< $ARGV[0]")) {
 
12
  while(<IN>) {
 
13
 
 
14
    # Remove trailer '\n'
 
15
    if(substr($_, -1, 1) eq "\n") { chop($_); }
 
16
    
 
17
    ($mac, $value) = split (/\t/,$_);
 
18
 
 
19
    print "Adding $mac/$value\n";
 
20
    system("./addMacAddress $mac \"value\" $ntop_db_file");
 
21
  }
 
22
} else {
 
23
  print "FATAL ERROR: unable to read file $ARGV[0]\n";
 
24
}