From cf59cd673d8dbec35931c22c4b107efc9b614081 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Fri, 27 Jan 2012 00:15:46 +0100 Subject: [PATCH] Add adv show route --- lg.py | 12 +++++++++--- templates/layout.html | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lg.py b/lg.py index 59cd19f..6c2b3a0 100755 --- a/lg.py +++ b/lg.py @@ -5,7 +5,7 @@ import os import subprocess import re from urllib2 import urlopen -from urllib import quote +from urllib import quote, unquote from toolbox import mask_is_valid, ipv6_is_valid, ipv4_is_valid, resolve @@ -159,6 +159,10 @@ def traceroute(hosts, proto): infos[host] = add_links(resultat) return render_template('traceroute.html', infos=infos) +@app.route("/adv//") +def show_route_filter(hosts, proto): + return show_route("", hosts, proto) + @app.route("/where//") def show_route_where(hosts, proto): return show_route("where", hosts, proto) @@ -176,12 +180,14 @@ def show_route_for_detail(hosts, proto): return show_route("prefix_detail", hosts, proto) def show_route(req_type, hosts, proto): - expression = request.args.get('q', '') + expression = unquote(request.args.get('q', '')) set_session(req_type, hosts, proto, expression) all = (req_type.endswith("detail") and " all" or "" ) - if req_type.startswith("where"): + if not req_type: + command = "show route " + expression + elif req_type.startswith("where"): command = "show route where net ~ [ " + expression + " ]" + all else: mask = "" diff --git a/templates/layout.html b/templates/layout.html index 63b4be5..8dff43e 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -140,6 +140,7 @@ $( function() {
  • show route for ... all
  • show route where net ~ [ ... ]
  • show route where net ~ [ ... ] all
  • +
  • show route ...
  • {% if session.request_args %}

    ... = {{session.request_args}}