Skip to content

Support per-host snmp community strings #122

@dmiller-nmap

Description

@dmiller-nmap

From http://seclists.org/nmap-dev/2014/q1/224:

It's been bugging me for a while how poorly the SNMP NSE library
handled community strings. Essentially, there is a single place in the
registry to store a community string, regardless of whether different
hosts have different communities. The snmp-brute script overwrites
this single place (nmap.registry.snmpcommunity) every time it finishes
a host, so the scripts that rely on it to set the community could be
using the wrong one.

The attached patch adds a Helper class to handle choosing the
community and all the socket communication. Now the discovered
communities are stored in host.registry.snmpcommunity, so each host
can be handled separately. Moving all the socket communication into
the library means this patch actually reduces the number of lines of
code in NSE.

This patch should probably be modified to use the creds library to store and retrieve these credentials. This would allow storing multiple per-service community strings (e.g. read and write both).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions