+sub gethostcount
+{
+ my $searchstring=shift;
+ my $srvcounter=0;
+ #Count services used in servicegroups
+ foreach my $key (keys %customgrp) {
+ if($customgrp{$key}[2] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - config
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[4] eq $searchstring){
+ $srvcounter++;
+ }
+ if($fwfwd{$key1}[6] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - input
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[4] eq $searchstring){
+ $srvcounter++;
+ }
+ if($fwinp{$key2}[6] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - outgoing
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[4] eq $searchstring){
+ $srvcounter++;
+ }
+ if($fwout{$key3}[6] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ return $srvcounter;
+}
+sub getnetcount
+{
+ my $searchstring=shift;
+ my $srvcounter=0;
+ #Count services used in servicegroups
+ foreach my $key (keys %customgrp) {
+ if($customgrp{$key}[2] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - config
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[4] eq $searchstring){
+ $srvcounter++;
+ }
+ if($fwfwd{$key1}[6] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - input
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[4] eq $searchstring){
+ $srvcounter++;
+ }
+ if($fwinp{$key2}[6] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - outgoing
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[4] eq $searchstring){
+ $srvcounter++;
+ }
+ if($fwout{$key3}[6] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ return $srvcounter;
+}
+sub getsrvcount
+{
+ my $searchstring=shift;
+ my $srvcounter=0;
+ #Count services used in servicegroups
+ foreach my $key (keys %customservicegrp) {
+ if($customservicegrp{$key}[2] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - config
+ foreach my $key1 (keys %fwfwd) {
+ if($fwfwd{$key1}[15] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - input
+ foreach my $key2 (keys %fwinp) {
+ if($fwinp{$key2}[15] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ #Count services used in firewall - outgoing
+ foreach my $key3 (keys %fwout) {
+ if($fwout{$key3}[15] eq $searchstring){
+ $srvcounter++;
+ }
+ }
+ return $srvcounter;
+}