Skip to content

Commit

Permalink
use import instead of rewrite blueprint's record function
Browse files Browse the repository at this point in the history
  • Loading branch information
VertexC committed May 24, 2019
1 parent 56bd9ab commit 774468b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions mod_honeypot/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
jsonify, request, make_response

import netifaces as ni
import copy

from Crypto import Random
from sqlalchemy import and_
Expand All @@ -22,11 +23,6 @@
PiModels, CollectorTypes

mod_honeypot = Blueprint('honeypot', __name__)
@mod_honeypot.record
def record_params(setup_state):
app = setup_state.app
# TODO: python3 update
mod_honeypot.config = dict([(key, value) for (key, value) in app.config.iteritems()])

@mod_honeypot.before_app_request
def before_request():
Expand Down Expand Up @@ -136,6 +132,7 @@ def profiles_id(id):
@check_access_rights()
@template_renderer()
def manage():
from run import app
new_deploy = NewDeploymentForm()
new_deploy.rpi_model.choices = [(key, value) for key, value in PiModels]
new_deploy.profile_id.choices = [
Expand Down Expand Up @@ -179,7 +176,7 @@ def manage():
return jsonify(result)

if sys.platform.startswith("linux"):
addrs = ni.ifaddresses(mod_honeypot.config.get('NETWORK_INTERFACE'))
addrs = ni.ifaddresses(app.config.get('NETWORK_INTERFACE'))
new_deploy.server_ip.data = addrs[ni.AF_INET][0]['addr']
print('Setting default ip: %s' % addrs[ni.AF_INET][0]['addr'])
else:
Expand Down

0 comments on commit 774468b

Please sign in to comment.