mirror of
https://github.com/ziirish/burp-ui.git
synced 2026-05-21 06:45:24 -06:00
escape special chars in variable name (fix #225)
This commit is contained in:
parent
e2f9910f35
commit
662e5e2f24
2 changed files with 8 additions and 2 deletions
|
|
@ -7,6 +7,7 @@
|
|||
.. moduleauthor:: Ziirish <hi+burpui@ziirish.me>
|
||||
|
||||
"""
|
||||
import re
|
||||
import math
|
||||
import uuid
|
||||
|
||||
|
|
@ -62,6 +63,11 @@ def bytes_human(value):
|
|||
return '{0:.1eM}'.format(_hr(value))
|
||||
|
||||
|
||||
@view.app_template_filter()
|
||||
def regex_replace(value, regex, replace):
|
||||
"""Replace every string matching the given regex with the replacement"""
|
||||
return re.sub(regex, replace, value, flags=re.IGNORECASE)
|
||||
|
||||
"""
|
||||
And here is the main site
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ $.get("{{ url_for('api.clients_all') }}")
|
|||
|
||||
{% for srv in config.SERVERS %}
|
||||
|
||||
var _clients_{{ srv }} = [];
|
||||
var _clients_{{ srv|regex_replace("[^a-z0-9_]", "_") }} = [];
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ $('#input-client').typeahead({
|
|||
{
|
||||
name: '{{ srv }}',
|
||||
displayKey: 'name',
|
||||
source: substringMatcher(_clients_{{ srv }}),
|
||||
source: substringMatcher(_clients_{{ srv|regex_replace("[^a-z0-9_]", "_") }}),
|
||||
templates: {
|
||||
header: '<h3 class="server-name">{{ srv }}</h3>'
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue