Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 959b74d7a2
Fetching contributors…

Cannot retrieve contributors at this time

65 lines (46 sloc) 1.416 kb
# -*- coding: utf-8 -*-
Web application for probing other applications.
:copyright: (c) Copyright 2011 by Armin Ronacher.
:license: see LICENSE for more details.
import urlparse
from flask import Flask, request, abort, render_template, \
import libprobe
app = Flask(__name__)
app.debug = True
def get_hostname(url):
return urlparse.urlparse(url).netloc.split(':')[0]
def make_url(url):
if not urlparse.urlparse(url).scheme:
url = 'http://' + url
return url
def is_safe_url(url):
return urlparse.urlparse(url).scheme in ('http', 'https')
def probe_url(url):
url, results = libprobe.magic_probe(url, timeout=10)
return [x for x in results if x.score > 0.3]
def index():
results = url = None
if request.method == 'POST':
url = make_url(request.form['url'])
if not is_safe_url(url):
url = None
results = probe_url(url)
return render_template('index.html', url=url, results=results)
def probe():
url = request.values.get('url')
if not url or not is_safe_url(url):
results = probe_url(url)
func = get_template_attribute('_results.html', 'render_results')
return func(url, results)
if __name__ == '__main__':
Jump to Line
Something went wrong with that request. Please try again.