summaryrefslogtreecommitdiff
path: root/index.php
blob: 25fcfa8689483d9fa2ce2fc8011ca7ea75e2d249 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/*
 * Looking Glass - An easy to deploy Looking Glass
 * Copyright (C) 2014 Guillaume Mazoyer <gmazoyer@gravitons.in>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */

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" id="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" 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="input-params">Parameters</label>
        <input class="form-control" 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>