User Tools

Site Tools


ios:isysadm

Table of Contents

Per info su questo progetto: Gioxx (gioxx@gxware.org)

iSysAdm è un insieme di pagine ottimizzate per la navigazione da iPhone e Android che permettono di sfruttare strumenti “basilari” per un tecnico / sistemista in ufficio o fuori sede. Mette a disposizione comandi di ping, traceroute e whois su IP o dominio pubblico.

Disponibile per tutti all'indirizzo Sys.portami.li, non ancora “pubblicizzato” perché in via di sviluppo, è possibile che venga integrato tra gli strumenti di dev:Gioxx, quest'ultimo passerà quasi certamente sotto dominio GxWare.org e non più Gioxx.org.

Sistema utilizzato

Tutto iSysAdm si basa sul framework gratuito iWebKit, ben poco modificato per essere adattato al meglio alle esigenze del prodotto. Non trattandosi di un'app vera e propria ma funzionando via Safari sarà necessario essere coperti da connettività (3G o WiFi), non è possibile navigarlo in modalità offline.

Ping

Questo il codice pagina privo di CSS utilizzato su iSysAdm, liberamente scaricabile:

ping.php
<?php
// Crediti originali
//  This script was writen by webmaster@theworldsend.net, Aug.2001
//  http://www.theworldsend.net 
//  This is my first script. Enjoy.
//  
// Put it into whatever directory and call it. That's all.
// Updated to 4.2 code 
// Get Variable from form via register globals on/off
//-------------------------
$max_count = 10; //maximum count for ping command
$unix      =  1; //set this to 1 if you are on a *unix system      
$windows   =  0; //set this to 1 if you are on a windows system
// -------------------------
// nothing more to be done.
// -------------------------
//globals on or off ?
$register_globals = (bool) ini_get('register_gobals');
$system = ini_get('system');
$unix = (bool) $unix;
$win  = (bool)  $windows;
//
If ($register_globals)
{
   $ip = getenv(REMOTE_ADDR);
   $self = $PHP_SELF;
} 
else 
{
   $submit = $_GET['submit'];
   $count  = $_GET['count'];
   $host   = $_GET['host'];
   $ip     = $_SERVER['REMOTE_ADDR'];
   $self   = $_SERVER['PHP_SELF'];
};
// form submitted ?
If ($submit == "Ping!") 
{
   // over count ?
   If ($count > $max_count) 
   {
      echo 'Massimi cicli: '.$max_count;
      echo '<a href="'.$self.'">Indietro</a>';
   }
   else 
   {
      // replace bad chars
      $host= preg_replace ("/[^A-Za-z0-9.]/","",$host);
      echo '<body bgcolor="#FFFFFF" text="#000000"></body>';
      echo '<img src="images/SyS_header.png"><br /><br />';
	  echo("<b>Output del Ping</b><br />"); 
      echo '<pre>';           
      //check target IP or domain
      if ($unix) 
      {
         system ("ping -c$count -w$count $host");
         system("killall ping");// kill all ping processes in case there are some stalled ones or use echo 'ping' to execute ping without shell
      }
      else
      {
         system("ping -n $count $host");
      }
      echo '</pre>';
	   echo '<br /><br /><p style="font-variant: small-caps;"><b><a href="ping.php">Nuovo ping</a></b> / <b><a href="index.php">Torna alla Home</a></b></p>';
    }
} 
else 
{
    echo '<body bgcolor="#FFFFFF" text="#000000"></body>';
	echo '<img src="images/SyS_header.png">';
    echo '<pre>Il tuo IP: '.$ip.'</pre>';
    echo '<form methode="post" action="'.$self.'">';
    echo '   <b>IP di destinazione</b> <input type="text" name="host" value="'.$ip.'"></input>';
    echo '   <br /><b>Cicli</b> <input type="text" name="count" size="2" value="4"></input>';
    echo '   <br /><input type="submit" name="submit" value="Ping!"></input>';
    echo '</form>';
    echo '<br /><b>'.$system.'</b>';
	 echo '<br /><br /><p style="font-variant: small-caps;"><b><a href="ping.php">Nuovo ping</a></b> / <b><a href="index.php">Torna alla Home</a></b></p>';
    echo '</body></html>';
}
?>

Tracert

Questo il codice pagina privo di CSS utilizzato su iSysAdm, liberamente scaricabile:

