summaryrefslogtreecommitdiff
path: root/dns.php
blob: 2ac85d14d0633aab6f49c426396ca0b4198e6318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
error_reporting(E_ALL);

if ($_POST['domain']) {
  echo "domain posted\n";

  $connection = ssh2_connect("misc.tghost.co.uk", 22, array("hostkey" => "ssh-rsa"));

  if (ssh2_auth_pubkey_file($connection, "bladns.net", "/home/bladns.net/.ssh/id_rsa.pub", "/home/bladns.net/.ssh/id_rsa")) {
    echo "Public Key Authentication Successful\n<br>\n<br>";
  } else {
    echo "Public Key Authentication Failed\n<br>\n<br>";
  }

  echo "<pre>";
  $stream = ssh2_exec($connection, "ps aux | grep named");
  stream_set_blocking($stream, true);
  $stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
  echo stream_get_contents($stream_out);
  echo "</pre>";
} else {
?>
<!DOCTYPE html>
<html>
  <head>
    <title>BlaDNS</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <form name="login" action="dns.php" method="post">
      Domain name: <input type="text" name="domain"><br>
      Password: <input type="password" name="password"><br>
      <input type="submit">
    </form>
  </body>
</html>
<?php
}
?>