Back to Blog
![]() Metasploit Pro, by contrast, generates a permanent authentication token on startup and store this token in a file named /apps/pro/engine/tmp/service.key. This username and password combination can be used with the auth.login API to obtain a temporary token that will grant access to the rest of the API. The Metasploit Framework RPC server requires a username and password to be specified. This will create a permanent token either in the database backend or in-memory, depending on the whether a database is present. The first method is to authenticate using a valid login, then using the temporary token to call the auth.token_generate method. There are two ways to create a new permanent token through the API. Permanent tokens are stored in the database backend (api_keys table) when a database is available and in memory otherwise. If the token is not used for 5 minutes, another call to auth.login must be made to obtain a new token.Ī permanent token acts as an API key that does not expire. ![]() This token is automatically extended every time it is used to access an API method. If a correct username and password is supplied, a token is returned that is valid for 5 minutes. These tokens come in two forms temporary and permanent.Ī temporary token is returned by the API call auth.login, which consults an internal list of valid usernames and passwords. An authentication is typically a randomly generated 32-byte string, but may be created ad-hoc as well. For example, the following code works as expected:Īccess to the Metasploit API is controlled through authentication tokens. After you provide a name, click the Create button to generate the token.Īn important consideration with the msfrpc-client library is that the authentication token is automatically passed into each method call for you, so when calling an API function such as "core.version", you do not need to specify the token as the first parameter. The form will require that you provide a key name for the API token. When the Global Settings page appears, click on the API Keys tab and then click the Create an API key button. To generate an API key, you can log in to the Metasploit Pro web interface ( and select Administration > Global Settings. As an alternative to a Metasploit Pro account, you can use an authentication token instead. The username and password options can either correspond to the credentials you set up for the server through the msgrpc plugin or a Metasploit Pro user account. -f - Runs the daemon in the foreground.įor example, if you want to connect to the local server with 'user/pass123', you can enter the following command:.-S - Enables or disables SSL on the RPC socket.-P - The password to access the server.-U - The username to access the server.-p - The local port that the server listens on.-a - The local hostname that the server listens on.You'll need to cd into your framework directory, if you're a Framework user, or the metasploit/apps/pro/msf3 directory if you are a Pro user, and run the following command: If all goes well, you'll see the following response, which tells you the IP address, username, and password you can use to connect to the msgrpc server:Ĥ Successfully loaded plugin : msgrpc Starting the RPC Server for the Metasploit Framework Using MSFRPCDĪnother way to start the server is to use the msfrpcd tool, which enables the server to listen on a particular port and provide clients that connect to it with an RPC interface to the Metasploit Framework. To use the msgrpc plugin, you need to launch msfconsole and run the msf > load msgrpc command. The msgrpc plugin provides a MessagePack interface that spawns a listener on a defined port and allows you to issue remote commands so you can facilitate interactions with Metasploit. If you are using the Metasploit Framework, you can load the msgrpc plugin to start the server. ![]() Starting the RPC Server for the Metasploit Framework Using MSGRPC If you are running a development environment, the service is listening at 127.0.0.1:50505 with SSL disabled. The SSL certificate is self-signed, however you can exchange it for a root-signed certificate as necessary. With a standard Metasploit Pro installation, the service is listening at 0.0.0.0:3790 with SSL. Starting the RPC Server for Metasploit Pro There are a couple of ways that you can start the server depending on the Metasploit product you are using. Before you can use the RPC interface, you must start the RPC server.
0 Comments
Read More
Leave a Reply. |