tracert.php
<?php
// Crediti originali
//  This script was writen by webmaster@theworldsend.net, Aug.2001
//  http://www.theworldsend.net 
//  This is my first script. Enjoy.
//  
// Put it into whatever directory and call it. That's all.
// Updated to 4.2 code in 2002
// Get Variable from form via register globals on/off
//-------------------------
$unix      =  1; //set this to 1 if you are on a *unix system      
$windows   =  0; //set this to 1 if you are on a windows system
// -------------------------
// nothing more to be done.
// -------------------------
//globals on or off ?
$register_globals = (bool) ini_get('register_gobals');
$system = ini_get('system');
$unix = (bool) $unix;
$win  = (bool)  $windows;
//
If ($register_globals)
{
   $ip = getenv(REMOTE_ADDR);
   $self = $PHP_SELF;
} 
else 
{
   $submit = $_GET['submit'];
   $host   = $_GET['host'];
   $ip     = $_SERVER['REMOTE_ADDR'];
   $self   = $_SERVER['PHP_SELF'];
};
// form submitted ?
If ($submit == "Traceroute!") 
{
      // replace bad chars
      $host= preg_replace ("/[^A-Za-z0-9.]/","",$host);
      echo '<body bgcolor="#FFFFFF" text="#000000"></body>';
      echo '<img src="images/SyS_header.png"><br /><br />';
	  echo 'Output del Trace:'; 
      echo '<pre>';           
      //check target IP or domain
      if ($unix) 
      {
         system ("traceroute $host");
         system("killall -q traceroute");// kill all traceroute processes in case there are some stalled ones or use echo 'traceroute' to execute without shell
      }
      else
      {
         system("tracert $host");
      }
      echo '</pre>'; 
      echo 'fatto ...';  
	  echo '<br /><br /><p style="font-variant: small-caps;"><b><a href="tracert.php">Nuovo traceroute</a></b> / <b><a href="index.php">Torna alla Home</a></b></p>';
} 
else 
{
    echo '<body bgcolor="#FFFFFF" text="#000000"></body>';
	echo '<img src="images/SyS_header.png">';
    echo '<pre>Il tuo IP: '.$ip.'</pre>';
    echo '<form methode="post" action="'.$self.'">';
    echo '   IP o Host di destinazione <input type="text" name="host" value="'.$ip.'"></input>';
    echo '   <br /><input type="submit" name="submit" value="Traceroute!"></input>';
    echo '</form>';
    echo '<br><b>'.$system.'</b>';
	 echo '<br /><br /><p style="font-variant: small-caps;"><b><a href="tracert.php">Nuovo traceroute</a></b> / <b><a href="index.php">Torna alla Home</a></b></p>';
    echo '</body></html>';
}
?>

Whois

Questo il codice pagina privo di CSS utilizzato su iSysAdm, liberamente scaricabile:

whois.php
<?php
// Crediti originali
/*************************************************************************
php easy :: whois lookup script
==========================================================================
Author:      php easy code, www.phpeasycode.com
Web Site:    http://www.phpeasycode.com
Contact:     webmaster@phpeasycode.com
*************************************************************************/
 
$domain = $_GET['domain'];
 
// For the full list of TLDs/Whois servers see http://www.iana.org/domains/root/db/ and http://www.whois365.com/en/listtld/
$whoisservers = array(
	"ac" =>"whois.nic.ac",
	"ae" =>"whois.nic.ae",
	"aero"=>"whois.aero",
	"af" =>"whois.nic.af",
	"ag" =>"whois.nic.ag",
	"al" =>"whois.ripe.net",
	"am" =>"whois.amnic.net",
	"arpa" =>"whois.iana.org",
	"as" =>"whois.nic.as",
	"asia" =>"whois.nic.asia",
	"at" =>"whois.nic.at",
	"au" =>"whois.aunic.net",
	"az" =>"whois.ripe.net",
	"ba" =>"whois.ripe.net",
	"be" =>"whois.dns.be",
	"bg" =>"whois.register.bg",
	"bi" =>"whois.nic.bi",
	"biz" =>"whois.biz",
	"bj" =>"whois.nic.bj",
	"br" =>"whois.registro.br",
	"bt" =>"whois.netnames.net",
	"by" =>"whois.ripe.net",
	"bz" =>"whois.belizenic.bz",
	"ca" =>"whois.cira.ca",
	"cat" =>"whois.cat",
	"cc" =>"whois.nic.cc",
	"cd" =>"whois.nic.cd",
	"ch" =>"whois.nic.ch",
	"ci" =>"whois.nic.ci",
	"ck" =>"whois.nic.ck",
	"cl" =>"whois.nic.cl",
	"cn" =>"whois.cnnic.net.cn",
	"com" =>"whois.verisign-grs.com",
	"coop" =>"whois.nic.coop",
	"cx" =>"whois.nic.cx",
	"cy" =>"whois.ripe.net",
	"cz" =>"whois.nic.cz",
	"de" =>"whois.denic.de",
	"dk" =>"whois.dk-hostmaster.dk",
	"dm" =>"whois.nic.cx",
	"dz" =>"whois.ripe.net",
	"edu" =>"whois.educause.edu",
	"ee" =>"whois.eenet.ee",
	"eg" =>"whois.ripe.net",
	"es" =>"whois.ripe.net",
	"eu" =>"whois.eu",
	"fi" =>"whois.ficora.fi",
	"fo" =>"whois.ripe.net",
	"fr" =>"whois.nic.fr",
	"gb" =>"whois.ripe.net",
	"gd" =>"whois.adamsnames.com",
	"ge" =>"whois.ripe.net",
	"gg" =>"whois.channelisles.net",
	"gi" =>"whois2.afilias-grs.net",
	"gl" =>"whois.ripe.net",
	"gm" =>"whois.ripe.net",
	"gov" =>"whois.nic.gov",
	"gr" =>"whois.ripe.net",
	"gs" =>"whois.nic.gs",
	"gw" =>"whois.nic.gw",
	"gy" =>"whois.registry.gy",
	"hk" =>"whois.hkirc.hk",
	"hm" =>"whois.registry.hm",
	"hn" =>"whois2.afilias-grs.net",
	"hr" =>"whois.ripe.net",
	"hu" =>"whois.nic.hu",
	"ie" =>"whois.domainregistry.ie",
	"il" =>"whois.isoc.org.il",
	"in" =>"whois.inregistry.net",
	"info" =>"whois.afilias.info",
	"int" =>"whois.iana.org",
	"io" =>"whois.nic.io",
	"iq" =>"vrx.net",
	"ir" =>"whois.nic.ir",
	"is" =>"whois.isnic.is",
	"it" =>"whois.nic.it",
	"je" =>"whois.channelisles.net",
	"jobs" =>"jobswhois.verisign-grs.com",
	"jp" =>"whois.jprs.jp",
	"ke" =>"whois.kenic.or.ke",
	"kg" =>"www.domain.kg",
	"ki" =>"whois.nic.ki",
	"kr" =>"whois.nic.or.kr",
	"kz" =>"whois.nic.kz",
	"la" =>"whois.nic.la",
	"li" =>"whois.nic.li",
	"lt" =>"whois.domreg.lt",
	"lu" =>"whois.dns.lu",
	"lv" =>"whois.nic.lv",
	"ly" =>"whois.nic.ly",
	"ma" =>"whois.iam.net.ma",
	"mc" =>"whois.ripe.net",
	"md" =>"whois.ripe.net",
	"me" =>"whois.meregistry.net",
	"mg" =>"whois.nic.mg",
	"mil" =>"whois.nic.mil",
	"mn" =>"whois.nic.mn",
	"mobi" =>"whois.dotmobiregistry.net",
	"ms" =>"whois.adamsnames.tc",
	"mt" =>"whois.ripe.net",
	"mu" =>"whois.nic.mu",
	"museum" =>"whois.museum",
	"mx" =>"whois.nic.mx",
	"my" =>"whois.mynic.net.my",
	"na" =>"whois.na-nic.com.na",
	"name" =>"whois.nic.name",
	"net" =>"whois.verisign-grs.net",
	"nf" =>"whois.nic.nf",
	"nl" =>"whois.domain-registry.nl",
	"no" =>"whois.norid.no",
	"nu" =>"whois.nic.nu",
	"nz" =>"whois.srs.net.nz",
	"org" =>"whois.pir.org",
	"pl" =>"whois.dns.pl",
	"pm" =>"whois.nic.pm",
	"pr" =>"whois.uprr.pr",
	"pro" =>"whois.registrypro.pro",
	"pt" =>"whois.dns.pt",
	"re" =>"whois.nic.re",
	"ro" =>"whois.rotld.ro",
	"ru" =>"whois.ripn.net",
	"sa" =>"whois.nic.net.sa",
	"sb" =>"whois.nic.net.sb",
	"sc" =>"whois2.afilias-grs.net",
	"se" =>"whois.iis.se",
	"sg" =>"whois.nic.net.sg",
	"sh" =>"whois.nic.sh",
	"si" =>"whois.arnes.si",
	"sk" =>"whois.ripe.net",
	"sm" =>"whois.ripe.net",
	"st" =>"whois.nic.st",
	"su" =>"whois.ripn.net",
	"tc" =>"whois.adamsnames.tc",
	"tel" =>"whois.nic.tel",
	"tf" =>"whois.nic.tf",
	"th" =>"whois.thnic.net",
	"tj" =>"whois.nic.tj",
	"tk" =>"whois.dot.tk",
	"tl" =>"whois.nic.tl",
	"tm" =>"whois.nic.tm",
	"tn" =>"whois.ripe.net",
	"to" =>"whois.tonic.to",
	"tp" =>"whois.nic.tl",
	"tr" =>"whois.nic.tr",
	"travel" =>"whois.nic.travel",
	"tv" => "tvwhois.verisign-grs.com",
	"tw" =>"whois.twnic.net.tw",
	"ua" =>"whois.net.ua",
	"ug" =>"whois.co.ug",
	"uk" =>"whois.nic.uk",
	"us" =>"whois.nic.us",
	"uy" =>"nic.uy",
	"uz" =>"whois.cctld.uz",
	"va" =>"whois.ripe.net",
	"vc" =>"whois2.afilias-grs.net",
	"ve" =>"whois.nic.ve",
	"vg" =>"whois.adamsnames.tc",
	"wf" =>"whois.nic.wf",
	"ws" =>"whois.website.ws",
	"yt" =>"whois.nic.yt",
	"yu" =>"whois.ripe.net");
 
