Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Fixed bug #1 in gae_utils commit cdf9bbbdd69bf1a15489fd911770a2aa6c…

…d9b5c4 by resetting template_values

- Display error page with HTTP status code if URL is not valid or could not be fetched
- Added variables to error template which now extends base template
  • Loading branch information...
commit e511b6a5e715bfe0eefed18d1f94b6137a664898 1 parent 5b9de53
@yaph yaph authored
Showing with 16 additions and 9 deletions.
  1. +11 −8 main.py
  2. +5 −1 templates/404.html
View
19 main.py
@@ -14,11 +14,10 @@ def get(self):
class ScanHandler(BaseHandler):
def get(self):
- title = 'DOM XSS Scanner - Scan %s'
-
url = self.get_param('url', '', 'url')
if url:
self.set_template_value('url', url)
+ self.set_template_value('title', 'DOM XSS Scanner - Scan %s' % url)
response = gae.HTTP().request(url)
if response:
html = response.content
@@ -29,15 +28,19 @@ def get(self):
if ctype.find('html') > 0 or ctype.find('xml') > 0:
script_urls = DOMXSS().get_script_urls(url, html)
self.set_template_value('script_urls', simplejson.dumps(script_urls))
- else:
- url = ''
- self.set_template_value('title', title % url)
+ if self.is_ajax():
+ self.generate('text/javascript', 'response.html')
+ else:
+ self.generate('text/html', 'scan.html')
+
+ else:
+ self.set_template_value('error', 'Error: Supplied URL could not be fetched.')
+ self.generate('text/html', 'error.html')
- if self.is_ajax():
- self.generate('text/javascript', 'response.html')
else:
- self.generate('text/html', 'scan.html')
+ self.set_template_value('error', 'Error: Supplied URL is not valid.')
+ self.generate('text/html', 'error.html')
class PageHandler(BaseHandler):
def get(self, name):
View
6 templates/404.html
@@ -1 +1,5 @@
-404
+{% extends 'base.html' %}
+
+{% block title %}{{ error}}{% endblock %}
+
+{% block content %}{{ error}}{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.