metasploit-framework

https://github.com/rapid7/metasploit-framework

Ruby

Metasploit Framework

SNMP::Manager#walk

Walks a list of ObjectId or VarBind objects using get_next until
the response to the first OID in the list reaches the end of its
MIB subtree.

The varbinds from each get_next are yielded to the given block as
they are retrieved.  The result is yielded as a VarBind when walking
a single object or as a VarBindList when walking a list of objects.

Normally this method is used for walking tables by providing an
ObjectId for each column of the table.

For example:

  SNMP::Manager.open(:Host => "localhost") do |manager|
    manager.walk("ifTable") { |vb| puts vb }
  end

  SNMP::Manager.open(:Host => "localhost") do |manager|
    manager.walk(["ifIndex", "ifDescr"]) do |index, descr|
      puts "#{index.value} #{descr.value}"
    end
  end

The index_column identifies the column that will provide the index
for each row.  This information is used to deal with "holes" in a
table (when a row is missing a varbind for one column).  A missing
varbind is replaced with a varbind with the value NoSuchInstance.

Note: If you are getting back rows where all columns have a value of
NoSuchInstance then your index column is probably missing one of the
rows.  Choose an index column that includes all indexes for the table.

Source | Google | Stack overflow

Edit

git clone [email protected]:rapid7/metasploit-framework.git

cd metasploit-framework

open lib/snmp/manager.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-SNMP--Manager-walk-for-pr


# Commit to git

git add lib/snmp/manager.rbgit commit -m "better docs for SNMP::Manager#walk"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-SNMP--Manager-walk-for-pr

hub pull-request


# Celebrate!