function LookupDomain($domain){
	global $whoisservers;
	$whoisserver = "";
	foreach($whoisservers as $tld=>$server) {
		if(substr($domain, -strlen($tld)) == $tld) {
			$whoisserver = $server;
			break;
		}
	}
	if(!$whoisserver) {
		return "Error: No appropriate Whois server found for $domain domain!";
	}
	$result = QueryWhoisServer($whoisserver, $domain);
	if(!$result) {
		return "Error: No results retrieved from $whoisserver server for $domain domain!";
	}
	else {
		while(strpos($result, "Whois Server:") !== FALSE){
			preg_match("/Whois Server: (.*)/", $result, $matches);
			$secondary = $matches[1];
			if($secondary) {
				$result = QueryWhoisServer($secondary, $domain);
				$whoisserver = $secondary;
			}
		}
	}
	return "$domain domain lookup results from $whoisserver server:\n\n" . $result;
}
 
function LookupIP($ip) {
	$whoisservers = array(
		//"whois.afrinic.net", // Africa - returns timeout error :-(
		"whois.apnic.net", // Asia/Pacific - OK :-)
		"whois.arin.net", // North America - OK :-)
		"whois.lacnic.net", // Latin America and some Caribbean - OK :-)
		"whois.ripe.net" // Europe, the Middle East, and Central Asia - OK :-)
	);
	$out = array();
	foreach($whoisservers as $whoisserver) {
		$result = QueryWhoisServer($whoisserver, $ip);
		if(preg_match("/Country: (.*)/i", $result, $matches)) {
			$out[]= "lookup results for $ip from $whoisserver server:\n\n" . $result;
		}
	}
	return count($out) . " RESULTS FOUND:\n-------------\n" . implode("\n\n-------------\n\n", $out);
}
 
function ValidateIP($ip) {
	$ipnums = explode(".", $ip);
	if(count($ipnums) != 4) {
		return false;
	}
	foreach($ipnums as $ipnum) {
		if(!is_numeric($ipnum) || ($ipnum > 255)) {
			return false;
		}
	}
	return $ip;
}
 
function ValidateDomain($domain) {
	if(!preg_match("/^([-a-z0-9]{2,100})\.([a-z\.]{2,8})$/i", $domain)) {
		return false;
	}
	return $domain;
}
 
function QueryWhoisServer($whoisserver, $domain) {
	$port = 43;
	$timeout = 10;
	$fp = @fsockopen($whoisserver, $port, $errno, $errstr, $timeout) or die("Socket Error " . $errno . " - " . $errstr);
	if($whoisserver == "whois.verisign-grs.com") $domain = "=".$domain; // whois.verisign-grs.com requires the equals sign ("=") or it returns any result containing the searched string.
	fputs($fp, $domain . "\r\n");
	$out = "";
	while(!feof($fp)){
		$out .= fgets($fp);
	}
	fclose($fp);
 
	return $out;
}
?>
 
<body>
<img src="images/SyS_header.png"><br /><br />
<b>Attenzione:</b>
<pre>Inserisci l'indirizzo senza http:// davanti e senza il www. (esempio: google.it)</pre>
<form action="<?=$_SERVER['PHP_SELF'];?>">
<p><b><label for="domain">Dominio / IP:</label></b> <input type="text" name="domain" id="domain" value="<?=$domain;?>"> <input type="submit" value="Whois"></p>
</form>
<?
if($domain) {
	$domain = trim($domain);
	if(ValidateIP($domain)) {
		$result = LookupIP($domain);
	}
	elseif(ValidateDomain($domain)) {
		$result = LookupDomain($domain);
	}
	else die("Invalid Input!");
	echo "<pre>\n" . $result . "\n</pre>\n";
	echo '<p style="font-variant: small-caps;"><b><a href="whois.php">Nuovo whois</a></b> / <b><a href="index.php">Torna alla Home</a></b></p>';
}
?>
</body>
</html>
ios/isysadm.txt · Last modified: 2012/09/17 17:06 by Giovanni