1 of 1 people found this helpful
The official API doc is here on the community site: https://community.rapid7.com/docs/DOC-1516 -- As you noted, the db.* calls are currently unsupported.
That said, you can certainly look at the v10 api in order to determine the appropriate arguments. The (rpc) db methods are located in lib/msf/core/rpc/v10/rpc_db.rb.
It appears that you'll need to set a 'driver' option, as well as the regular arguments required to connect to the DB (located in lib/msf/core/db_manager.rb) -- those arguments should be at a minimum: host, port, username, password.
These arguments are then passed directly to Active Record to establish the database connection. You can find more about that API here: http://api.rubyonrails.org/classes/ActiveRecord/Base.html#method-c-establish_con nection
Keep in mind the db.* RPC APIs are not supported and likely to be deprecated. We suggest that you setup your DB connection in the code that loads the RPC service, not through the API itself.
Thanks for the answers, however: how can i use api v10?
It's like the old APIs, so i have to use rpc.call("API_TO_CALL") or i have to instruct the RPC server to use v10 APIs?
The v10 api is implemented with msgpack (http://msgpack.org/). You can install the official client with a 'gem install msfrpc-client', and this includes an example of accessing the Pro methods of the API. More examples can be found here. Framework-only methods can be accessed similarly.
The Framework listener can be started by loading the plugin 'load msgrpc' which will start a listener on the default port of :55552/tcp. The Pro listener is started automatically, and is located at :3790/tcp.
At first, thanks for the help.
I installed the required gems and i'm looking at the examples on the repos, but i have another question: for example if i use:
Has this call the syntax the old APIs, or there is a new set of calls? If it's so i didn't understand hot to use the new calls in .../msf/lib/msf/core/rpc/v10/ and i would like to seek clarifications.
i follow this steps:
- execute msfrpcd in msg mode OK
- execute msfrpc_irb.rb example OK
- execute in irb shell old calls OK
- execute in irb shell new calls Msf::RPC::ServerException: ArgumentError Unknown API Group:
I'm quite sure that i'm in mistake with syntax but looking at this
and obviusly changing the call to fit the framework, for example db.rpc_status (the old one was db.status, right?) i get that Exception.