summaryrefslogtreecommitdiff
path: root/index.php
blob: 770636cba623f18af49ffffdc8ffc9c6f46bea66 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php require_once 'config.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="keywords" content="Looking Glass, LG, BGP, prefix-list, AS-path, ASN, traceroute, ping, IPv4, IPv6, Cisco, Juniper, Internet" />
  <meta name="description" content="<?php echo $config['frontpage']['title']; ?>" />
  <title><?php echo $config['frontpage']['title']; ?></title>
  <link href="bootstrap-3.1.1/css/bootstrap.min.css" rel="stylesheet" />
  <link href="bootstrap-3.1.1/css/bootstrap-theme.min.css" rel="stylesheet" />
  <link href="<?php echo $config['frontpage']['css']; ?>" rel="stylesheet" />
</head>

<body>
  <div class="header_bar">
    <h1><?php echo $config['frontpage']['title']; ?></h1><br />
    <?php
    if (isset($config['frontpage']['image'])) {
      echo '<img src="'.$config['frontpage']['image'].'" alt="logo" />';
    }
    ?>
  </div>

  <div class="content" id="command_options">
    <form role="form" action="execute.php" method="post">
      <div class="form-group">
        <label for="routers">Router to use</label>
        <select size="5" class="form-control" name="routers">
        <?php
        $first = true;
        foreach (array_keys($config['routers']) as $router) {
          if ($first) {
            $first = false;
            echo '<option value="'.$router.'" selected="selected">'.
              $config['routers'][$router]['desc'].'</option>';
          } else {
            echo '<option value="'.$router.'">'.
              $config['routers'][$router]['desc'].'</option>';
          }
        }
        ?>
        </select>
      </div>

      <div class="form-group">
        <label for="query">Command to issue</label>
        <select size="5" class="form-control" name="query" id="query">
          <option value="bgp" selected="selected">show route IP_ADDRESS</option>
          <option value="as-path-regex">show route as-path-regex AS_PATH_REGEX</option>
          <option value="as">show route AS</option>
          <option value="ping">ping IP_ADDRESS</option>
          <option value="traceroute">traceroute IP_ADDRESS</option>
        </select>
      </div>

      <div class="form-group">
        <label for="parameters">Parameters</label>
        <input class="form-control" name="parameters" id="input-params" />
      </div>

      <div class="confirm btn-group btn-group-justified">
        <div class="btn-group">
          <button class="btn btn-primary" id="send" type="submit">Enter</button>
        </div>
        <div class="btn-group">
          <button class="btn btn-danger" id="clear" type="reset">Reset</button>
        </div>
      </div>
    </form>
  </div>

  <div class="loading">
    <div class="progress progress-striped active">
      <div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
      </div>
    </div>
  </div>

  <div class="result">
    <pre class="pre-scrollable" id="output"></pre>
    <div class="reset">
      <button class="btn btn-danger btn-block" id="backhome">Reset</button>
    </div>
  </div>

  <div class="footer_bar">
    <p class="text-center">
      <?php
      if (isset($config['frontpage']['disclaimer']) &&
        !empty($config['frontpage']['disclaimer'])) {
        echo 'Your IP address: '.$_SERVER['REMOTE_ADDR'].'<br />';
        echo $config['frontpage']['disclaimer'];
        echo '<br /><br />';
      }

      if (isset($config['contact']) && !empty($config['contact'])) {
        echo 'Contact:&nbsp;';
        echo '<a href="mail:'.$config['contact']['mail'].'">'.$config['contact']['name'].'</a>';
      }
      ?>
    </p>
  </div>

  <!-- jquery / bootstrap / custom functions -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <script src="bootstrap-3.1.1/js/bootstrap.min.js"></script>
  <script src="includes/utils.js"></script>
  </script>
</body>
</html>