rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34.14k stars 13.97k forks source link

Get RPC job result or Exception on RPC module.execute[auxiliary/scanner] in job.info and empty job.list #11596

Closed dan-leech closed 3 years ago

dan-leech commented 5 years ago

Steps to reproduce

Expected behavior

I want to take the job result somehow. Maybe I do something wrong and job has been done already...

Current behavior

I get Exception:

Msf::RPC::ServerException (Msf::RPC::Exception Invalid Job ["lib/msf/core/rpc/v10/rpc_base.rb:25:in `error'", "lib/msf/core/rpc/v10/rpc_job.rb:33:in `rpc_stop'", "lib/msf/core/rpc/v10/service.rb:153:in `block in process'", "lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'", "lib/ruby/2.6.0/timeout.rb:33:in `block in catch'", "lib/ruby/2.6.0/timeout.rb:33:in `catch'", "lib/ruby/2.6.0/timeout.rb:33:in `catch'", "lib/ruby/2.6.0/timeout.rb:108:in `timeout'", "lib/msf/core/rpc/v10/service.rb:153:in `process'", "lib/msf/core/rpc/v10/service.rb:91:in `on_request_uri'", "lib/msf/core/rpc/v10/service.rb:72:in `block in start'", "lib/rex/proto/http/handler/proc.rb:38:in `on_request'", "lib/rex/proto/http/server.rb:368:in `dispatch_request'", "lib/rex/proto/http/server.rb:302:in `on_client_data'", "lib/rex/proto/http/server.rb:161:in `block in start'", "lib/rex/io/stream_server.rb:48:in `on_client_data'", "lib/rex/io/stream_server.rb:199:in `block in monitor_clients'", "lib/rex/io/stream_server.rb:197:in `each'", "lib/rex/io/stream_server.rb:197:in `monitor_clients'", "lib/rex/io/stream_server.rb:73:in `block in start'", "lib/rex/thread_factory.rb:22:in `block in spawn'", "lib/msf/core/thread_manager.rb:106:in `block in spawn'"])

System stuff

Metasploit version

{"version"=>"5.0.13-dev-2bb0d84", "ruby"=>"2.6.1 x86_64-linux 2019-01-30", "api"=>"1.0"}

I installed Metasploit with:

What OS are you running Metasploit on? NAME="Linux Mint" VERSION="18.2 (Sonya)" PRETTY_NAME="Linux Mint 18.2" VERSION_CODENAME=sonya UBUNTU_CODENAME=xenial

gcmurphy commented 5 years ago

In case this helps at all - I'm new at this and hit this in 5.0.16-dev-0c7e589d.

However I noticed that if you scanned a larger address range (or do something to make the scheduled job run for longer) you can see it via rpc.call('job.list') and rpc.call('job.info'). If the job is short lived it won't appear in the list of active jobs. This is similar how msfconsole works if you do run -j.

From what I can tell it seems that the only way to obtain some of the results from the scan is via the rpc.call('db.*) family of calls. So you can do things like db.hosts, db.services and db.vulns as per rpc_db.rb.

In my case I would like to have access to the auxiliary scanner output (ideally in a useful format). It does not seem currently possible to set LocalOutput which would potentially allow at least the capture of the auxiliary scanner output to file at least. So the only way I can figure out how to do this is via console.* commands.

dick129418 commented 4 years ago

@dan-leech the same error. solved yet?

github-actions[bot] commented 3 years ago

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

github-actions[bot] commented 3 years ago

Hi again!

It’s been 60 days since anything happened on this issue, so we are going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.