File: tcp.pl

package info (click to toggle)
cacti 0.6.7-2.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,000 kB
  • ctags: 1,120
  • sloc: php: 5,059; sql: 922; sh: 302; perl: 81; makefile: 56
file content (14 lines) | stat: -rwxr-xr-x 232 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl

#gets inbound and outbound tcp connections

if ($ARGV[0] eq "tcp") {
	$conn = `netstat -n | grep -c \":\"`;
	chomp $conn;
}else{
	$conn = `netstat -na | grep -c LISTEN`;
}

$conn =~ s/ //;

print $conn;