# -*- coding: utf8 -*-
"""
.. module:: api
   :platform: Unix
   :synopsis: Burp-UI api module.

.. moduleauthor:: Ziirish <ziirish@ziirish.info>


"""
import os
import re

from burpui import app
from flask.ext.restful import Api

api = Api(app)

app.jinja_env.globals.update(api=api)

# hack to automatically import api modules
for f in os.listdir(__path__[0]):
    if (os.path.isfile(os.path.join(__path__[0], f)) and
            re.search('\.py$', f) and not
            re.match('__init__', f)):
        mod = 'burpui.api.'+f[:-3]
        __import__(mod)

@@ -356,16 +356,52 @@
 __%5B0%5D):%0A
+    name, ext = os.path.splitext(f)%0A
     if (
@@ -465,59 +465,50 @@
     
-re.search('%5C.py$', f) and not%0A            re.match(
+ext == '.py' and%0A            name not in %5B
 '__i
@@ -515,18 +515,26 @@
 nit__', 
-f)
+'.', '..'%5D
 ):%0A     
@@ -559,9 +559,11 @@
 pi.'
-+
+ + 
 f%5B:-

improve dynamic loading