Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host lookup in service formatting fails #171

Open
mwulftange opened this issue Feb 5, 2015 · 3 comments
Open

Host lookup in service formatting fails #171

mwulftange opened this issue Feb 5, 2015 · 3 comments

Comments

@mwulftange
Copy link

The host lookup db.t_hosts[r.f_hosts_id] in the formatting function for services in models/db_02_kvasir.py fails when trying to edit a vulnerability of a service (…/vulns/service_vulns_edit.html/123) with the following trace:

Traceback (most recent call last):
  File "/opt/web2py/gluon/restricted.py", line 224, in restricted
    exec ccode in environment
  File "/opt/web2py/applications/kvasir/controllers/vulns.py", line 807, in <module>
  File "/opt/web2py/gluon/globals.py", line 392, in <lambda>
    self._caller = lambda f: f()
  File "/opt/web2py/gluon/tools.py", line 3449, in f
    return action(*a, **b)
  File "/opt/web2py/applications/kvasir/controllers/vulns.py", line 491, in service_vulns_edit
    onaccept=crud.archive)
  File "/opt/web2py/gluon/tools.py", line 4066, in update
    **attributes # contains hidden
  File "/opt/web2py/gluon/sqlhtml.py", line 1230, in __init__
    inp = self.widgets.options.widget(field, default)
  File "/opt/web2py/gluon/sqlhtml.py", line 289, in widget
    options = requires[0].options()
  File "/opt/web2py/gluon/validators.py", line 579, in options
    self.build_set()
  File "/opt/web2py/gluon/validators.py", line 576, in build_set
    self.labels = [self.label(r) for r in records]
  File "/opt/web2py/applications/kvasir/models/db_02_kvasir.py", line 81, in <lambda>
    format=lambda r:XML("%s :: %s/%s" % (db.t_hosts[r.f_hosts_id].f_ipaddr, r.f_proto, r.f_number)),
AttributeError: 'NoneType' object has no attribute 'f_ipaddr'
@fnoelscher
Copy link

it works for me. how did you create the vulnerability and the host?

@grutz
Copy link
Contributor

grutz commented Feb 5, 2015

Was this on a fresh database or from one prior to the f_ipv4/f_ipv6 to
f_ipaddr change?

This could also be a cached select() issue. Did you just create a
vulnerability and attempt to assign it to a service?

Kurt Grutzmacher -=- [email protected]

On Thu, Feb 5, 2015 at 7:11 AM, fnoelscher [email protected] wrote:

it works for me. how did you create the vulnerability and the host?


Reply to this email directly or view it on GitHub
#171 (comment)
.

@mwulftange
Copy link
Author

I imported NMAP XML results into a fresh database, created a vulnerability and added it to a service. That worked. But when trying to edit the assigned vulnerability, the mentioned error occurred.

I already did some debugging and although r.f_hosts_id has a value and replacing r.f_hosts_id by its value (i. e., db.t_hosts[12345]) works, somehow db.t_hosts[r.f_hosts_id] just returns None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants