#!/usr/bin/perl
# openvas display script_id
# (C) 2008 Vlatko Kosturjak <kost@linux.hr>. GPL v2+

use strict;

foreach my $file (<*.nasl>) {
	open (FILE,"<$file") or die "cannot open file for reading: $!";
	print "$file: ";
	while (<FILE>) {
		next if (/^\w*#/);
		if (/script_id/) {
			if (/script_id\ *\(\ *(\d+)\ *\)/) {
				print "$1";
			} else {
			 	print "Probably syntax error in script_id";
			}
		}
	}
	print "\n";
	close (FILE);
}
