Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- $GlobalDomainIp = $_GET['ip'];
- $connection = ssh2_connect($GlobalDomainIp, 22, array('hostkey'=>'ssh-rsa'));
- if (ssh2_auth_pubkey_file($connection, 'root',
- '/var/www/html/ssh/id_rsa.pub',
- '/var/www/html/ssh/id_rsa', 'secret')) {
- //echo "Public Key Authentication Successful\n";
- } else {
- die('Public Key Authentication Failed');
- }
- function GetFromSsh($value){
- global $connection;
- if($GetValueStream = ssh2_exec($connection,$value)){
- stream_set_blocking($GetValueStream,true);
- return stream_get_contents($GetValueStream);
- }
- }
- //echo "<strong>Server Model : ". GetFromSsh("prtconf -b | grep banner-name | cut -d':' -f2") ."</strong>";
- //echo "<br/>";
- echo "<strong>".GetFromSsh("prtconf | grep Memory") ."</strong>";
- echo "<br/>";
- echo "<br/>";
- $result= GetFromSsh("zoneadm list -cv");
- $resultArray = preg_split('/[\s]+/',trim($result));
- $rows = array_chunk($resultArray,6);
- $columns = array_shift($rows);
- $data = array();
- foreach ($rows as $row) {
- $q = array_combine($columns, $row);
- if($q['NAME']=="global"){
- $q['NAME'] = GetFromSsh("hostname");
- $q['IP'] = $GlobalDomainIp;
- $q['BRAND'] = "YES";
- $GDname = $q['NAME'];
- }
- else{
- $q['IP'] = GetFromSsh("zonecfg -z ".$q['NAME'] ." info | grep address | awk '{print $2}'");
- $q['BRAND'] = "NO";
- }
- $data[] = $q;
- }
- echo "<br/>";
- echo "<br/>";
- echo "<table border=\"1\" width=\"70%\" cellpadding=\"0\" cellspacing=\"0\" id=\"product-table\" align=\"center\">";
- echo "<tr bgcolor=\"#FFCC99\">";
- echo "<th width=\"2%\" ><a href=\"\">ID</a></th>";
- echo "<th width=\"11%\"><a href=\"\">Hostname</a></th>";
- echo "<th width=\"11%\"><a href=\"\">Global Domain</a></th>";
- echo "<th width=\"22%\"><a href=\"\">ZoneRoot</a></th>";
- echo "<th width=\"11%\"><a href=\"\">IP Address</a></th>";
- echo "<th width=\"6%\"><a href=\"\">Zone State</a></th>";
- echo "</tr>";
- for($i=0;$i<count($data);$i++){
- echo "<tr>";
- echo "<td>".$i." </td>";
- echo "<td>".$data[$i]['NAME']. "</td>";
- echo "<td>".$data[$i]['BRAND']. "</td>";
- echo "<td>".$data[$i]['PATH']. "</td>";
- echo "<td>".$data[$i]['IP']. "</td>";
- echo "<td>".$data[$i]['STATUS']."</td>";
- echo "</tr>";
- }
- echo "</table>";
- echo "<br/>";
- echo "<div align=\"center\">";
- echo "<input type=\"button\" name=\"Home\" id=\"Home\" value=\"Home\" onClick=\"window.location.href='check.html';\">";
- echo "</div>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement