Problem with Ruby and Metasploit (mainly db_nmap) [SOLVED]

Started by ContactFront, March 22, 2013, 02:47:43 PM

Previous topic - Next topic

ContactFront

 Id first like to say hello To everyone on the forums, as this is my first (hopefully of many) post (s)


Im experiencing an Issue with Metaspoit, and im unsure, and cant find much to help resolve this.

It occurs when i pass a db_nmap <address> to Metasploit console, and also causes Armitage to not display any results.

Looking at it, it has something to do with nmap passing the results xml to the database, and also occurs when i try to run nmap externally and import it to msfconsole


Im fully up to date with apt, msf and gems.

Paste Below. (sorry if its a bit long)

msf > db_nmap 192.168.x.x
  • Nmap: Starting Nmap 6.00 ( http://nmap.org ) at 2013-03-22 13:38 Z
  • Nmap: Nmap scan report for 192.168.x.x
  • Nmap: Host is up (0.020s latency).
  • Nmap: Not shown: 994 closed ports
  • Nmap: PORT    STATE    SERVICE
  • <Results Omitted>
  • Nmap: Nmap done: 1 IP address (1 host up) scanned in 1.80 seconds
    /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:89: warning: multiple values for a block parameter (2 for 1)
       from /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:89
    /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:89: warning: multiple values for a block parameter (2 for 1)
       from /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:89
    /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:89: warning: multiple values for a block parameter (2 for 1)
       from /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:89
    /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:89: warning: multiple values for a block parameter (2 for 1)
       from /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:89
    [-] Error while running command db_nmap: undefined method `delete' for nil:NilClass

    Call stack:
    /opt/backbox/msf/lib/rex/parser/nmap_nokogiri.rb:92:in `end_element'
    /usr/lib/ruby/vendor_ruby/nokogiri/xml/sax/document.rb:127:in `end_element_namespace'
    /usr/lib/ruby/vendor_ruby/nokogiri/xml/sax/parser.rb:110:in `parse_with'
    /usr/lib/ruby/vendor_ruby/nokogiri/xml/sax/parser.rb:110:in `parse_memory'
    /usr/lib/ruby/vendor_ruby/nokogiri/xml/sax/parser.rb:83:in `parse'
    /opt/backbox/msf/lib/msf/core/db.rb:4866:in `import_nmap_noko_stream'
    /opt/backbox/msf/lib/msf/core/db.rb:4884:in `import_nmap_xml'
    /opt/backbox/msf/lib/msf/core/db.rb:4836:in `import_nmap_xml_file'
    /opt/backbox/msf/lib/msf/ui/console/command_dispatcher/db.rb:1415:in `cmd_db_nmap'
    /opt/backbox/msf/lib/msf/core/patches/active_record.rb:22:in `with_connection'
    /opt/backbox/msf/lib/msf/ui/console/command_dispatcher/db.rb:1353:in `cmd_db_nmap'
    /opt/backbox/msf/lib/rex/ui/text/dispatcher_shell.rb:427:in `send'
    /opt/backbox/msf/lib/rex/ui/text/dispatcher_shell.rb:427:in `run_command'
    /opt/backbox/msf/lib/rex/ui/text/dispatcher_shell.rb:389:in `run_single'
    /opt/backbox/msf/lib/rex/ui/text/dispatcher_shell.rb:383:in `each'
    /opt/backbox/msf/lib/rex/ui/text/dispatcher_shell.rb:383:in `run_single'
    /opt/backbox/msf/lib/rex/ui/text/shell.rb:200:in `run'
    /opt/backbox/msf/msfconsole:168




    Its a Bit frustrating to be honest, as its something i play with reguarly.

    Thanks in advance.





weVeg

Hi ContactFront, few month ago I've experienced this problem too, I've googled a lot and surfed all the net without find a solution... so, I've fixed removing msf and reinstalled "at hand" downloading it from the official site...
This is what I did, if there is another also simple solution I don't know....
my2C
una voce libera รจ sempre liberatrice
under_r00t

ContactFront

Yes.

Ive completly removed it, and cloned a new copy.

Ive been into postgres and dropped the previous database, and user (backbox:backbox)

Added a new user, and created a new database, edited /opt/backbox/config/default.yml afterwards

Still the same.

Thanks for your time.

SaThaRiel

Have you done an msfupdate or something (git pull)? The db_nmap is working fine here - just using the "official" packages coming with BB.

If you are using the git/svn versions of msf it maybe possible that theyre broken. After all its the development version.

An gem update could cause this too.

ContactFront

#4
it all happened when svn moved to git, and was mainly to do with nokogiri.

I removed all and, cloned via git to experience the same error,

Removed again, and used the metasploit-installer from their website, and its back to normal, adding targets to hosts when i pass db_nmap again.

Strange.

appreciated weVeg i must of been overthinking it. Basically done as you said.

And it must be something to do with the git devel copy SaThaRiel.


Cheers