HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/share/doc/libnet-ip-perl/examples/iptab
#!/usr/bin/perl

use Net::IP;
use strict;

print "+----------------------------------------------+
| addrs   bits   pref   class  mask            |
+----------------------------------------------+
";

my ($ip,$size,$class,$bits,$len);

my $ip = new Net::IP('0');

for my $len (reverse (0..32))
{

	$ip->set("0.0.0.0/$len");

	$size = $ip->size();
	
	if ($size >=1048576) # 1024*1024
	{
		$size /= 1048576;
		$size .= 'M';
	}
	elsif ($size >= 1024)
	{
		$size /= 1024;
		$size .= 'K';
	};		
	
	$len = $ip->prefixlen();
	$bits = 32 - $len;
	
	if ($bits >= 24)
	{
		$class = 2**($bits-24);
		$class.= 'A';
	}
	elsif ($bits >= 16)
	{
		$class = 2**($bits-16);
		$class.= 'B';
	}	
	elsif ($bits >= 8)
	{
		$class = 2**($bits-8);
		$class.= 'C';
	}	

	printf ("| %5s %6s %6s %7s  %-15s |\n",
		$size,$bits,'/'.$len,$class,$ip->mask());
	

};

print "+----------------------------------------------+\n";